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 SalmaTrader, 07-07-2026, 10:26 PM
      0 responses
      45 views
      0 likes
      Last Post SalmaTrader  
      Started by CarlTrading, 07-05-2026, 01:16 PM
      0 responses
      22 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 06-17-2026, 10:32 AM
      0 responses
      14 views
      0 likes
      Last Post CaptainJack  
      Started by kinfxhk, 06-17-2026, 04:15 AM
      0 responses
      20 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Started by kinfxhk, 06-17-2026, 04:06 AM
      0 responses
      22 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Working...
      X