QuantStudio Financial Data Analysis and Trading Framework

ADX Class

Average Directional Index (ADX)

For a list of all members of this type, see ADX Members.

System.Object
   RQuant.Indicator.TTimeArray
      RQuant.Indicator.TDoubleArray
         RQuant.Indicator.TIndicator
            RQuant.Indicator.ADX

[Visual Basic]
Public Class ADX
    Inherits TIndicator
[C#]
public class ADX : TIndicator

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

The Average Directional Index was specifically designed for use with the Directional Movement System. The ADX measures the strength of a prevailing trend as well as whether movement exists in the market. A low ADX value (generally less than 20) can indicate a non-trending market with low volatility whereas a cross above 20 may signal the start of a trend (either up or down). If the ADX is over 40 and begins to fall, it can signal a slowdown of a current trend. This indicator can also be used to identify non-trending markets, or a deterioration of an ongoing trend. Although market direction is important in its calculation, the ADX is not a directional indicator.

Note, that there are two styles of indicator ADX. Some trading systems use the formula (which is a little bit distinguished from classical) for calculation of this indicator. Therefore Quant Studio gives an opportunity to use two styles ADX - classical (QuantStudio style) and little bit changed (MetaStock style.)

ADX has QuantStudio style by Default.

Formula for Quant Studio (classical) style:

TDataManager.cd("demo");

TInstrument Instrument = TDataManager.GetInstrument("YHOO");

DateTime Date1 = DateTime.Parse("2000/01/04"); 
DateTime Date2 = DateTime.Parse("2000/12/29"); 

TDailyArray Array = Instrument.DailyArray.Clone(Date1, Date2);

TCanvas Canvas = new TCanvas("Canvas", 600, 800);

Canvas.Divide(1, 4);

Canvas.cd(1);

Array.Draw("C");
Array.SMA(14).Draw("S", Color.Red);

Canvas.Pad.LegendEnabled = true;
Canvas.Pad.SetRangeX(Date1, Date2);

Canvas.cd(2);

Array.DX (14).Draw(Color.Violet);
Array.PDI(14).Draw(Color.Red);
Array.MDI(14).Draw(Color.Blue);

Canvas.Pad.Title.Text = "+/- DI, DX";
Canvas.Pad.LegendEnabled = true;
Canvas.Pad.SetRange(Date1, Date2, 0, 100);

Canvas.cd(3);

Array.ADX (14).Draw(Color.Red);
Array.ADXR(14).Draw(Color.Blue);

Canvas.Pad.Title.Text = "ADX, ADXR";
Canvas.Pad.LegendEnabled = true;
Canvas.Pad.SetRangeX(Date1, Date2);

Canvas.cd(4);

Array.PDM().Draw(Color.Purple);
Array.MDM().Draw(Color.Green);

Canvas.Pad.Title.Text = "+/- DM";
Canvas.Pad.LegendEnabled = true;
Canvas.Pad.SetRangeX(Date1, Date2);



Formula for MetaStock style:
TDataManager.cd("demo");

TInstrument Instrument = TDataManager.GetInstrument("YHOO");

DateTime Date1 = DateTime.Parse("2000/01/04"); 
DateTime Date2 = DateTime.Parse("2000/12/29"); 

TDailyArray Array = Instrument.DailyArray.Clone(Date1, Date2);

EIndicatorStyle Style = EIndicatorStyle.MetaStock;

TCanvas Canvas = new TCanvas("Canvas", 600, 800);

Canvas.Divide(1, 4);

Canvas.cd(1);

Array.Draw("C");
Array.SMA(14).Draw("S", Color.Red);

Canvas.Pad.LegendEnabled = true;
Canvas.Pad.SetRangeX(Date1, Date2);

Canvas.cd(2);

Array.DX (14, Style).Draw(Color.Violet);
Array.PDI(14, Style).Draw(Color.Red);
Array.MDI(14, Style).Draw(Color.Blue);

Canvas.Pad.Title.Text = "+/- DI, DX";
Canvas.Pad.LegendEnabled = true;
Canvas.Pad.SetRange(Date1, Date2, 0, 100);

Canvas.cd(3);

Array.ADX (14, Style).Draw(Color.Red);
Array.ADXR(14, Style).Draw(Color.Blue);

Canvas.Pad.Title.Text = "ADX, ADXR";
Canvas.Pad.LegendEnabled = true;
Canvas.Pad.SetRangeX(Date1, Date2);

Canvas.cd(4);

Array.PDM().Draw(Color.Purple);
Array.MDM().Draw(Color.Green);

Canvas.Pad.Title.Text = "+/- DM";
Canvas.Pad.LegendEnabled = true;
Canvas.Pad.SetRangeX(Date1, Date2);

Requirements

Namespace: RQuant.Indicator

Assembly: RQuant.Indicator (in RQuant.Indicator.dll)

See Also

ADX Members | RQuant.Indicator Namespace