Timeframe / Shift

 

Hi... quick question.

I'm working on an expert which trades in the main using 30min & 4h indicators. However It also has a 1min aspect so I run it on a 1min chart.

When calling the value of an indicator from another timeframe with a different shift to the current bar, i.e:

bmom=iMomentum(PERIOD_H4,0,14,PRICE_CLOSE,1);

Is it giving me the data from (in this case) the value of momentum on the previous 4h bar, or the value of 4h momentum on the previous 1min bar?

Thanks!

 

It's giving you the value of the previous PERIOD_H4 bar. However, the function call should be:

bmom = iMomentum(NULL,PERIOD_H4,14,PRICE_CLOSE,1);

 

Thank you!