Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to position a text box near an arrow?

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

    How to position a text box near an arrow?

    I am using Draw.ArrowUp() and Draw.ArrowDown() in OnBarUpdate(). I would like to position a text box slightly below an up arrow and slightly above a down arrow. How do I find the correct y-value to pass to Draw.Text()? I need an answer that will produce the right effect even when the user scrolls the chart.

    I'm well aware that the answer may be "Don't do that". I'm just hoping there is a better answer than to use OnRender() and draw my own custom arrows.

    #2
    A related question: if I use Draw.ArrowUp() how can I tell how high the drawn arrow is?

    Comment


      #3
      Problem solved. Sample found by Visual Studio searching the solution. It takes a lot more code in OnRender() but the result works very well. I'm still curious whether there is a good solution using OnBarUpdate() but I doubt that there is.

      Comment


        #4
        Hello ETFVoyageur,

        With Draw.Text() the y coordinate is actually a price value and not the actual x,y of the render area.


        The text will be drawn just below the price supplied as the y.

        This will be the same with the Draw.ArrowUp().

        The size of the arrow will not scale as the chart scales. So the distance from the bottom of an arrow would not be consistent and will change.

        You could choose to get the price of the arrow chart anchor, and then subtract or 2 ticks from this and use this as the price of the text. But it's not going to be exact since the chart scaling will change over time.


        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        581 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        338 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        103 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        554 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        552 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X