How to code for the "RSI tracking ADX value" ?

 

Dear MT4 experts,

I am a newbie on the MT4 programming, trying to study this topic recently.


About the implementation for RSI(6) tracking ADX(14) value,

I try to drag the Average Directional Movement Index indicator, and then Relative Strength Index indicator in the symbol chart.

And select applying to Previous Indicator's Data in RSI in the UI. Just shown on the attached pictures.


While in the code implementation, i just code it


    double adx_array[14];
    ArraySetAsSeries(adx_array,true);
    for (int i= 0; i< 14; i++)
    {
      adx_array= iADX(NULL, PERIOD_M1, 14, PRICE_CLOSE, MODE_MAIN, i);
    }
    double rsi= iRSIOnArray(adx_array, 14, 6, 0);
But get the incorrect rsi values.

Is there something wrong i encountered?

Many thanks.

Files:
rsi_value.png  35 kb
 

http://docs.mql4.com/indicators/iadx

check this, it does not return an array, it returns a double value. so you cannot adx_array=iADX()... 

iADX - MQL4 Documentation
  • docs.mql4.com
iADX - MQL4 Documentation
Reason: