Welles Wilder's Directional Movement Indicator calculation


Welles Wilder's Directional Movement System uses three indicators to determine whether the market is trending, and in which direction, and sends trading signals accordingly. A buy signal occurs when +DI line crosses above -DI line. A sell signal occurs when -DI line crosses below +DI line.


public interface DirectionalMovementSystem


ADX PropertyThe Average Directional Movement Index (ADX) indicates whether the market is trending or ranging.
DIMinus PropertyThe Negative Direction Indicator (-DI) indicates downward trend movement;
DIPlus PropertyThe Positive Direction Indicator (+DI) indicates upward trend movement;

Example 1

[Indicator(IsOverlay = true)]
public class SampleADX : Indicator
    private DirectionalMovementSystem _dms;
    private double _dIplus;
    private double _dIminus;
    [Parameter("ADX Period", DefaultValue = 14)]
    public int Period { get; set; }
    [Output("Buy", PlotType = PlotType.Points, Color = Colors.Green, Thickness = 4)]
    public IndicatorDataSeries Buy { get; set; }
    [Output("Sell", PlotType = PlotType.Points, Color = Colors.Red, Thickness = 4)]
    public IndicatorDataSeries Sell { get; set; }
    protected override void Initialize()
        _dms = Indicators.DirectionalMovementSystem(Period);
    public override void Calculate(int index)
        _dIplus = _dms.DIPlus[index];
        _dIminus = _dms.DIMinus[index];
        if (_dIminus > _dIplus)
            Sell[index] = MarketSeries.Close[index] + Symbol.PointSize*100;
            Buy[index] = MarketSeries.Close[index] - Symbol.PointSize*100;