{ private double fastValue; private double slowValue; private double diff; private double ang; protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"Enter the description for your new custom Indicator here."; Name = "Angulation"; Calculate = Calculate.OnBarClose; IsOverlay = true; DisplayInDataBox = true; DrawOnPricePanel = true; DrawHorizontalGridLines = true; DrawVerticalGridLines = true; PaintPriceMarkers = true; ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right; //Disable this property if your indicator requires custom values that cumulate with each new market data event. //See Help Guide for additional information. IsSuspendedWhileInactive = true; FastEMA = 8; SlowEMA = 34; AddPlot(Brushes.Orange, "SEMA"); AddPlot(Brushes.DodgerBlue, "FEMA"); } else if (State == State.Configure) { } } protected override void OnBarUpdate() { fastValue = EMA(Close,FastEMA)[0]; slowValue = EMA(Close,SlowEMA)[0]; diff = Math.Abs(fastValue - slowValue); ang = Math.Round(diff); Print(diff); Draw.TextFixed(this, "tag1", "Current Angulation " + ang.ToString(), TextPosition.BottomRight);
#region Properties [NinjaScriptProperty] [Range(1, int.MaxValue)] [Display(Name="FastEMA", Order=1, GroupName="Parameters")] public int FastEMA { get; set; } [NinjaScriptProperty] [Range(1, int.MaxValue)] [Display(Name="SlowEMA", Order=2, GroupName="Parameters")] public int SlowEMA { get; set; } [Browsable(false)] [XmlIgnore] public Series<double> SEMA { get { return Values[0]; } } [Browsable(false)] [XmlIgnore] public Series<double> FEMA { get { return Values[1]; } } #endregion
Comment