ADX Question for Phy

 

Hey Phy,


I'm using iCustom on the ADX indicator to get the values for bar[1] and bar[2] and the values that I get differs from what the chart shows. Any ideas what's going on?


ADXCurr = iCustom(NULL, 0, "ADX", 14, 0, 1);
ADXPrev = iCustom(NULL, 0, "ADX, 14, 0, 2);


Thanks,


Yi

 

ADX has three indexes, three lines.

Are you pulling the data for the correct index?

double iCustom( string symbol, int timeframe, string name, ..., int mode, int shift)

mode - Line index. Can be from 0 to 7 and must correspond with the index used by one of SetIndexBuffer functions.
 

Thanks for replying. I just confirmed that I'm accessing the correct buffer.


SetIndexBuffer(0,ADXBuffer);


ADXCurr = iCustom(NULL, 0, "ADX", 14, 0, 1);
ADXPrev = iCustom(NULL, 0, "ADX, 14, 0, 2);


So, I'm completely stumped.


Ed

 
How about using iADX()
 

That's what I'll do, thanks Phy.


Y

 
PLS i wil like to know if it is possible to programme adx that if the trend is above 20 that is when the expert advisor should place order either long or short. And if it is possible how will i do it?