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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    81 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    42 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    64 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    66 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    54 views
    0 likes
    Last Post CarlTrading  
    Working...
    X