Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Cannot remove DrawObject

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

    Cannot remove DrawObject

    Good morning,

    I would like to Draw a horizontale line and Remove It each time I change the Y value.

    I tried this but it does not remove the horizontale line :

    Code:
    [FONT=Courier New][SIZE=2]
    [SIZE=2][FONT=Courier New]RemoveDrawObject([/FONT][/SIZE][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"SL"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]);[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2]
    [SIZE=2][FONT=Courier New]DrawHorizontalLine([/FONT][/SIZE][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"SL"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2],[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]false[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2],stopLossPrice,Color.Red,DashStyle.Dot,[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]1[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]);[/SIZE][/FONT]
    [/SIZE][/FONT]
    Regards

    #2
    Just a dumb question. Do you call RemoveDrawObject before or after the DrawHorizontalLine function?

    It must be after
    mrlogik
    NinjaTrader Ecosystem Vendor - Purelogik Trading

    Comment


      #3
      I call it after.
      I replay DrawHorizontalLine by DrawLine and it works !
      It is maybe a bug

      Thx

      Comment


        #4
        SMuhr, can you please clarify what you're seeing here?

        Another option instead of deleting and re-creating the draw object would be to simply call the draw method with the same exact drawing object name, which basically replaces the first instance with the new one.
        Code:
        // this draws the line once at 900
        DrawHorizontalLine("SL",false,900,Color.Red,DashStyle.Dot,1);
        
        // now if you call it again, it will be replaced by a line at 901
        DrawHorizontalLine("SL",false,901,Color.Red,DashStyle.Dot,1);
        AustinNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

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