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

Override Plot and Bar Values

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

    Override Plot and Bar Values

    Hi,

    As far as I can see, by the time

    public override void Plot(Graphics graphics, Rectangle bounds, double min, double max)

    is called for the first time, OnBarUpdate() has been called for all historical data and CurrentBar is equal to the number of bars. For any given call to Plot(..., how do i determine which bar is being painted and get the corresponding values for indicators, etc.? For instance, High[0] and Time[0] in the method always return the values for the last bar in the price series.

    I'd also appreciate any tips on lining up what I want to paint in the method below the correct bar, making it the correct width, etc. I've looked at some examples of overriding plot, but I'm not clear in these areas.

    Thanks,

    Gordon
    Last edited by grose; 06-28-2014, 01:41 PM.

    #2
    Hello Gordon,

    Thank you for your note.

    There is no way to tell when the Plot() method will get called. However, it is safe to say that if something cause the chart to draw, move, price change, so forth that the Plot() will get called.

    You will also need to be running the indicator with CalculateOnBarClose to get the most current bars values.
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      HI Cal,

      That's really helpful. The indicator I'm working on tracks intra-bar activity, so I can't use calculate on bar close. Very interesting to know that it's non-deterministic.

      If you aren't using calculate on bar close, do you now of any way to identify the bar at which something is being painted? It sounds like you don't have access to that, but want to be sure. Thanks again.

      Regards,

      Gordon

      Comment


        #4
        Gordon,

        This is unsupported but you could try ChartControl.LastBarPainted
        Cal H.NinjaTrader Customer Service

        Comment


          #5
          You could have a look at the custom plots of the NinjaTrader Heikin Ashi and Pivots indicators. Once you understand how they work you should be able to do what you want to do.

          Comment


            #6
            You can check here to this thread. Make sure you view the thread in Hybrid display mode..

            http://www.ninjatrader.com/support/f...d.php?p=136372

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by algospoke, 04-17-2024, 06:40 PM
            6 responses
            49 views
            0 likes
            Last Post algospoke  
            Started by arvidvanstaey, Today, 02:19 PM
            4 responses
            11 views
            0 likes
            Last Post arvidvanstaey  
            Started by samish18, 04-17-2024, 08:57 AM
            16 responses
            61 views
            0 likes
            Last Post samish18  
            Started by jordanq2, Today, 03:10 PM
            2 responses
            11 views
            0 likes
            Last Post jordanq2  
            Started by traderqz, Today, 12:06 AM
            10 responses
            21 views
            0 likes
            Last Post traderqz  
            Working...
            X