Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

remove repeated signals

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

    remove repeated signals

    Let say I have this for an entry:
    if (Signal0[0] > Signal1[0] && High[0] > High[1]
    which plots buy arrows every bar. I need just to plot the first arrow if the signal occures, is there a way to remove repeated signals?

    #2
    Hello Bogey20,

    If these are buy arrows from orders, then they can't selectively be removed.

    If you are using DrawArrow commands then you can just use one id for the tag. It will replace previous versions with the same ID.

    You can also remove drawing objects through code.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Hi RyanM
      I use the DrawArrow, if it's not too much trouble would you be able to modify this not to show the repeated arrows, I'm a complete newbie on NinjaTrader, here is the code I have:

      if (Signal0[0] > Signal1[0] && High[0] > High[1] )
      {
      Alert("CrossUp", NinjaTrader.Cbi.Priority.High, "long", "long.wav", 10, Color.Yellow, Color.Black);
      if (showArrows) DrawArrowUp(CurrentBar.ToString(), true, 0, Low[0] - (TickSize*ArrowDisplacement), UpColor);
      }

      Comment


        #4
        bogey20,

        Sure, the corrected code is below. You were using a tag that updated dynamically with each bar. The code below uses only one value "ArrowUp". It will be replaced anytime the condition is true, so you will only see the latest (most recent) arrow drawn.

        Code:
         
        if (Signal0[0] > Signal1[0] && High[0] > High[1] ) 
        { 
        Alert("CrossUp", NinjaTrader.Cbi.Priority.High, "long", "long.wav", 10, Color.Yellow, Color.Black);
        if (showArrows) DrawArrowUp([COLOR=red][B]"ArrowUp"[/B][/COLOR], true, 0, Low[0] - (TickSize*ArrowDisplacement), UpColor);
        }
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Well maybe I did not explained it clearly, so I'm attaching an image. There you can see all the arows the system is generating, however I only want to see the arrows in circles, those are the very first arrows when the signal is valid. So I'm trying to find a way to remove all the other arrows. Here is the code so far:

          if (Signal0[0] > Signal1[0] && High[0] > High[1] )
          {
          Alert("CrossUp", NinjaTrader.Cbi.Priority.High, "long", "long.wav", 10, Color.Yellow, Color.Black);
          if (showArrows) DrawArrowUp(CurrentBar.ToString(), true, 0, Low[0] - (TickSize*ArrowDisplacement), UpColor);

          }



          else if (Signal0[0] < Signal1[0] && Low[0] < Low[1] )
          {
          Alert("CrossDown", NinjaTrader.Cbi.Priority.High, "short", "short.wav", 10, Color.Yellow, Color.Black);
          if (showArrows) DrawArrowDown(CurrentBar.ToString(), true, 0, High[0] + (TickSize*ArrowDisplacement), DownColor);
          }
          Attached Files

          Comment


            #6
            Hello Bogey20,

            This scenario requires custom programming. Basically you want to turn off the display of up arrows until the down arrows are drawn and vice versa. You can do this with bool flags.

            The following snippet is untested and not supported, but you may be able to adapt to fit your needs.


            Code:
             
            #region Variables
            private bool upDrawn = false;
            private bool downDrawn = false;
            #endregion
             
             
            protected override void OnBarUpdate()
            {
            if (Signal0[0] > Signal1[0] && High[0] > High[1] && !upDrawn ) 
            { 
            Alert("CrossUp", NinjaTrader.Cbi.Priority.High, "long", "long.wav", 10, Color.Yellow, Color.Black);
            if (showArrows) 
            {
            DrawArrowUp(CurrentBar.ToString(), true, 0, Low[0] - (TickSize*ArrowDisplacement), UpColor);
            upDrawn = true;
            downDrawn = false;
            }
            }
             
             
            else if (Signal0[0] < Signal1[0] && Low[0] < Low[1] && !downDrawn ) 
            {
            Alert("CrossDown", NinjaTrader.Cbi.Priority.High, "short", "short.wav", 10, Color.Yellow, Color.Black); 
            if (showArrows) 
            {
            DrawArrowDown(CurrentBar.ToString(), true, 0, High[0] + (TickSize*ArrowDisplacement), DownColor);
            downDrawn = true;
            upDrawn = false;
            }
            } 
             
             
             
             
             
            }
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              RyanM thanks a lot, works great.

              Comment


                #8
                Glad to hear, bogey20. Thanks for the update.
                Ryan M.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

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