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

Additional Plots not drawing

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

    Additional Plots not drawing

    My indicator adds 3 extra plots... which are actually just a few SMAs of the primary input series. Nothing weird... I AddPlot in State.SetDefaults, assign to the Values array in OnBarUpdate, all by the book. The only maybe odd thing is, my "indicator" has no value itself... I am just using drawing tools to show stuff, mirroring my strategy trades, actually...

    Looks like this:
    first... a snippet from OnStateChange:
    Code:
            
    case State.SetDefaults:
        Name              = "AAInd0905";
        PrintTo           = PrintTo.OutputTab1;
        Calculate         = Calculate.OnBarClose;
        IsOverlay         = true;
    
        AddPlot(Brushes.Goldenrod,"myFast");
        AddPlot(Brushes.SeaGreen,"mySlow");
        AddPlot(Brushes.Blue,"myTrend");
    break;
    ...and this is the final few lines of OnBarUpdate
    Code:
              
        Values[0][0] = smaFast[0];
        Values[1][0] = smaSlow[0];
        Values[2][0] = smaTrend[0];
    On my chart, I see the pricemarkers for the 3 extra plots. In the DataBox I see the values, and I see the plots in the GUI... but the plot lines are not drawn. All three elements are shown in the pic...
    Like this:

    Click image for larger version

Name:	Indicator not showing plots.png
Views:	454
Size:	80.6 KB
ID:	1069859

    Got me stumped why not. Any help appreciated...
    Last edited by tgn55; 09-05-2019, 09:04 AM.

    #2
    Hello tgn55,

    Thank you for your post.

    I can't really tell from your code snippets why this isn't plotting correctly for you. Would you be able to provide the current code for your indicator? You can either attach it to your reply here if you don't mind posting it publicly. If you prefer to keep your code private, please email platformsupport [at] ninjatrader [dot] com. Attach a copy of your indicator. In the Subject line please put ATTN Kate W. 2267177 and put a link to this post in the email body.

    Thanks in advance; I look forward to assisting you further.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Hi Kate,
      it's after 4 AM where I am... I'm going to bed! But I have realised I do one thing that is perhaps not common... I do some stuff in OnRender. I'll check that tomorrow, see if is affecting things.

      Goodnight !

      Comment


        #4
        Hello tgn55,

        Thank you for your reply.

        Bed is very understandable at 4 am! When you take a look at your script when you wake up, one big thing to double check is that you're calling the base OnRender inside your custom OnRender() so that regular plots work as they were designed. So, like this:

        Code:
        protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
        {
          // call the base.OnRender() to ensure standard Plots work as designed
          base.OnRender(chartControl, chartScale);
        
          // custom render logic
        }
        I'll keep an eye out for your reply tomorrow.

        Thanks in advance; I look forward to assisting you further.
        Kate W.NinjaTrader Customer Service

        Comment


          #5
          Ah... that is likely the issue then...as I do NOT do that ;-) Bed will have to wait another 5 minutes !!

          Yep... that fixed it!! Thanks...

          Comment


            #6
            Given it is essential to call the base method in OnRender before any custom logic... I was wondering if that also applies to other overrides... like OnPositionUpdate for example?

            Comment


              #7
              Hello tgn55,

              Thank you for your reply.

              OnRender() is really the only one you'd ever have to do this with. It has to do with how the OnRender() works in general. Basically it needs to be able to have built in plot functions but still give you the option to render your own drawing objects AND allow you to use both without one breaking the other. Hence, the calling of the base method.

              Please let us know if we may be of further assistance to you.
              Kate W.NinjaTrader Customer Service

              Comment


                #8
                Sweet - thanks for the reassurance !

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by kaywai, 09-01-2023, 08:44 PM
                5 responses
                602 views
                0 likes
                Last Post NinjaTrader_Jason  
                Started by xiinteractive, 04-09-2024, 08:08 AM
                6 responses
                22 views
                0 likes
                Last Post xiinteractive  
                Started by Pattontje, Yesterday, 02:10 PM
                2 responses
                19 views
                0 likes
                Last Post Pattontje  
                Started by flybuzz, 04-21-2024, 04:07 PM
                17 responses
                230 views
                0 likes
                Last Post TradingLoss  
                Started by agclub, 04-21-2024, 08:57 PM
                3 responses
                17 views
                0 likes
                Last Post TradingLoss  
                Working...
                X