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 Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    589 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    342 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    103 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    555 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    552 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X