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 carnitron, 04-27-2024, 08:42 PM
          1 response
          15 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by WHICKED, 04-26-2024, 12:56 PM
          3 responses
          24 views
          0 likes
          Last Post WHICKED
          by WHICKED
           
          Started by zstheorist, 04-26-2024, 07:52 PM
          1 response
          13 views
          0 likes
          Last Post NinjaTrader_LuisH  
          Started by Touch-Ups, 04-27-2024, 10:36 AM
          2 responses
          22 views
          0 likes
          Last Post Touch-Ups  
          Started by needsomehelp147, Today, 06:43 AM
          0 responses
          11 views
          0 likes
          Last Post needsomehelp147  
          Working...
          X