ADX Alert - Show a signs when ADX reaches a certain level

public class ADXAlert : Indicator
    {
        #region Variables
           private int myInput0 = 5;
           private int upperLevel = 65;
           private int lowerLevel = 12;
        #endregion

       protected override void Initialize()
        {
            Add(new Plot(Color.FromKnownColor(KnownColor.Snow), PlotStyle.Line, "Plot0"));
   Add(new Line(Color.HotPink, lowerLevel, "Lower"));
   Add(new Line(Color.YellowGreen, upperLevel, "Upper"));
            Overlay    = false;
   DrawOnPricePanel = false;
        }

        protected override void OnBarUpdate()
        {
   if (CurrentBar < 1)
         return;
 
   else
   {
 
   Plot0.Set(ADX(myInput0)[0]);
 
   if(Plot0[0] >= upperLevel)
   {
    DrawDot("My diamond" + CurrentBar, false, 0, upperLevel, Color.Aqua);
   }
 
 
   }
 
  }

        #region Properties
        [Browsable(false)]
        [XmlIgnore()]
        public DataSeries Plot0
        {
            get { return Values[0]; }
        }

        [Description("")]
        [GridCategory("Parameters")]
        public int MyInput0
        {
            get { return myInput0; }
            set { myInput0 = Math.Max(1, value); }
        }

  [Description("")]
        [GridCategory("Parameters")]
        public int UpperLevel
        {
            get { return upperLevel; }
            set { upperLevel = Math.Max(1, value); }
        }

  [Description("")]
        [GridCategory("Parameters")]
        public int LowerLevel
        {
            get { return lowerLevel; }
            set { lowerLevel = Math.Max(1, value); }
        }
        #endregion
    }

Comments

Popular posts from this blog

ATR in Tick - shows ATR in the number of ticks

Constant Lines Areas - makes vertical constant lines and color each area created by the lines

Chart Sizing - adjusts the vertical scale of the chart by the number of ticks