Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Auto-removal of Arrows

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

    Auto-removal of Arrows

    Hello

    I've developed a strategy that draws an arrow above (for shorts) /below (for longs) a bar when certain criteria are met.

    Now, what I'd like to do is to have the strategy automatically REMOVE the arrow if the entry signal isn't validated, ie if the next bar after the one where the arrow has been drawn doesn't make a tick lower than the low (for shorts) or a tick higher than the high (for longs) than the signal bar.

    I'd be grateful if someone could point me in the right direction.

    Thanks & Regards

    #2
    Hi laocoon,

    You can use RemoveDrawObject() for this.

    For example, you could DrawArrowUp("up" + CurrentBar, ...) then
    RemoveDrawObject("up" + (CurrentBar -1)) a bar later.
    TimNinjaTrader Customer Service

    Comment


      #3
      Hello Tim

      Thanks a lot for your reply. This is exactly what I had in mind.
      I have slightly modified my code and instead of drawing Up- or Down Arrows I now have the screen segment where the relevant bar is located colored in green (long) or red (short). If the subsequent candle doesn't make a higher high or a lower low than the high/low of the candle that gave the signal, I want to have the screen white again (white being the default screen color).

      Could I ask you to have a look at my code (for longs), it seems that I have a problem with the CurrentBar command:

      if ((my conditions here
      {
      BackColorAll = Color.LightGreen;
      }

      if((High (CurrentBar-1) <= (High (CurrentBar-2))
      {
      BackColorAll = Color.White;
      }

      Thanks a lot.

      Comment


        #4
        Hi laocoon,

        If you want to reference the previous bar, and the one before that, you can do something like....
        Code:
        if((High[1] <= (High[2])
        {
        BackColorAll = Color.White;	
        }
        More info at - http://www.ninjatrader.com/support/f...ead.php?t=4769
        TimNinjaTrader Customer Service

        Comment


          #5
          Hi Tim

          Thanks a lot for your reply. I modified my code according to your suggestion but I must have missed something because it works fine except that once the relevant screen segment is colored in green or red, it does not go back to the default white color if the next bar doesn't make a higher high (for longs) or a lower low (for shorts).

          Could I ask you to take a last look at the code, thanks a lot.

          // Colors the screen segment where the relevant bar is located in green if long conditions are met
          if (my LONG conditions here...)
          {
          BackColorAll = Color.LightGreen;
          }

          // Colors the screen segment where the relevant bar is located in red if short conditions are met
          else if (my SHORT conditions here...)
          {
          BackColorAll = Color.Red;
          }

          // Colors a red or green segment in white if the next bar didn't make a higher high or a lower low
          else if (High[1] <= High[2] || Low[1] >= Low[2])
          {
          BackColorAll = Color.White;
          }

          // Colors the whole screen in white (except the segments where there are CONFIRMED long or short signals
          else
          {
          BackColorAll = Color.White;
          }
          Last edited by laocoon; 06-17-2010, 06:22 AM.

          Comment


            #6
            Hi laocoon,

            Try adding a Print() statement to ensure your code conditions are truly being met, then you monitor the output window.
            More info at - http://www.ninjatrader.com/support/f...ead.php?t=3418
            TimNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            655 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            370 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            109 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            574 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            577 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X