Download MetaTrader 5
To add comments, please log in or register
Interested in traders' opinion? Arrange a poll on the Forum!
skatt
186
skatt 2009.06.05 17:27 
Since the function ObjectGetValueByShift returns a different value for each time frame, it would be nice if we could specify which time frame we want to get the value from.
ZenTrader
51
ZenTrader 2014.05.26 17:07  
It took me several hours to figure out that one, and the reason why my code was not working. Is there an alternative?
whroeder1
13596
whroeder1 2014.05.27 16:39  
skatt: Since the function ObjectGetValueByShift returns a different value for each time frame, it would be nice if we could specify which time frame we want to get the value from.

It doesn't return a different value for each time frame. You are asking for the values at different times. iTime(NULL,PERIOD_D1,x) != iTime(NULL,PERIOD_M1,x) so of course you get different values from ByShift(x) from different timeframes.

If you want the value from another timeframe, get the proper shift

datetime  BOD = iTime(NULL, PERIOD_D1, 0);
int      iBOD = iBarShift(NULL,0, BOD);
double   valueAtBOD = ObjectGetValueByShift(name, iBOD);

/
To add comments, please log in or register