Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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:	93
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 burtoninlondon, Today, 12:38 AM
    0 responses
    10 views
    0 likes
    Last Post burtoninlondon  
    Started by AaronKoRn, Yesterday, 09:49 PM
    0 responses
    14 views
    0 likes
    Last Post AaronKoRn  
    Started by carnitron, Yesterday, 08:42 PM
    0 responses
    11 views
    0 likes
    Last Post carnitron  
    Started by strategist007, Yesterday, 07:51 PM
    0 responses
    14 views
    0 likes
    Last Post strategist007  
    Started by StockTrader88, 03-06-2021, 08:58 AM
    44 responses
    3,983 views
    3 likes
    Last Post jhudas88  
    Working...
    X