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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    54 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    72 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    38 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    99 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    60 views
    0 likes
    Last Post PaulMohn  
    Working...
    X