Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Avoiding two consecutive signals in a row

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

    Avoiding two consecutive signals in a row

    Hello,

    I developed an indicator that draws a dot below a candle (for a long signal) if certain conditions are met.
    In case two consecutive candles in a row meet the criteria, I want to avoid that the indicator draws two dots in a row in order to keep my chart clean.
    How can I do that? (It comes down to checking if the conditions were met for the prior bar and if they're met again in the current bar, then no dot should be drawn).

    Thanks

    #2
    Hello laocoon,

    If you only ever want one drawing object to appear, you can re-use the tag name, and this will move the existing object to the current bar instead of generating a new object.


    You could also remove the dot on the previous bar with RemoveDrawObject().


    You could check the condition was not true one bar ago in the condition set that draws the dot.

    For example if the condition is that the Close is greater than the Open.

    if (CurrentBar > 1 && Close[1] <= Open[1] // check the previous bar close is not greater than the open
    && Close[0] > Open[0]) // check the current bars close is greater than the open
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello ChelseaB,

      Thanks for your reply.
      I don't want only one drawing object ever to appear, I want all to appear, just not if there are two (or more) candles in a row that meet my criteria.
      Example:
      -If three consecutive candles meet my criteria, I only want the drawing object to appear above/below the first candle.
      -If the first candle meets my criteria, I want the drawing object to appear, if the second doesn't meet them it obviously won't appear but if the third candle meets them again I want the drawing object to appear again.

      Thanks

      Comment


        #4
        Hello laocoon,

        In your condition you would check bars ago 1 does not have the condition true and bars ago 2 does not have the condition true and bars ago 0 does have the condition true.
        Chelsea B.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