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 charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      45 views
      0 likes
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      141 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      160 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 05-10-2026, 08:12 PM
      0 responses
      96 views
      0 likes
      Last Post CarlTrading  
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      275 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Working...
      X