• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

RemoveDrawObject

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

    RemoveDrawObject

    I coded in a strategy DrawArrowUp:

    DrawArrowUp ("ArrowUp" + CurrentBar,0, Low[0] - TickSize * 2, Color.Green);

    and then I want to remove the Arrow if a condition is true.

    if (condition)
    {
    RemoveDrawObject("ArrowUp");
    }

    But it is not working. The arrow stays always on the chart.

    Thank you.

    #2
    Hello Ironman9973,

    Thank you for your post.

    You are including an additional item in the tag; CurrentBar. This needs to be included in the RemoveDrawObject() method.

    Since you may be removing the drawing object after the bar the DrawArrowUp() was placed, you could not include simply RemoveDrawObject("ArrowUp" + CurrentBar);.

    You will either need to use a variable you can track or remove the CurrentBar from the tag.

    You could track the variable with Time[0] (as this is a DataSeries that can be accessed by the bars ago index). You would still need to figure how many bars have passed since the DrawArrowUp() was placed and use that as a variable int that you can call when removing the drawing object.
    Code:
    DrawArrowUp ("ArrowUp" + Time[0],0, Low[0] - TickSize * 2, Color.Green);
    
    if (condition)
    {
    RemoveDrawObject("ArrowUp" + Time[sinceDrawn]);
    }
    Please let me know if you have any questions.
    Patrick H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by pstrusi, Today, 02:05 PM
    1 response
    5 views
    0 likes
    Last Post NinjaTrader_Kate  
    Started by Seastragg, Today, 01:21 PM
    1 response
    17 views
    0 likes
    Last Post NinjaTrader_PaulH  
    Started by stafe, Today, 01:27 PM
    0 responses
    6 views
    0 likes
    Last Post stafe
    by stafe
     
    Started by Dagamos, Today, 11:48 AM
    3 responses
    14 views
    0 likes
    Last Post NinjaTrader_RyanS  
    Started by kantkant2, Yesterday, 03:20 PM
    4 responses
    26 views
    0 likes
    Last Post eDanny
    by eDanny
     
    Working...
    X