Why do I get difference result for same EA on different timeframe?

 
I've tried to backtest my EA and when I do the backtest on a M15 timeframe, it ends up with a Stop Out order but when I test the same EA on a M1 timeframe, the EA works perfectly. In the EA, I use MACD and MA on three timeframe M15, H1 and H4 and each MACD and MA have a precise timeframe insert in the code. Same EA but different result. Have anyone noticed it and better if someone can someone tell me why it is the case?
 
jfdimania:
I've tried to backtest my EA and when I do the backtest on a M15 timeframe, it ends up with a Stop Out order but when I test the same EA on a M1 timeframe, the EA works perfectly. In the EA, I use MACD and MA on three timeframe M15, H1 and H4 and each MACD and MA have a precise timeframe insert in the code. Same EA but different result. Have anyone noticed it and better if someone can someone tell me why it is the case?
What was the spread for each test ?
 
jfdimania: it ends up with a Stop Out order but when I test the same EA on a M1 timeframe, the EA works perfectly. 

It's not working perfectly, you're just not seeing the problem on M1. Stop Out means your free margin dropped to zero and the broker would have closed your position (at a loss.) On the M1 your stops are probably smaller and you're not seeing it.

The EA must check that there is enough free margin (not just when you open, but) when you reach the most adverse excursion (i.e. SL) for ALL open orders. See my code's Lotsize()

 
RaptorUK:
What was the spread for each test ?


The spread is from 1.8 to 2.5. Does it influence the result difference on different timeframe?
 
WHRoeder:

It's not working perfectly, you're just not seeing the problem on M1. Stop Out means your free margin dropped to zero and the broker would have closed your position (at a loss.) On the M1 your stops are probably smaller and you're not seeing it.

The EA must check that there is enough free margin (not just when you open, but) when you reach the most adverse excursion (i.e. SL) for ALL open orders. See my code's Lotsize()


I see. But if the price drops on M1 on live trading, it drops on M15 also. You can see it when you do Show Ask line in properties, am I right? If I am right, it means that the same price applies to both timeframe and then in backtesting it should be the same. Sorry but I'm a newbie.
 
jfdimania:

The spread is from 1.8 to 2.5. Does it influence the result difference on different timeframe?
The spread is fixed from the start of the Strategy Tester run till the end . . .  if the 2 runs had significantly different spreads it could significantly affect the outcome.  Add a print to the init() or deinit() to Print() the spread (Ask - Bid) then you caan check the log to find what the spread was for each run . . .  or disconnect from your Broker while you use the ST then the spread will not change . . .
 
I've tried what you said and for the M1 timeframe, the spread is 0.2, 0.021 and 0.023 (I've tried several time) and it works perfectly. For the M15 timeframe, the spread is 0.022 and 0.021 and it ends with a Stop Out. However, in the journal for the M15 timeframe, I get the error "2013.05.24 19:29:47 TestGenerator: unmatched data error (volume limit 1553 at 2013.05.24 15:15 exceeded)" and not in the M1 timeframe. Is this connected to the problem? (I've attached a screen grab to the comment).
 
jfdimania:
I've tried what you said and for the M1 timeframe, the spread is 0.2, 0.021 and 0.023 (I've tried several time) and it works perfectly. For the M15 timeframe, the spread is 0.022 and 0.021 and it ends with a Stop Out. However, in the journal for the M15 timeframe, I get the error "2013.05.24 19:29:47 TestGenerator: unmatched data error (volume limit 1553 at 2013.05.24 15:15 exceeded)" and not in the M1 timeframe. Is this connected to the problem? (I've attached a screen grab to the comment).
Are your M1 and M15 runs from the same start and end dates ?  unmatched data errors are where the data from different timeframes do not match,  the ideal solution,  if you have the data,  is to create the timeframes above M1 from the M1 data,  for example, using the period converter script.
 
RaptorUK:
Are your M1 and M15 runs from the same start and end dates ?  unmatched data errors are where the data from different timeframes do not match,  the ideal solution,  if you have the data,  is to create the timeframes above M1 from the M1 data,  for example, using the period converter script.

Yes, I've used the same time period for the EA on the two M1 and M15 timeframe. What is the period converter script? For info, in the case I have "timeframe mismatch" when using the M15 and not on the M1, does this mean that the M1 is more exact than M15 in my case?
 
jfdimania:
Yes, I've used the same time period for the EA on the two M1 and M15 timeframe. What is the period converter script? For info, in the case I have "timeframe mismatch" when using the M15 and not on the M1, does this mean that the M1 is more exact than M15 in my case?

I'm not sure if timeframes above the one you run are checked or only below the one you run,  if it was only the timeframes below this would explain why you don't have unmatched data errors,  or perhaps the check is between the synthetic ticks created and the timeframe you choose to run on, the ticks are made from the M1 data (where available) so there again would not be errors when running on M1.

The period converter script allows you to make all the timeframes above M1 from your M1 data,  you can find it in the scripts section of the Navigator. 

Reason: