Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw.Text relative to window?

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

    Draw.Text relative to window?

    Is it possible to positioned text relative to the window frame?

    I know there's text.fixed but this is not quite what I want.

    I was the Y position to be relative to the window, not the candle.

    #2
    Hi Several,

    Please refer to the code below:

    At the using region, place this code:

    Code:
    using NinjaTrader.Gui.Tools;
    using NinjaTrader.NinjaScript.DrawingTools;
    using System.Windows.Media;
    At the OnbarUpdate() function, place this code:

    Code:
    if (CurrentBar == 0) {
        string msg = "Your text here";
       SimpleFont font = new SimpleFont("Arial", 36);
    
       Draw.TextFixed(this, "tag0", msg, TextPosition.BottomLeft, Brushes.LimeGreen, font, Brushes.Transparent, Brushes.Transparent, 100);
    
       Draw.TextFixed(this, "tag1", msg, TextPosition.BottomRight, Brushes.LimeGreen, font, Brushes.Transparent, Brushes.Transparent, 100);
    
       Draw.TextFixed(this, "tag3", msg, TextPosition.TopLeft, Brushes.LimeGreen, font, Brushes.Transparent, Brushes.Transparent, 100);
    
       Draw.TextFixed(this, "tag4", msg, TextPosition.TopRight, Brushes.LimeGreen, font, Brushes.Transparent, Brushes.Transparent, 100);
    
       Draw.TextFixed(this, "tag5", msg, TextPosition.Center, Brushes.LimeGreen, font, Brushes.Transparent, Brushes.Transparent, 100);
    }
    Regards,
    Danny
    Last edited by ninZa; 09-19-2024, 10:45 PM.
    ninZa
    NinjaTrader Ecosystem Vendor - ninZa.co

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CaptainJack, 05-29-2026, 05:09 AM
    0 responses
    237 views
    0 likes
    Last Post CaptainJack  
    Started by CaptainJack, 05-29-2026, 12:02 AM
    0 responses
    152 views
    0 likes
    Last Post CaptainJack  
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    163 views
    1 like
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    243 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    198 views
    0 likes
    Last Post CarlTrading  
    Working...
    X