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 Segwin, 05-07-2018, 02:15 PM
            14 responses
            1,789 views
            0 likes
            Last Post aligator  
            Started by Jimmyk, 01-26-2018, 05:19 AM
            6 responses
            837 views
            0 likes
            Last Post emuns
            by emuns
             
            Started by jxs_xrj, 01-12-2020, 09:49 AM
            6 responses
            3,294 views
            1 like
            Last Post jgualdronc  
            Started by Touch-Ups, Today, 10:36 AM
            0 responses
            13 views
            0 likes
            Last Post Touch-Ups  
            Started by geddyisodin, 04-25-2024, 05:20 AM
            11 responses
            63 views
            0 likes
            Last Post halgo_boulder  
            Working...
            X