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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        131 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        74 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        117 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        111 views
        1 like
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        89 views
        0 likes
        Last Post CarlTrading  
        Working...
        X