Directional Movement Index (DX)
For a list of all members of this type, see DX Members.
System.Object
RQuant.Indicator.TTimeArray
RQuant.Indicator.TDoubleArray
RQuant.Indicator.TIndicator
RQuant.Indicator.DX
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.
The concept of Directional Movement is based on the assumption that in an upward trend today?s highest price is higher than yesterday?s highest price and in a downward trend today?s lowest price is lower than yesterday?s lowest price. If this is the case, it is a matter of the so-called Outside Days.
The Directional Movement Index (DX) is calculated by dividing the difference between the PDI and MDI by the sum of both figures. The result is a percentage, with which the extent and/or intensity or the trend is quantified.
Note, that there are two styles of indicator ADX. Some trading systems use a bit diffrent formula to calculate 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 is the same as for QuantSudio style, but calculation of DX uses PDI and MDI indicators, which formulas each has two styles.
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);
Namespace: RQuant.Indicator
Assembly: RQuant.Indicator (in RQuant.Indicator.dll)
DX Members | RQuant.Indicator Namespace