Bullish Bar Closing above 2 Bearish Bar and vice versa

Viewing 8 posts - 16 through 23 (of 23 total)
  • Author
    Posts
  • #139754 quote
    parthapersonal
    Participant
    Average

    Many thanks Robert. However it is still missing some signals as enclosed.

    Regards,

    #139771 quote
    robertogozzi
    Moderator
    New

    The bar you marked as MISSESD, because you asked “bullish bar should close above the highest high of the previous 2 bearish bars (they (bullish and/ or bearish) may not be consecutive and the last bearish bar’s high should be lower than the previous bearish bar’s high ignoring the inside bar in between is any)“.

    Which isn’t. The last bearish bar’s HIGH was HIGHER than the previous one!

    #139800 quote
    parthapersonal
    Participant
    Average

    Hello Robert,

    In that case the last bearish bar’s high when compared with the 3rd bearish bar (previous), it is low. Hence it should be considered for the signal. Similarly for the opposite.

    Example for NEXTDC Ltd (ticker: NXT) the 17-Jul daily bar should be a signal as its close is higher than the high of the 3rd bearish bar as shown in the enclosed.

    #139821 quote
    robertogozzi
    Moderator
    New

    In that case the last bearish bar’s high when compared with the 3rd bearish bar (previous), it is low.

    the last bearish bar’s high should be lower than the previous bearish bar’s high ignoring the inside bar in between is any

    Which one of the two rules shall be applied?

    #139846 quote
    parthapersonal
    Participant
    Average

    This is the paradox dear. Market does not always print as per our codes. My only intention is to capture the entire move, as much as possible and that is why I tried it with if statements which is capable of capturing all the variations. You are also right, however it would be better, for the time being, to follow in addition to existing codes, “the last bearish bar’s high when compared with the 3rd bearish bar (previous), it is low. Hence it should be considered for the signal. Similarly for the opposite.”

    #139934 quote
    robertogozzi
    Moderator
    New

    There you go (not tested):

    DEFPARAM CalculateOnLastBars = 1000
    Bullish   = close > open
    Bearish   = close < open
    InsideBAR = (range < range[1]) AND (high <= high[1]) AND (low >= low[1])
    //
    // DOWN trend detection
    //
    Count1 = 0
    i      = 0
    WHILE Count1 < 3 AND i < BarIndex
       i = i + 1
       IF Count1 = 0 THEN
          IF Bullish[i] AND Not InsideBAR[i] THEN
             Count1 = 1
             MyLO1 = low[i]
          ENDIF
       ELSIF Count = 1 THEN
          IF Bullish[i] AND Not InsideBAR[i] THEN
             Count1 = 2
          ENDIF
       ELSE
          IF Bullish[i] AND Not InsideBAR[i] THEN
             Count2 = 3
             MyLO2 = low[i]
             d1    = MyLO1 > MyLO2
             MyLO2 = min(MyLO1,MyLO2)
             Break
          ENDIF
       ENDIF
    WEND
    d2      = Bearish
    d3      = close < MyLO2
    Dcond   = d1 AND d2 AND d3
    //
    // UP   trend detection
    //
    Count2 = 0
    j      = 0
    WHILE Count2 < 3 AND j < BarIndex
       j = j + 1
       IF Count2 = 0 THEN
          IF Bearish[j] AND Not InsideBAR[j] THEN
             Count2 = 1
             MyHI1 = high[j]
          ENDIF
       ELSIF Count2 = 1 THEN
          IF Bearish[j] AND Not InsideBAR[j] THEN
             Count2 = 2
          ENDIF
       ELSE
          IF Bearish[j] AND Not InsideBAR[j] THEN
             Count2 = 3
             MyHI2 = high[j]
             u1    = MyHI1 < MyHI2
             MyHI2 = max(MyHI1,MyHI2)
             Break
          ENDIF
       ENDIF
    WEND
    u2      = Bullish
    u3      = close > MyHI2
    Ucond   = u1 AND u2 AND u3
    //
    Cond    = 0
    IF Ucond THEN
       Cond = 1
    ELSIF Dcond THEN
       Cond = -1
    ENDIF
    RETURN Cond AS "Signal"
    #139971 quote
    parthapersonal
    Participant
    Average

    Many thanks Robert, however it is missing many signals as enclosed.

    #139976 quote
    robertogozzi
    Moderator
    New

    You asked me that you no longer check the last two bearish bars, but the last one and the second previous one (the last one and the thirs one).

    When you want to check the last bars + the third one use the last version, if you want to use the last 2 bars (in both cases ignoring Inside bars) the use the previous version.

Viewing 8 posts - 16 through 23 (of 23 total)
  • You must be logged in to reply to this topic.

Bullish Bar Closing above 2 Bearish Bar and vice versa


ProBuilder support

New Reply
Author
Summary

This topic contains 22 replies,
has 3 voices, and was last updated by robertogozzi
5 years, 6 months ago.

Topic Details
Forum: ProBuilder support
Language: English
Started: 07/14/2020
Status: Active
Attachments: 13 files
Logo Logo
Loading...