Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bit of problem with plotting

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Bit of problem with plotting

    Hi,

    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:

    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;
            }
    Code:
            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 );
                }
            }
    I know it is something simple i stuffed up, but just can not see it. Help greatly appreciated.
    Attached Files

    #2
    Hi there, please take a look at the reference sample that deals with multi-colored plots.
    AustinNinjaTrader Customer Service

    Comment


      #3
      Hi,
      Thank you, as expected worked very well, one other thing i was looking for, is there a list of types of exceptions Ninja supports inside the scripts that are specific of Ninja Environment?

      Regards

      Comment


        #4
        sinisa, unfortunately we do not have such a list.
        AustinNinjaTrader Customer Service

        Comment


          #5
          Thank you then, anyway for you quick help with other problem. Might be good to include it into developer documentation for version 7,
          Regards

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          650 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          370 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          109 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          574 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          576 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X