Probably you have answered this question few times, so sorry if i am wasting your time. I am a bit new to the Ninja and would like some help. I am trying just to create modified version of the RSS indicator which plots in different color depending if the value is greater, lower or equal to the previous bar. But when the RSS is turning i get blank plots, not quite sure what is happening? You can have a look at the attached image. The code is in Ninja 6.5. Here is the copy of the code:
/// <summary> /// This method is used to configure the indicator and is called once before any bar data is loaded. /// </summary> protected override void Initialize() { Add(new Plot(Color.FromKnownColor(KnownColor.SeaGreen), PlotStyle.Line, "RssPlotPositive")); Add(new Plot(Color.FromKnownColor(KnownColor.DarkRed), PlotStyle.Line, "RssPlotNegative")); Add(new Plot(Color.Yellow, PlotStyle.Line, "RssPlotNeutral")); CalculateOnBarClose = true; Overlay = false; PriceTypeSupported = true; }
protected override void OnBarUpdate() { // Use this method for calculating your indicator values. Assign a value to each // plot below by replacing 'Close[0]' with your own formula. // RssPlotPositive.Set(Close[0]); // RssPlotNegative.Set(Close[0]); // RssPlotNeutral.Set(Close[0]); double rssValue = 0; double rssOldValue = 0; try { rssValue = RSS(Median, rssEmaShortLength, rssEmaLongLength, rssLength)[0]; rssOldValue = RSS(Median, rssEmaShortLength, rssEmaLongLength, rssLength)[1]; if ( rssValue > rssOldValue ) { RssPlotPositive.Set( rssValue ); } else if ( rssValue < rssOldValue ) { RssPlotNegative.Set ( rssValue ); } else if ( rssValue == rssOldValue ) { RssPlotNeutral.Set ( rssValue ); } else { RssPlotNeutral.Set ( rssValue ); } } catch ( Exception ex ) { string errorMessage = " sdiRSSS on Update error -> " + ex.ToString(); Log ( errorMessage, LogLevel.Error ); RssPlotNeutral.Set ( rssValue ); } }
Comment