Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 helpwanted, Today, 03:06 AM
          0 responses
          3 views
          0 likes
          Last Post helpwanted  
          Started by Brevo, Today, 01:45 AM
          0 responses
          7 views
          0 likes
          Last Post Brevo
          by Brevo
           
          Started by aussugardefender, Today, 01:07 AM
          0 responses
          5 views
          0 likes
          Last Post aussugardefender  
          Started by pvincent, 06-23-2022, 12:53 PM
          14 responses
          242 views
          0 likes
          Last Post Nyman
          by Nyman
           
          Started by TraderG23, 12-08-2023, 07:56 AM
          9 responses
          384 views
          1 like
          Last Post Gavini
          by Gavini
           
          Working...
          X