Problem with backtesting on different timeframes

 

Hi!

My EA calculates the momentum for 15 minute timeframe and 1 hour timeframe. I use:

double Min_15 = iMomentum(NULL,PERIOD_M15 ,20,PRICE_CLOSE,1);

double H1 = iMomentum(NULL,PERIOD_H1 ,20,PRICE_CLOSE,1);

If I choose period M15 (for the backtest) I get values for Min_15 and none for H1, if I choose period H1 it is the other way round.


Shall I choose period M15 and let the H1 momentum be calculatet using every fourth bar? Or is there a better way?

Thank you very much!

 

Maybe my description was not understandable. Here is a picture to show you what I mean:

If I run the backtest, I get results from

double Min_15 = iMomentum(NULL,PERIOD_M15 ,20,PRICE_CLOSE,1);

But the result from another timeframe (different to Periode 15, choosen as backtest setting)

double H1 = iMomentum(NULL,PERIOD_H1 ,20,PRICE_CLOSE,1);

is always zero :(

Did someone run a backtest using calculatings on different timeframes? So it is possible and I only have to find the failure or is it not possible in general?

I appreciate any ideas and thank you in advance!
 

Don't know what you are doing but your code works for me . . .

   double H1 = iMomentum(NULL,PERIOD_H1 ,20,PRICE_CLOSE,1);
   double Min_15 = iMomentum(NULL,PERIOD_M15 ,20,PRICE_CLOSE,1);
   
   Print("H1 = ",H1," Min_15 = ",Min_15);

gave me . . .

2011.07.25 10:50:40 2008.01.04 00:37 TestSpreadSMA GBPUSD,H1: H1 = 99.6113 Min_15 = 99.8633

on H1, and

2011.07.25 10:52:00 2008.01.04 00:18 TestSpreadSMA GBPUSD,M15: H1 = 99.6113 Min_15 = 99.8987

on M15

Show your code . . .

 

Hi RaptorUK,

thanks for your answer! It is not working for me (I am using exactly the code shown above). I only get a result for the choosen time period. Maybe it is because I am using tickdata and not the downloaded data from MT.

 
Do you have those timeframes open in charts, so you have history?
 
Yes, I have the timeframes opened as offlinecharts.
 
What does offline charts have to do with the standard GBPUSD M15 and H1 charts. Offline charts do not update in the tester.
 
Now it is working. I am using tick data for gaining a 99 % backtesting quality (instruction how to, if someone is interested can be found here: http://eareview.net/tick-data) and I forgot to put the *.hst files into the "MetaTrader 4\history\servername" - folder. Anyway, it´s great that every question in this forum is beeing answered! :-)