Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 geddyisodin, Today, 05:20 AM
        6 responses
        34 views
        0 likes
        Last Post geddyisodin  
        Started by trilliantrader, Today, 03:01 PM
        0 responses
        3 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Started by pechtri, 06-22-2023, 02:31 AM
        9 responses
        122 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by frankthearm, 04-18-2024, 09:08 AM
        16 responses
        67 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Started by habeebft, Today, 01:18 PM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X