Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Plot not showing in Strategy

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

    Plot not showing in Strategy

    Hi all,

    just wondering:

    I've added a plot to a strategy and don't see why this plot isn't showing up in the chart.

    Even it got values in OnBarUpdate() via:
    AverageEntry[0] = 30000;


    and i have in
    (State == State.SetDefaults):
    AddPlot(Brushes.Aqua, "AverageEntry");


    and at the bottom of the strategy I have

    [Browsable(false)]
    [XmlIgnore]
    public Series<double> AverageEntry
    {
    get { return Values[0]; }
    }


    In the databox I can seen, that the plot is set


    Click image for larger version

Name:	2021-07-29 19_22_45-Data Box.png
Views:	192
Size:	1.2 KB
ID:	1165718

    What am I doing wrong?

    Thanks in advance.

    Airwave
    NinjaTrader Ecosystem Vendor - Airwave

    #2
    Hello Airwave,

    Thank you for the post.

    Just to confirm, did you remove and re apply the strategy after adding the plot?

    The other item which could make a plot not show up would be if you used OnRender, do you use OnRender in the strategy?

    I look forward to being of further assistance.

    Comment


      #3
      Originally posted by NinjaTrader_Jesse View Post
      Just to confirm, did you remove and re apply the strategy after adding the plot?
      Yes I did.

      Originally posted by NinjaTrader_Jesse View Post
      The other item which could make a plot not show up would be if you used OnRender, do you use OnRender in the strategy?
      Yes exactly. I'm using this for screenshots like in your
      TakeScreenshotAfterOrderAccepted.zip
      example.

      Tested to comment out OnRender Event. Yes, then the plot is showing up.
      How can I get it shown with the OnRender event?

      Thanks in advance.
      Airwave
      NinjaTrader Ecosystem Vendor - Airwave

      Comment


        #4
        Hello Airwave,

        Thanks for confirming that.

        If you used OnRender you very likely just need to add a call to the base class:

        Code:
        protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
        {
        // call the base.OnRender() to ensure standard Plots work as designed
        [B]base.OnRender(chartControl, chartScale);[/B]
        
        // custom render logic
        }
        Can you confirm you have that as the first line in your OnRender?

        That line can be commented out for scripts which should hide plots but still render.

        I look forward to being of further assistance.

        Comment


          #5
          Originally posted by NinjaTrader_Jesse View Post
          Can you confirm you have that as the first line in your OnRender?
          Great, that did the trick.

          Now I can see the plot.

          ---

          On additional question.

          When a plot is 0, can I don't show the plot when it is 0?
          So that I don't have this "jumps" in the chart?

          Click image for larger version

Name:	2021-07-29 19_58_57-Chart - BBA_BTCUSD.png
Views:	193
Size:	41.3 KB
ID:	1165730
          Airwave
          NinjaTrader Ecosystem Vendor - Airwave

          Comment


            #6
            Hello Airwave,

            Thank you for the reply.

            If the value you are setting to the plot is 0 and you don't need the 0 values for any purpose (strategy reading for signals) then you could use a condition before setting the plot:
            Code:
            if(myValue > 0)
            Values[0][0] = myValue;
            An alternative would be setting that plot to transparent


            I look forward to being of further assistance.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, Today, 05:17 AM
            0 responses
            44 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            124 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            65 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            42 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            46 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X