Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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)

    Paul H.NinjaTrader Customer Service

    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 dcriador, Today, 12:06 PM
      0 responses
      1 view
      0 likes
      Last Post dcriador  
      Started by dcriador, Today, 12:04 PM
      0 responses
      0 views
      0 likes
      Last Post dcriador  
      Started by cutzpr, Today, 08:54 AM
      0 responses
      6 views
      0 likes
      Last Post cutzpr
      by cutzpr
       
      Started by benmarkal, Today, 08:44 AM
      0 responses
      12 views
      0 likes
      Last Post benmarkal  
      Started by Tin34, Today, 03:30 AM
      2 responses
      26 views
      0 likes
      Last Post Tin34
      by Tin34
       
      Working...
      X