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 Spiderbird, Today, 12:15 PM
          2 responses
          10 views
          0 likes
          Last Post Spiderbird  
          Started by WHICKED, Today, 12:45 PM
          0 responses
          6 views
          0 likes
          Last Post WHICKED
          by WHICKED
           
          Started by FrazMann, Today, 11:21 AM
          2 responses
          6 views
          0 likes
          Last Post NinjaTrader_ChristopherJ  
          Started by rjbtrade1, 11-30-2023, 04:38 PM
          2 responses
          80 views
          0 likes
          Last Post DavidHP
          by DavidHP
           
          Started by lorem, Yesterday, 09:18 AM
          5 responses
          18 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Working...
          X