ADX Values and DI+/-

 

I have used ADX in the past with no problem. I have just tried to access values for DI+ & DI- and they appear so different than on the chart. I use the Comment statement to display the values on the top part of the screen. The lower half displays the value as shown by the indicator.

ADX Values

I use the following code to retrieve the values:-

   string My_OrderSymbol = Symbol();
   int My_ADX_Period = 14;
   double My_ADX_Limit = 25;
   double My_ADX ;
   double My_ADX_DMI_Minus;
   double My_ADX_DMI_Plus;
   int digits ;
   double My_ADX_Last_value;
   digits            =  MarketInfo(My_OrderSymbol,MODE_DIGITS);
   My_ADX            = iADX(My_OrderSymbol,1,My_ADX_Period,PRICE_OPEN   ,0,0); //My_ADX_Limit = 25;
   My_ADX_Last_value = iADX(My_OrderSymbol,1,My_ADX_Period,PRICE_OPEN   ,0,1); //My_ADX_Limit = 25;
   My_ADX_DMI_Minus  = iADX(My_OrderSymbol,1,My_ADX_Period,MODE_MINUSDI ,0,0); //My_ADX_Limit = 25; 
   My_ADX_DMI_Plus   = iADX(My_OrderSymbol,1,My_ADX_Period,MODE_PLUSDI  ,0,0); //My_ADX_Limit = 25;
   string st_30201 = My_OrderSymbol+"\nMy_ADX("+My_ADX_Period+"/"+DoubleToStr(My_ADX_Limit,0)+") = "+DoubleToStr(My_ADX,digits)+
      "\nMy_ADX_Last_value = "+DoubleToStr(My_ADX_Last_value,digits)+
      "\nMy_ADX_DMI_Minus = "+DoubleToStr(My_ADX_DMI_Minus,digits)+
      "\nMy_ADX_DMI_Plus = "+DoubleToStr(My_ADX_DMI_Plus,digits);
   Comment(st_30201);

I suspect the answer is staring me in the face - but just can't relate to the numbers or what else to use

 
peterhw1:
   My_ADX_DMI_Minus  = iADX(My_OrderSymbol,1,My_ADX_Period,MODE_MINUSDI ,0,0); //My_ADX_Limit = 25; 

I suspect the answer is staring me in the face - but just can't relate to the numbers or what else to use

Yep.When in doubt, RTFM
double iADX(    string symbol, int timeframe, int period, int applied_price, int mode, int shift)
     = iADX(My_OrderSymbol,1,My_ADX_Period,MODE_MINUSDI ,0,0);
               ^symbol     ^TF ^period          ^ not an applied_price MINUSDI=2=PRICE_HIGH
                                                         ^mode=0=MODE_MAIN
 

Got it - many thanks.

Yes I now see the constants were being used.

Thanks again

Reason: