Problem calculating ADX

Discussion in 'Automated Trading' started by frostengine, Dec 14, 2005.

  1. Does anyone know the algorithm usually used to calculate ADX? I tried googling it, but I see tons of different algorithms used.... Does anyone have a relatively simple and straight forward method that is similar to what most charting aplications use?
     
  2. mark1

    mark1 Guest

    ok I see nobody answered.
    I can give you here the calculation you find in Wealth lab for ADX, it's a lot of stuff.
    Hope it can help

    Description

    ADX stands for Average Directional movement Index and is used to measure the overall strength of the trend. The ADX indicator is an average of DX values, see DX. The ADX is a component of the Directional Movement System developed by Welles Wilder. This system attempts to measure the strength of price movement in positive and negative direction using the DIPlus and DIMinus indicators along with the ADX.


    ADX
    Calculation

    ADX is equivalent to the Wilder's moving average (see WilderMA) of the direction movement (DX) over the specified Period.
    -------------------------------------------------------
    DX
    Calculation

    DX = Round( 100 * |DIPlus - DIMinus| / |DIPlus + DIMinus| )
    ------------------------------------------------------
    DI Minus
    Calculation

    -DI = Round( -DM / TR )* 100

    where,

    -DI = DIMinus
    TR = True Range of current bar

    The -DI is then smoothed over the Period specified, the same way as a simple moving average, and, -DM is calculated as follows:

    (i) For up trending days, -DM = zero
    (ii) For down trending days, -DM = yesterday's low - today's low
    (iii) For inside days, -DM = zero
    (iv) For outside days, if yesterday's low - today's low, is greater than today's high- yesterday's high, then -MD = yesterday's low - today's low, otherwise -DM = zero
    (v) For upwards gap days, -DM = zero
    (vi) For downwards gap days, -DM = yesterday's low - today's low
    -----------------------------------------------
    Di Plus
    Calculation

    +DI = Round( +DM / TR ) * 100

    where,

    DI+ = DIPlus
    TR = True Range of current bar

    The +DI is then smoothed over the period specified, the same way as a simple moving average, and +DM is calculated as follows:

    (i) For up trending days, +DM = today's high - yesterday's high
    (ii) For down trending days, +DM = zero
    (iii) For inside days, +DM = zero
    (iv) For outside days, if today's high - yesterday's high, is greater than yesterday's low- today's low, then +MD = today's high - yesterday's high, otherwise +DM = zero
    (v) For upwards gap days, +DM = today's high - yesterday's high
    (vi) For downwards gap days, +DM = zero
    -------------------------------------------------
    WilderMA


    Calculation

    WilderMA is calculated for periods "n" as follows:

    Wilder MA = ( Previous Wilder MA * ( n - 1 ) + Price Series Value ) / n

    where,

    n = number of periods
    Price Series Value = data you wish to average
    --------------------------------------------------
    True Range

    Calculation

    True Range is always a positive number and is defined by Welles Wilder to be the greatest of the following for each period:

    The distance from today's high to today's low.
    The distance from yesterday's close to today's high.
    The distance from yesterday's close to today's low.



    Geez, good luck :D
     
  3. Are you using this for excel? If you are doing this in VBA, I'd be willing to help...

    - The New Guy
     
  4. Don't reinvent hot water.
     
  5. Second try.
     
    • test.zip
      File size:
      537.7 KB
      Views:
      123