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:	226
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 SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    38 views
    0 likes
    Last Post SalmaTrader  
    Started by CarlTrading, 07-05-2026, 01:16 PM
    0 responses
    20 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 06-17-2026, 10:32 AM
    0 responses
    14 views
    0 likes
    Last Post CaptainJack  
    Started by kinfxhk, 06-17-2026, 04:15 AM
    0 responses
    20 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 06-17-2026, 04:06 AM
    0 responses
    22 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X