System Messages

This forum is for members of the Apiary Investment Fund. To learn more about how to get involved,
sign up now for a 14 day free trial or fill out the form below and preview the training right now!

Anti-Martingale Overnight Setup

Back to Forums

Anti-Martingale Overnight Setup

Steve Perry's Anti-Martingale Overnight Setup (MT4 EA and ALVEO script included)

Hello Fellow Bees!

I've been so impressed with Steve Perry's Anti-Martingale OverNight Setup strategy that I went straight to coding and here (attached) is the result of that.  

MT4 EA for Steve Perry's Anti-Martingale Overnight Setup.

Default values will set up the trades at 3 GMT or 11pm EST, and close all pending orders at 21 GMT or 5pm EST, everything else is just like Perry talks about in his webinar: 

Try it at your own risk and I do recommend trying it on a demo account first.  I'm new to ALVEO so it's probably going to be a while till I code something productive for that platform but I believe user was planning on writing something for ALVEO

Message me to let me know what you think!

Winshots-AntiMartingale-OverNightSetup-EA.ex417.44 KB
OverNightAntiMartingale_EA.jpg275.5 KB
Thu, 09/07/2017 - 4:11pm

Thanks @investmentandtrading24 and @bornjt @ of course @StevePerry.
I am sensing a lot of positivity on this strategy and want to join in on the success bandwagon!


I just want to thank @investmentandtrading24, @bornjt and @wayne-skerritt47 for working on these scripts. I followed the directions for install and ran a test of the script and it setup the trades without a hitch. Unfortunately I am not in a good trading window at the moment, but I plan on testing this overnight tonight. The script saves A LOT of time and looks spectacular. Thanks again guys. Very nice of you to share your work with us.



Great post investmentandtr..., this is huge and many seem to be having great success with Steve's anti martingale strategy and now this script?! You guys are awesome!


It's been a while since I checked this thread out. I noticed a few mentions of problems with the AntiMartingale software. Things can always be improved so I checked out the code just to be sure all the bases were covered. There were some instances where an error could be thrown because of incorrect settings selections. For example, if you choose LONG only and BIDIR (2-way) trading at the same would cause confusion and orders would not get placed.
Rev 3 is attached below. It works exactly the same as Rev 2 BUT will notify the user via alerts if incorrect settings choices are made. No trades are placed in those instances. Just double check your settings and try again. Also, the script will not work after 8 pm GMT on a Friday. It will not work on Christmas Day or Boxing Day. User friendliness is the key...

Best of luck to all,
Wayne S

AntiMartingaleOverNightSetup_r3.cs 13.96 KB

Wow, thanks Wayne S for the update. I have been using this script regularly and love it! I experienced the 8 pm GMT on Friday and it was a nice reminder to pump the brakes! lol! Thank you again, Happy Holidays. : )


Thanks Wayne I will try it out tomorrow.


This works beautifully! I'm planning to use this together with the London Breakout strategy in addition to news events.
Thanks for sharing!


wayne-skerritt47 and investmentandtrading24 and bornjt

Hello just want you to know I used the AntiMartingaleOverNightSetup_r3 script last night and it worked beautifully for +220 pips !!! Thank you to you and all who were involved in creating it including Steve Perry whos class in Anti-Martingale is great !!

My question is: is there a version of this to run on MT4 ? I believe there is an older one listed above but wanted to know if the newest features in AntiMartingaleOverNightSetup_r3 have been added. Please let me know and again thanks for sharing this great tool !!!!



Investmentandtrading24 thank you for sharing your hard work
Thank you Steve and bornjt also
I wish all of you the best


@ grwii

Thanks for the kudos and I am glad you are having such success using the script. So far I have never made that many pips in one go on Alveo. Hats off to you!

The MT4 thingy above is an EA (robot) and does not work in the same way as this script. As it stands it is limited in its application. Also, I'm pretty sure there have been no updates. There MAY be similar scripts available on the MT4 websites, but not exactly like this Alveo script. Personally, I am using MT4 less and less and concentrating using the Alveo platform (I am funded at this time).
Let me think about doing the equivalent MT4 version of Antimartingale. If I do it, I'll post it on this thread.



This looks very interesting!
Does one just download the ex4 and put it into the EA directory to run it??


@ wayne-skerritt47

Thanks Wayne !!

The 800+ pips was over the whole week not all at once but that many pips in a week is awesome for me !!! I ran it every night between 11pm and 1am (my time Eastern US) before the London open and it worked beautifully on its own 4 out of 5 nights and I closed it once manually in the morning for profits on a pullback.

Yes if you do convert it to MT4 I would love to use it. I tried to use the original MT4 version above but can not seem to find it once I install it. I'm new to MT4 but think I may need the .mq4 file to go along with the .ex4 compiled version. If you or anyone else has it I'd appreciate it !!

