Download MetaTrader 5

Correct way of calling indictor on different timeframe?

To add comments, please log in or register
gangsta1
1290
gangsta1  
    if (iCCI(NULL, PERIOD_D1,14,PRICE_OPEN,1) > 100)
Does this look correct? I have a feeling that the 100 will be referenced from the timeframe the EA is running on rather than d1?
honest_knave
Moderator
2318
honest_knave  

Take a look at iBarShift()

The code you have posted will retrieve the value of iCCI from the previous D1 bar. Not the previous bar of the chart timeframe (unless that also happens to be on D1).

100 is 100, regardless of what timeframe. 

To add comments, please log in or register