English

## Important question - shifted indicators

 1 stevie 2014.07.09 09:03   Hello all!From what I learned, the following two Indicators (which only differ in the shift attribute) should return exactly the same values, just shifted by one period:`PlusDI = iADX(NULL,0,14,PRICE_OPEN,MODE_PLUSDI,0);``PlusDI = iADX(NULL,0,14,PRICE_OPEN,MODE_PLUSDI,1);` Mysteriously, it sometimes works, but most of the time they do not return the same values (shifted). In my code, these lines above are executed at the beginning of each new candle. I hope, someone can shed some light on this. Thank you!
13126
WHRoeder 2014.07.09 13:53 #

 stevie: From what I learned, the following two Indicators (which only differ in the shift attribute) should return exactly the same values, just shifted by one period: Adx, like a moving average, changes each bar. The Adx[0] has a new price added (the open.)Why would you think you'd get "exactly the same value?"
20
xavilin 2014.07.09 16:50 #

WHRoeder:
 stevie: From what I learned, the following two Indicators (which only differ in the shift attribute) should return exactly the same values, just shifted by one period: Adx, like a moving average, changes each bar. The Adx[0] has a new price added (the open.)Why would you think you'd get "exactly the same value?"

isn't he saying that adx[0] now should be equal to adx[1] in the next period, but that it doesn't in his ea? if that's the case, i guess it is because at the begining of the bar, adx[0] is calculated with the first tick, while adx[1] is calculated with the whole bar. indeed, adx[1] now should be equal to adx[2] next period, but what he's asking is not possible neither logical.
 1815 SDC 2014.07.10 04:29 #   `PlusDI = iADX(NULL,0,14,PRICE_OPEN,MODE_PLUSDI,0); //- the value of a 14 period adx calculated using bars 0 through 13``PlusDI = iADX(NULL,0,14,PRICE_OPEN,MODE_PLUSDI,1); //- the value of a 14 period adx calculated using bars 1 through 14`