Thanks again and Happy Trading !!!



How to Install an EA in MT4


git it thx, will this ex work in Alveo?


@ rookie007 the *.ex file is for MetaTrader 4 only, if you scroll through this thread you will find a link to an ALVEO script which has to be run manually by you ...

Sorry, I just don't have the time to write and test an EA for ALVEO ... in fact, I have so little time to even trade that I ONLY use the original Anti-Martingale script to trade by setting up my trades 5 minutes before I go to bed ... but I must say this "set and forget" method has been quite good to me as it helped me get through Gold 1 (yes I'm still in it due to some technical glitch that's holding me on "Half Century: Maintain No Loss > 2%") and it helped me to get my simulated Gold 1 account out of a hole ...

I've been trying many different methods and got my account down to $8,000 but with the overnight Anti-Martingale script setup I've been able to slowly crawl out of that hole and re-gain the $2,000 loss ... see attached...


That´s solid Paul, keep it up.


@investment Was the climb from the bottom due solely to using the anti martingale method? Do you make any big losses using this method? What cause the decline, if you don't mind my asking? Trying to refine my strategy. Thanks,



Hi all,

I must agree with Paul about how good the Anti Martingale set-up has been for me, ok guys I am only on Silver 2 but the Steve Perry's Anti Martingale set-up has really helped me going through and the latest example was today, at one point using various strategies I was as much as 345 pips down on the day and I had to dig myself out of a very poor day and my very last resource was yes you guessed it...Anti Martingale and it is now 9.45 GMT and I have closed the day on + 196 pips, thank-you Steve, Paul and Anti M.
Good evening all.


Fantastic @vincenzo!



Thanks for your work it is impressive. I have a question for you.
You have coded the trades with a fixed stop and a decrease of the targets, depending on the interval between each trade I guess.
I have no experience in coding so I wonder if it is fairly easy to show and explain how to have a fixed target as well?
For example, I would like to have a 20 pip SL and 40 pip target on each and every trade that is placed by the script.
I´m greatful for any help.


Can someone please email me the file AntiMartingaleOverNightSetup_r2.cs. My email is Greatly, appreciated. Thank you,



thank you for sharing


Which pairs are you having the most success with using this strategy? And with which parameters? Thank you. Chris


I am asking same question as cbaczeski? Is anyone still using this. I got it loaded but seems to be sporatic on setting trades.


I am still using it on European with JPY and CAD crosses ... each pair is different so you have to find the right settings for each ... there is no majic number and constantly keep tweaking TP/SL ... GL!


Thanks for commenting. I appreciate that as well as your work on this strategy. I have been messing with it in my first simulated account and finally used it last night in my gold 1 account with my overnight gold strategy. It worked well I got 250 pips. Now I have a nice buffer to finish out gold 1 ... Thanks again... Greg


Maybe I am doing something wrong, I tried the anti MG a few times and I had primarily losses... It could also have been the that week in the market. I will try it again this week and the EURUSD and see if it does any better.


Garciac1, this tool is good when you have a direction. So use your other tools to get an idea of the direction of the market, then use the AMG to set up some trades to take advantage of the direction .

Good luck!


Markpowers is right . I just used short term resistance and support levels for entries and exits. I adjusted trade positions and stops and take profit points after I triggered the script. Staying away from Gold tonight though with the big news tomorrow.


Hey guys, thanks for sharing all the awesome coding work. Tried it for the first time last night for a -107 pip loss on EURJPY. I was intentionally avoiding the USD pairs with the FOMC news coming out today. It was just one of those crappy whipsaw sessions. Opened and stopped out about half the trades in each direction.

I used one of the older versions of the script but I now have what I think is the most recent one. I'll get that installed and give it another try. Maybe try some other pairs.

Not sure if I want to change the parameters or not?

I know there are lots of trades being setup by the grid already, and I only have one nights experience, but... has anyone considered adding another entry at the same place as each of these with close TPs - like 4 pips or something? One set does the usual and shoots for 30 or whatever you choose, and another set takes profits every 4 pips along the way. Just hate the idea that it could go 90% of the way through the range and trigger them all in and then reverse without any profit be taken. It might mitigate some of the downside on a whipsaw?


Had an idea - trying it in my silver account. Set two grids - one with a 30 TP and one with a 15 TP. If it goes half way and reverses I should at least book the first grid's profits to offset the others. Of course, if could go 14 pips and reverse and kill me in two sets of trades! We'll see.


Has anyone tried the 'forced' entry price yet? I've been trying to do one short and it tells me my price is invalid?

GBPJPY is around 149.50 and I wanted the sell orders to start at 149.30. See attached screen shots.

script-window.gif error.png

