I have set
I must be doing something dumb... Lots of coding in NT6/7 but I'm new to NT8.
public class MyStochRSI : Indicator { private Series<double> HighLine; private Series<double> LowLine; protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"StochRSI with StockCharts.com-style coloring"; Name = "MyStochRSI"; Calculate = Calculate.OnEachTick; IsOverlay = false; DisplayInDataBox = true; DrawOnPricePanel = false; DrawHorizontalGridLines = true; DrawVerticalGridLines = true; PaintPriceMarkers = false; ScaleJustification = 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; Period = 9; AddPlot(Brushes.Green, "RSILine"); } else if (State == State.Configure) { HighLine = new Series<double>(this); LowLine = new Series<double>(this); } } /// <summary> /// Called on each bar update event (incoming tick) /// </summary> protected override void OnBarUpdate() { HighLine[0] = 80.0; LowLine[0] = 20.0; RSILine[0] = 100.0 * StochRSI(Period)[0]; if (RSILine[0] >= HighLine[0]) { Draw.Region(this, "StochRSI_High"+CurrentBar, 1, 0, RSILine, HighLine, Brushes.Black, Brushes.Green, 50); } else if (RSILine[0] <= LowLine[0]) { Draw.Region(this, "StochRSI_Low"+CurrentBar, 1, 0, LowLine, RSILine, Brushes.Black, Brushes.Green, 50); } } #region Properties [Range(1, int.MaxValue)] [NinjaScriptProperty] [Display(Name="Period", Order=1, GroupName="Parameters")] public int Period { get; set; } [Browsable(false)] [XmlIgnore] public Series<double> RSILine { get { return Values[0]; } } #endregion } }
Comment