Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

An issue with the positioning of text using Draw.Text in my indicator

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

    An issue with the positioning of text using Draw.Text in my indicator

    Hi NinjaTrader community,

    I'm facing an issue with the positioning of text using Draw.Text in my indicator. I'm trying to position the text to the right of a HorizontalLine, but it's not working as expected. I think it's considering the current bar position, but I want it to consider the entire chart

    Code:
    Draw.Text(this, priceLevel.ToString("F2"), true, priceLevel.ToString("F2"), 0, priceLevel, 8,
    null, new SimpleFont(fontName, fontSize), System.Windows.TextAlignment.Right, null, null, 0);

    Any help or suggestions would be greatly appreciated. Thank you!


    Click image for larger version

Name:	image.png
Views:	203
Size:	23.5 KB
ID:	1278427

    #2
    Hello ramanji,

    Draw.Text() draws over a specific bar. The TextAlignment is how the text is aligned within the textbox, which is positioned over the bar.

    If you want to render text on the right of the chart at a specific price level, this will need to be custom rendered in OnRender().

    This User App Share script provides sample code.
    This indicator will read the horizontal lines that you have applied to a chart and display the price at which that line sits.
    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
    566 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    330 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    547 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    548 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X