Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Text on chart

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

    Text on chart

    Hi,

    1. I searched the way to draw smaller dots and found this thread https://ninjatrader.com/support/foru...-a-smaller-dot
    So I tried to convert code to NT8.

    NinjaTrader.Gui.Tools.SimpleFont myFont = new NinjaTrader.Gui.Tools.SimpleFont("Wingdings 3", 20) { Size = 50, Bold = true };

    Draw.Text(this, "myTag"+CurrentBar, true, "p", 0, Low[0], 5, Brushes.Blue, myFont, TextAlignment.Center, Brushes.Black, null, 1);


    But It's drawn on indicator panel. How to make it on chart? It doesn't have drawOnPricePanel bool.

    And what does "Size = 50" mean? We defined font size "20", right?


    2. How to use data series from another custom indicator? I "member it should be done by adding declaration in new indicator.

    #2
    Hello Leeroy_Jenkins,

    You could consider the following to force the Drawing object to draw on the price panel.

    Code:
    bool drawOnPricePanel = DrawOnPricePanel;
    DrawOnPricePanel = true;
    Draw.Text(this, "myTag"+CurrentBar, true, "p", 0, Low[0], 5, Brushes.Blue, myFont, TextAlignment.Center, Brushes.Black, null, 1);
    DrawOnPricePanel = drawOnPricePanel;
    You are specifying the size within the constructor for the SimpleFont object to have a font size of 20, and then you are setting the SimpleFont's Size property to 50.

    Indicators will return a Series<double> of their output values. If you would like to reference an indicator like a data series, you could instantiate the indicator.

    Example:

    Code:
    private SMA SMA1;
    
    protected override void OnStateChange()
    {
        if (State == State.SetDefaults)
        {
            ...
        }
        else if (State == State.DataLoaded)
        {                
            SMA1                = SMA(Close, 14);
        }
    }
    
    protected override void OnBarUpdate()
    {
        Print(SMA1[0]);    
    }
    Please let us know if you have any additional questions.

    Comment


      #3
      Perhaps worth mentioning that unicode symbols can be used in the text string of a Draw.Text statement. Google "unicode" to see the many symbols available.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      563 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      329 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      547 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      548 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X