How to get +DI and -DI line value for ADX?

To add comments, please log in or register
Jatin Patel
1231
Jatin Patel  

Hello I found out ADX buy sell condition but i am confuse little. 


BUY– indicator > 20 and +DI line crossed -DI line from bottom-up
SELL– indicator > 20 and +DI line crossed -DI line from above-down

class CSigi_TrendADX : public CTradeSignals1 {
protected:
    int m_Handle;
    double m_Array[1];
    double val;
public:
    bool Init()
    {
       
       m_Handle = iADX(symbol,period,14);
        return (m_Handle != INVALID_HANDLE);
    }
    bool Refresh()
    {
       ArraySetAsSeries(m_Array, true);
        if (CopyBuffer(m_Handle,0,0,1,m_Array) < 0)
            return (false);
        val = m_Array[0];
        if(val > 20 ){
            m_buy = true;
            m_sell = true;
        }else{
          natural = true;
        }
        return (true);
    }
    void DeInit()
    {

        if (m_Handle != INVALID_HANDLE)
            IndicatorRelease(m_Handle);
    }
};


How to get +DI and -DI line value for ADX EA?

Anthony Garot
1830
Anthony Garot  
Jatin Patel:

How to get +DI and -DI line value for ADX EA?

Your code needs to pull from these buffers. iADX has three buffers, but your code is only pulling from one.

So, you need two additional arrays, one to hold +DI and one to hold -DI

Then replicate this same code for both values:

ArraySetAsSeries(m_Array, true);
if (CopyBuffer(m_Handle,0,0,1,m_Array) < 0)
    return (false);
val = m_Array[0];

It may be helpful to see how the iADX indicator is derived. The source code is here:

https://www.mql5.com/en/docs/indicators/iadx

Alain Verleyen
36050
Alain Verleyen  

Please don't flood the forum with similar question for different indicators.

I removed the other topics.

Carl Schreiber
Moderator
7073
Carl Schreiber  
Just press F1 in the editor and search for iBands - there is all you need!
Jatin Patel
1231
Jatin Patel  
Alain Verleyen:

Please don't flood the forum with similar question for different indicators.

I removed the other topics.

Sure i will take care bro , :)
To add comments, please log in or register