Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

removesince...

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

    removesince...

    Hello,

    I want to have in my indicator

    if (BarsSinceDrawObject("My remove draw object") == 3)
    {
    RemoveDrawObject("My remove draw object");
    }

    But I get an error-message when compiling.

    I know from the videolibrary and strategy wizard how to do "BarsSinceEntry" but not when there is no entry and I want to remove eg an arrow 3 bars after the bar it has been plotted.

    Thanks.
    Tony
    Last edited by tonynt; 03-01-2011, 04:19 PM.

    #2
    Hello tonynt,

    You have to custom code this, as there are not built in methods for tracking drawing object placement and removal.

    An example might be something like this, where you capture current bar with int variable myDrawBar at the same time you draw it. Compare this variable value to CurrentBar to decide when to remove.

    if (Close[0] > Open[0])
    {
    DrawArrowDown("My down arrow" + CurrentBar, false, 0, High[0], Color.Red);
    myDrawBar = CurrentBar;
    }

    else if (CurrentBar - myDrawBar == 3)
    RemoveDrawObject("My down arrow");
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thank you!

      Best software - best support!

      Comment


        #4
        Hello,
        I have added "my draw bar....." but when compiling I get the message "The name ´myDrawBar´does not exist int the current context." (???)

        Thanks
        Tony

        Comment


          #5
          You have to declare in variables region.

          #region Variables
          private int myDrawBar;
          #endregion
          Ryan M.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by CaptainJack, 04-24-2026, 11:07 PM
          0 responses
          28 views
          0 likes
          Last Post CaptainJack  
          Started by Mindset, 04-21-2026, 06:46 AM
          0 responses
          125 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by M4ndoo, 04-20-2026, 05:21 PM
          0 responses
          181 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Started by M4ndoo, 04-19-2026, 05:54 PM
          0 responses
          94 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Started by cmoran13, 04-16-2026, 01:02 PM
          0 responses
          138 views
          0 likes
          Last Post cmoran13  
          Working...
          X