exact same backtest but totally different results

 

hi

I build an ea and let it run on strategytester in MT4. 

What me strikes is that when i do exact the same backtests (so same period, same settings, same fixed spread et cetera) i get different results! Even when directly after a testrun is finished i do 'start' again. So no new history files or something.

The same is when i choose 'optimize'   When i optimize and analyse the results of that and put the most profitable one and test that in 'normal' test (not optimizing), i get totally different results. So optimizing is nothing worth then...

Please can somebody help me? Because before i want to go on real account i want the best settings for my EA of course.

Kind regards,

Ronald

Documentation on MQL5: Constants, Enumerations and Structures / Environment State / Account Properties
Documentation on MQL5: Constants, Enumerations and Structures / Environment State / Account Properties
  • www.mql5.com
, then each symbol positions will be closed in the same order, in which they are opened, starting with the oldest one. In case of an attempt to close positions in a different order, the trader will receive an appropriate error. There are several types of accounts that can be opened on a trade server. The type of account on which an...
 
In future please post in the correct section
I will move your topic to the MQL4 and Metatrader 4 section.
 
sorry  i thought this was the good section.
 

Hi Ronald,

there is no MT4 but only the Broker's MT4. The same EA tested in simulation, if you change Broker, will give different results. And the results in Real mode will still be different. There are many variables: .1. the history of the data downloaded from the MT4 default is only an approximation and depends on the Broker. 2. the MT4 does not always correctly load the data history, sometimes it is necessary to turn the MT4 off and on several times 3. the data history depends on the cross considered 4. the MT4 does not always correctly process the custom indicators 5. the same EA tested with the same parameters on the same time period (e.g. 2015) on the same cross after years (sometimes even months) can have different results because the MT4 has changed.

All this in simulation then when the EA run in Real mode we still have other variables: 1. the spread can increase even 50 times from that declared by Broker, for example during the night or news 2. the Swap affects trades that last several days. 3 The same for slippage.

You will never find the best settings for EA.

MT4 is free, access to the CFD market is free, leverage is free, the historical data series is free almost always the Broker is Market Maker (if you earn the Broker loses).

Ask yourself a question and give yourself the answer.

 

Hi 

Thanks for reply. Maybe i was not clear, but i use exact the same MT4, same broker, same settings etc. Literally within few minutes i start same backtests, with all the same.

So what you said is of course true, but it's not the case here.

 

Same settings? Are you sure? What did you set for spread?

Always specify Tester-Spread

The spread is constant during the run. It is the current spread for the pair (your broker,) at the moment you start the test.

If you start the test on the weekend, the current spread is likely to be very large.

Most brokers with variable spread widen considerably at end of day (5 PM ET) ± 30 minutes. My GBPJPY (OANDA) shows average spread = 26 points, but average maximum spread = 134. The charts show Bid prices only. Turn on the Ask line to see how big the spread is, Tools → Options (control+O) → charts → Show ask line.
 
Hi William, yes i'm sure exact te same settings. I set the spread fixed in strategytester at 20 points (so 2 pips). So not the current spread. What me strikes is that when i do exact the same backtests (so same period, same settings, same fixed spread et cetera) i get different results! Even when directly after a testrun is finished i do 'start' again. So no new history files or something.

The same is when i choose 'optimize'   When i optimize and analyse the results of that and put the most profitable one and test that in 'normal' test (not optimizing), i get totally different results. So optimizing is nothing worth then...

Please can you help me? Because before i want to go on real account i want the best settings for my EA of course.
 
Ronald Stolk:
Hi William, yes i'm sure exact te same settings. I set the spread fixed in strategytester at 20 points (so 2 pips). So not the current spread. What me strikes is that when i do exact the same backtests (so same period, same settings, same fixed spread et cetera) i get different results! Even when directly after a testrun is finished i do 'start' again. So no new history files or something.

The same is when i choose 'optimize'   When i optimize and analyse the results of that and put the most profitable one and test that in 'normal' test (not optimizing), i get totally different results. So optimizing is nothing worth then...

Please can you help me? Because before i want to go on real account i want the best settings for my EA of course.

If you do not change parameters you need to have same backtests results for 10-100-1000 times.

Spread is mostly the guilty of different results.

If you set it to a fixed value, there can be something in your EA based on random calculations, without the code it will be very difficult for us to help you.

 

Hi Ronald.


The same is happening with my backtests on MT4.  What I did find is that when my account currency and market currency is the same the backtest is repeatable with exactly the same results.

When the account currency and market currency differs I get small differences in the end result.

 

As far as I know when using MT4 backtesting with the 'Every tick' option the backtester will generate intermediate tick data for every bar using a pseudo random generator making sure that the price passes through the open, high, low and close price during each bar.

To make your test repeatable you should only exit or enter at the start or end of a bar since those prices remain the same over every run.  The intermediate tick prices might differ slightly on each run if a different seed is used for the run so if you have stops or take profits that execute during a bar those trades will happen at slightly different prices.  In general it looks like the same seed is used for market prices but for exchange rates the seed differs on every run.

In general this should not matter since your backtests will anyway only statistically aproximate any future experience.