Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

DrawingTools.Line Returning Error

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

    DrawingTools.Line Returning Error

    Hi,

    I am currently creating drawing tool line for my strategy but I am getting error for below statement. This is a click button event.

    startTime and endTime in the startAnchor and endAnchor value is {1/1/1800 12:00:00 AM}. Kindly help to fix this issue. Thanks.

    if (DrawObjects["LineSell"] as DrawingTools.Line != null)
    RemoveDrawObject("LineSell");

    DrawingTools.Line mySellLine = Draw.Line(this, "LineSell", false, 20, Close[0], 0, Close[0], Brushes.Salmon, DashStyleHelper.Solid, 2);

    Or

    DrawingTools.Line mySellLine = Draw.Line(this, "LineSell", false, 20, Close[0], 0, Close[0], true, "");​
    Attached Files
    Last edited by kezyclaire; 02-20-2023, 12:52 PM.

    #2
    Hello kezyclaire,

    A button event is not a NinjaScript event so using BarsAgo or bar times does not make sense there. You would have to bring the code into the NinjaScript context by surrounding it with a TriggerCustomEvent.

    https://ninjatrader.com/support/help...tsub=triggercu stom

    Code:
    TriggerCustomEvent(o =>
    {
        // your code inside here
    }, null);

    Comment


      #3
      Hi Jesse,

      Great, that works. Thanks

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      580 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      335 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      102 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      554 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      552 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X