Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Drawing custom line on chart bars when calculating VPOC on candles

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

    Drawing custom line on chart bars when calculating VPOC on candles

    Hi

    I am developing an indicator that calculates the maximun volumen of the candle (VPOC) I do the calculation and I am able to draw a circle when the candle finishes forming in its timeframe. I do it in the Onbarupdate() event. I don't draw one VPOC per candle but I do some extra calculation and I draw only some of them. But I want to be able to draw a custom line using the onrender() event.

    I have looked at some examples in this forum and in external webs but I am not able to get the logic about how to get the exact point in the bar to draw the custom line.

    When in the ONBARUPDATE() I know I have to draw the VPOC of the candle , how am I able to "connect" with the onrender() event to draw in the current bar of the chart ? And do that only when I needed based of my calculations ?

    Thanks for the help

    Helios

    #2
    Hello Helios, thank you for your post and welcome to the NinjaTrader forum.

    You can update a property in OnBarUpdate and then render the value in OnRender. If you have a price value you would like to display in OnRender then use GetYByValue() to convert the price value to a y value for the render target. Then the ChartControl object has the two methods, GetXByTime and GetXByBarIndex:

    https://ninjatrader.com/support/help...getxbytime.htm
    https://ninjatrader.com/support/help...bybarindex.htm

    Those can be used to get the x component. Note: to get the price of a specific bar you should use GetValueAt()

    I attached an example I have recently made that demonstrates how to use these.

    Kind regards.
    Attached Files

    Comment


      #3
      Thank you for the answer, Chris

      I will going to try it and if I have more doubts, I will post the code here so you can see what i'm coding

      Thx

      Comment


        #4
        At the end, I have decided no to "overcomplicate" things. So I have used a Plot /Value with plotslyte.Dot and that works. Although there is a price label printed that I don't need, it is Ok. I will develope the Onrender code later for hiding that label.

        Thanks

        Comment


          #5
          Hello, thanks for the follow up.

          PaintPriceMarker set to false will disable the price markers for the entire indicator. If you need some price markers but not others, the other plots would need to be developed as a separate indicators.

          Kind regards.

          Comment


            #6
            Thnks for the parameter. It is what I needed.

            Comment


              #7
              Hi, again

              Using the Plots I have realized that when using a Plotstyle of type HASH, it is automatically autoscalable. Buy if I use for example the DOT or BLOCK, they don't scale when changing the Y-axis of the chart. They conserve the same size. Which is the best way to draw scalable figures or even scalable text ? I assume it is not possible using the Plots or other usual methods so maybe it is some advanced technique.

              Thanks for the help

              Helios

              Comment


                #8
                Hello hbolorin, thanks for your reply.

                If you need to render text or figures you would need to use SharpDX in OnRender(), or use one of the Draw methods:
                https://ninjatrader.com/support/help...8/?drawing.htm

                Plots are usually expected to have a value for each bar of the chart.

                Please let me know if I can assist any further.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                639 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                366 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                107 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                569 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                572 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X