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 johnMoss, Today, 12:19 PM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by quicksandatl, 05-09-2024, 11:11 AM
          5 responses
          51 views
          0 likes
          Last Post quicksandatl  
          Started by AlgoDreamer, Today, 10:39 AM
          4 responses
          19 views
          0 likes
          Last Post AlgoDreamer  
          Started by RamiRK86, 05-06-2024, 08:05 AM
          3 responses
          38 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by abusestew, Today, 11:57 AM
          2 responses
          11 views
          0 likes
          Last Post NinjaTrader_Zachary  
          Working...
          X