ADX Indicator Question.

 

I recently placed the ADX indicator in an EA and then ran the tester program and then saved the indicator results into a text file. I then compared the text file values for the ADX indicator to the Data Window's values for this indicator. What I noted was that for bar 0 the valuation in the text file does not tie out with the valuation in the Data Window. For bar 1 and bar 2 the valuations do tie out. Does anyone know why the bar 0 valuation does not equal the valuation in the Data Window? I am using "Every Tick" modeling method on a one minute interval.

 
ForexSurfr:

I recently placed the ADX indicator in an EA and then ran the tester program and then saved the indicator results into a text file. I then compared the text file values for the ADX indicator to the Data Window's values for this indicator. What I noted was that for bar 0 the valuation in the text file does not tie out with the valuation in the Data Window. For bar 1 and bar 2 the valuations do tie out. Does anyone know why the bar 0 valuation does not equal the valuation in the Data Window? I am using "Every Tick" modeling method on a one minute interval.

Hello,

Precisely, the value of ADX is calculated for each tick -which means you get a different value each time start() is executed -.

I suggest you ignore bar[0] in your EA and base your decisions from bar[1] ahead.

Cheers.

 
flaab:

Hello,

Precisely, the value of ADX is calculated for each tick -which means you get a different value each time start() is executed -.

I suggest you ignore bar[0] in your EA and base your decisions from bar[1] ahead.

Cheers.


flaab,

Thanks, but shouldn't the ending calculation based upon the last tick tie out with the ADX valuation for that bar? In other words shouldn't both the "Data Window" number and the EA number tie out?

 
ForexSurfr:


flaab,

Thanks, but shouldn't the ending calculation based upon the last tick tie out with the ADX valuation for that bar? In other words shouldn't both the "Data Window" number and the EA number tie out?

Well, it does. Bar[0] becomes Bar[1] after closing and then ties up :-D

Bar[0] is always unclosed, by definition. I mean, the final value for bar[0] does not exist as such.

 
flaab:

Well, it does. Bar[0] becomes Bar[1] after closing and then ties up :-D

Bar[0] is always unclosed, by definition. I mean, the final value for bar[0] does not exist as such.


and if the last tick of bar 0 exist and there is yet no new open bar then we have the situation that market is closed and we can't do any trading
 
deVries:

and if the last tick of bar 0 exist and there is yet no new open bar then we have the situation that market is closed and we can't do any trading
Well, you can calculate how much time there is left in the bar and trade at the very end.
 
flaab:
Well, you can calculate how much time there is left in the bar and trade at the very end.

but in the last second how many ticks can there be and start is running on ticks so maybe last 5 seconds there is no tick
 
deVries:

but in the last second how many ticks can there be and start is running on ticks so maybe last 5 seconds there is no tick
That is right! The EA is executed every tick, so if there is no tick in the last 5 seconds, you don't trade :-D
Reason: