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 cmoran13, 04-16-2026, 01:02 PM
        0 responses
        43 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        25 views
        0 likes
        Last Post PaulMohn  
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        163 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        98 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        158 views
        2 likes
        Last Post CaptainJack  
        Working...
        X