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

Limit Plot Length

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

    Limit Plot Length

    Indicator plotting a line, this like extends to the right and until the indicator creates a new plot to replace the last plot the plot continues to draw to the right with candlesticks

    How can you limit the Plot Length to ONLY a few bars

    AddPlot(new Stroke(Brushes.Lime, 1), PlotStyle.Dot, "breakupvalue_plot");



    Thanks

    #2
    Hello DTSSTS,

    If you are using a Dot style plot the most simple way to stop plotting is to just not set a value on those bars. If you set no value there will be no plot for that bar.

    You can also use the Reset method if you are doing something more complex, that would be a case where you may need to regenerate a plot and clear old values on some bars. https://ninjatrader.com/support/help...lightsub=reset

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      i do not see where the value is set on "those bars"

      a condition is meet and the dots are plotted and they continue for ever until another instance of that condition creates a new updated level for the plot

      I just wish to trunicate the line/plot length

      I DID NOT follow anything about the reply,

      ​​​​​​this is the area of my script that refers to OnBarUpdate

      i see the reset in the help guide but not sure where to place it and do not wish to alter any calculations

      protected override void OnBarUpdate()
      {
      if(CurrentBar > BarsRequiredToPlot) /// Only Calculate and paint bars on the screen + 30 bars
      {
      if (CurrentBar < 30)
      {
      upperBoundarySeries[0] = 0;
      lowerBoundarySeries[0] = 0;
      boxBarNumSeries[0] = 0;
      return;
      }

      Comment


        #4
        Hello DTSSTS,
        i do not see where the value is set on "those bars"

        a condition is meet and the dots are plotted and they continue for ever until another instance of that condition creates a new updated level for the plot

        I just wish to trunicate the line/plot length
        With the added syntax that does not help to see the problem. This appears to only be a portion of the script which happens during the first 30 bars, setting the plot is likely happening in other places past that point as well if you are seeing a continuous plot past 30 bars.

        I DID NOT follow anything about the reply,
        I am sorry you are having difficulty understanding, if there is a specific part which you want to go over again we can try to clarify that.


        i see the reset in the help guide but not sure where to place it and do not wish to alter any calculations
        You likely won't need this, I had provided a link to that in case you were doing something more complex with your plot. There are not many details here about what you are doing with the plot so how you stop the plot will depend on your logic. The plot can be very simple to stop plotting, you just don't set a value where you don't want the plot. If you see a plot on a bar that means you set a value on that bar in your logic.

        I look forward to being of further assistance.


        JesseNinjaTrader Customer Service

        Comment


          #5
          thanks for the help

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Tin34, Today, 03:30 AM
          2 responses
          15 views
          0 likes
          Last Post Tin34
          by Tin34
           
          Started by sastrades, Yesterday, 09:59 AM
          2 responses
          29 views
          0 likes
          Last Post brucerobinson  
          Started by ETFVoyageur, Today, 12:52 AM
          1 response
          15 views
          0 likes
          Last Post Leeroy_Jenkins  
          Started by lollers, Today, 03:26 AM
          0 responses
          10 views
          0 likes
          Last Post lollers
          by lollers
           
          Started by aliyahany, Today, 03:16 AM
          0 responses
          2 views
          0 likes
          Last Post aliyahany  
          Working...
          X