Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Correct Syntax for Draw.Text() and DateTime time parameter

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

    Correct Syntax for Draw.Text() and DateTime time parameter

    Hi, why if I draw a vertical line in the future, to the right of the current bar with the following line:

    Draw.Line(this, "tag2", false, DateTime.Now.AddHours(10), 11800,DateTime.Now.AddHours(10), 12050, Brushes.Black, DashStyleHelper.Solid, 1);

    It compiles and works but if I try to add text at the same point with the following line doesn't compile and I get error

    Draw.Text(this, "tag3", Close[0].ToString("0.##"),DateTime.Now.AddHours(10), Close[0], Brushes.Black);

    What would be the correct Syntax for Draw.Text() and DateTime time parameter?
    Thanks.

    #2
    Hello Fran09,

    Thanks for your post and welcome to the Ninjatrader forums!

    Please review the help guide for Draw.text(): https://ninjatrader.com/support/help...?draw_text.htm

    It appears that the parameters you are using for Draw.Text do not match the overloads for the method.

    To use the DateTime, you would need to use the last shown overload with a parameter list of:

    Draw.Text(NinjaScriptBase owner, string tag, bool isAutoScale, string text, DateTime time, double y, int yPixelOffset, Brush textBrush, SimpleFont font, TextAlignment alignment, Brush outlineBrush, Brush areaBrush, int areaOpacity)

    Comment


      #3
      Hi, Thanks for your reply it helped me.

      I followed your advice and I've worked it out.
      Thanks again.


      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      650 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      370 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      109 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      574 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      577 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X