Strategy Tester does not reflect real trades



I have been using the strategy tester to test my Expert Advisor and verify my software design.  It looks really good.  The thing I like the most is how my EA will stop trading if I loss to much money. I set the loss to 3% The EA works every time in the strategy tester.

When I go is not the same software.  It is doing something completely different and not trading well.

I am using the MQL5 VPS in New york and I migrated  everything including the EA so I would hope the VPS would do exactly the same as the strategy tester.

Yesterday I lost 1/2 of my account on 11 out of 13 trades.  THE EA is only allowed to loss 3% and should stop all trades when loss is over 3% regardless of the profit won.

screenshot comparing real with Strategy tester

Looking at the results above , There are a number of errors.

1. Most of the trades resulted in a loss. The successful trades should be more the 2 times the losses.

2. There are too many trades. If the software works the same as the strategy tester it should only create 3 or 4 trades a day.

3. Trading should have stopped when the loss is 3% ($60)

I retested one of the currencies.... USDJPY.  In real trading this currency pair lost $324.96 in 5 trades and won 1 trade with a profit of 166.96

But the strategy tester only showed one trade which had a profit of 1.01

What is going on?   Why is the EA not working as designed when used with the MQL5 VPS? 

Below is my strategy tester settings.


Here is the VPS settings .


This is a serious issue. Now, I don't trusts Matatrader 5.

Any help would be great.



Obviously there is still something wrong with your code. The Strategy Tester cannot replicate all possible conditions.

After you have tested your EA in the tester, you should first test it live on a demo account (on your own PC, not a VPS) with plenty of prints/logging to monitor that it is in fact working correctly.

Then test it on a real account with a small balance, before even considering using it with a larger balance.


in strategy tester make sure you are connected to your broker account the currency is same as you have in real account and ofc the leverage

it is strange that every single position in your script seems duplicated. i would bet the fast ones are VPS and the slow ones are started by your own terminal. 

i believe is because of the digits of your EA and spread of broker. notice how your SL is too narrow, also notice your entry price eurjpy  has 3 digist while current price has 4 digits


Thanks everyone.  This is very helpful.  

BUT Seriously I cannot reproduce the real results with back testing.