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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      128 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      74 views
      1 like
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      116 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      110 views
      1 like
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      89 views
      0 likes
      Last Post CarlTrading  
      Working...
      X