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 charlesugo_1, 05-26-2026, 05:03 PM
            0 responses
            60 views
            0 likes
            Last Post charlesugo_1  
            Started by DannyP96, 05-18-2026, 02:38 PM
            1 response
            145 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 05-11-2026, 05:56 AM
            0 responses
            161 views
            0 likes
            Last Post CarlTrading  
            Started by CarlTrading, 05-10-2026, 08:12 PM
            0 responses
            97 views
            0 likes
            Last Post CarlTrading  
            Started by Hwop38, 05-04-2026, 07:02 PM
            0 responses
            283 views
            0 likes
            Last Post Hwop38
            by Hwop38
             
            Working...
            X