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 judysamnt7, 03-13-2023, 09:11 AM
          4 responses
          57 views
          0 likes
          Last Post DynamicTest  
          Started by ScottWalsh, Today, 06:52 PM
          4 responses
          35 views
          0 likes
          Last Post ScottWalsh  
          Started by olisav57, Today, 07:39 PM
          0 responses
          7 views
          0 likes
          Last Post olisav57  
          Started by trilliantrader, Today, 03:01 PM
          2 responses
          19 views
          0 likes
          Last Post helpwanted  
          Started by cre8able, Today, 07:24 PM
          0 responses
          9 views
          0 likes
          Last Post cre8able  
          Working...
          X