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:	216
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 Hwop38, 05-04-2026, 07:02 PM
    0 responses
    152 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Started by CaptainJack, 04-24-2026, 11:07 PM
    0 responses
    304 views
    0 likes
    Last Post CaptainJack  
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    244 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    345 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    175 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Working...
    X