Maybe it's because I'm tying to do short only and didn't enter a long target? I'll try adding a long forced target value.


Yep - that fixed it. Even though I had the 'short only' box checked it must evaluate both forced entry prices and zero is not valid. I put a value in the forced buy line and it worked. And only created the short side orders.



Thanks! @danpettit57 I need to try the forced target!


It's a fun tool to play with - lots of possibilities to apply it.

I know it wouldn't technically be anti-martingale but has anyone written a script to enter several trades at the same price but scale out the TP's ? Say, 10 trades, all opened at the same place and then TPs every 2 or 5 pips? I guess the SL's would be fixed also.


I take some of the auto trades off once its set. I also thought about what you had early suggested about putting tp in two different places... I think that's a good idea. I mainly trade xauusd and it has wilder swings than some of the other currency's .. I will hopefully be able to continue to fine tune it. Which I think everyone who uses it should. Let us know what your fine tuning ends up to be.. thanks


Hey would anyone be willing to rewrite script AntiMartingaleOverNightSetup_r2.cs in Python? I would like to run some additional tests and figure out which parameters and pairs would yield the greatest results. Thank you. Hope everyone is trading well.


Hey @investmentandtrading24 and @wayne-skerrit47 (and everyone else) -

I've been following this thread for months and was finally able to insert the script into my Alveo software and run it.

Got whacked my first try; lost 200 pips. Well, try again, and...

...made 321 pips. GREAT! Thanks!

Question: I'm a nurse by trade, not a coder/IT person, although there's a large streak of wannageek in me. I've taken a look at the script and cannot figure out how to ---> create a unidirectional script, whereby I can set up the multiple-trade sequence in only one direction.

I know that both of you have lives so I'm not *demanding* this, nor am I asking that it be done immediately; when you're able to, can you determine whether/how you'd be able to change a few lines of the code to create a script that will set up multiple trades in only one direction. AND/OR....can you direct me to where within the script I can make such changes?

Thank you both for your amazing contribution to the hive; I think I'm speaking for many others when I say, "THANK YOU" for having offered this strategy for advancing in our knowledge of how to successfully trade the forex market.

Take care,

Jerome Stone, aka - FXMantis


I already wrote two separate scripts for this one for going long only and one for going short only with either multiple entries just like in the A-M script or just one etc ... I will post them later when I'm back home and have access to my ALVEO scripts ;-)


Here are the 2 scripts I have written separately as to not confuse their purpose for new traders

AntiMartingaleOverNightSetup_BUY_ONLY.cs 4.24 KB
AntiMartingaleOverNightSetup_SELL_ONLY.cs 4.24 KB

Thanks, I think I'll give this a shot


thank you fellas my first night using your combined skills 164 pips!!! lost 30 p earlier.


investmentandtr... how you copy this to alveo? thanks


Hey is there any suggestions on how I can get a basic understanding of how to code? I have a fairly thorough knowledge of how it works I just don't have the mechanics to put it in place. Thanks for opening the door.


@spotpal67, check out the following threads.
Also if you would like the coding book in word send me your email addy in a message.


Thanks Wayne and all contributors.

Trying it out tonight. The v1,2 won't run on current Alveo it seems, I could be wrong, but latest/v3 works very nicely.

Now to tackle C# so I can do some coding. Looks like fun!


The good, the bad, the ugly: Due to 'emergent' work situations (not forex related) I've been away from computer so hey, why not try out this sweet overnight setup!. And boy howdy... it performed well three nights in a row. The bad: this week in G1 I've gotten killed because I did not do due diligence and look at my daily movement, news, all the stuff the profitable people here on Apiary do and helpfully suggest us newbies do also.

Don't do what Donny Don't does.

And so the ugly: I'm not too sharp, I know that the script already has variables built right in, I think I will start using them now.

Brady Bush

I'm excited to try this out...too bad its a weekend. Can't wait for Sunday night! Nice work everyone.



Where is the webinar video archive for Steve Perry's anti-martingale strategy?

I believe I once asked Steve Perry more about this strategy and he said he chose not to use it anymore for preference of chart patterns and this (his) asia breakout method was inconclusive.


Also the next one here @:


Thanks triguylm1. Are you in Africa now? How often do you go there?


Yep, Still here, but headed home to St. George, Utah on Tuesday the 19th. So, this was first time to Africa for 6 weeks and will return to finish project in July, should take about 3 or 4 more weeks. I've worked on about 12 LDS Temples out of about 150 + throughout the world. Just last April, the church announced one to be built in Russia, but will still be working out the details of purchasing the building site.


Im having issues getting this to work with the newer beta version. It was working well with the older version last year. anyone encounter this?


It's no longer working on the new platform, I tried, and confirm. The updates are forced by Alveo so there's no way for us to keep the script. Unless someone can code a new version.