Help me to adapt an existing code (Piercing pattern)

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #150530 quote
    jimkn0pf
    Participant
    New

    Hi,

     

    I have absolutely zero knowledge about coding. Therefore I need some help which will take an experienced guy literally 3 minutes. Cristof wrote the code for the piercing pattern, which I attached.

    It finds the piercing pattern, after it was confirmed by a third, a bullish candle.What I need is this code WITHOUT the candle that follows the piercing pattern. I would like to find the piercing pattern in “real time”, without having to wait for the third candle for confirmation.

    As i mentioned, I assume it is pretty easy to adapt the existing code  for somebody experienced, so I hope that you will find some time.

     

    Thanks in advance

    // Piercing pattern is a downtrend follow by a bullish candle
    // that closes above 50% of the preceding bearish candle,
    // that could indicate a reversal,
    // this screener includes a fairly good confirmation of that pattern,
    // it starts from a bullish candle, and it finds the pattern in the two previous candles
    // @Cristofer (=
    // V1
    
    currentClose = Close
    currentOpen = Open
    
    // Bullish candle
    c1 = currentOpen < currentClose
    
    piercingHigh = High[1]
    piercingClose = Close[1]
    piercingOpen = Open[1]
    piercingLow = Low[1]
    
    // piercing is bullish
    c2 = piercingClose > piercingOpen
    
    bearishHigh = High[2]
    bearishOpen = Open[2]
    bearishClose = Close[2]
    bearishLow = Low[2]
    
    // is a bearish candle
    c3 = bearishOpen > bearishClose
    
    // lower high, lower low
    c4 = bearishHigh > piercingHigh AND bearishLow > piercingLow
    
    // piercing opens lower than bearish close
    c5 = piercingOpen < bearishClose
    
    // piercing closes above 50% level of the bearish candle
    c6 = ((bearishOpen + bearishClose) / 2) < piercingClose AND piercingClose < bearishOpen
    
    SCREENER[c1 AND c2 AND c3 AND c4 AND c5 AND c6]
    #150533 quote
    robertogozzi
    Moderator
    Master

    Always use the ‘Insert PRT Code’ button when putting code in your posts to make it easier for others to read.

    Thank you 🙂

    #150534 quote
    robertogozzi
    Moderator
    Master

    This should do (not tested):

    // Piercing pattern is a downtrend follow by a bullish candle
    // that closes above 50% of the preceding bearish candle,
    // that could indicate a reversal,
    // this screener includes a fairly good confirmation of that pattern,
    // it starts from a bullish candle, and it finds the pattern in the two previous candles
    // @Cristofer (=
    // V1
     
    currentClose = Close
    currentOpen = Open
     
    // Bullish candle
    c1 = 1 OR (currentOpen < currentClose)
     
    piercingHigh = High[0]
    piercingClose = Close[0]
    piercingOpen = Open[0]
    piercingLow = Low[0]
     
    // piercing is bullish
    c2 = piercingClose > piercingOpen
     
    bearishHigh = High[1]
    bearishOpen = Open[1]
    bearishClose = Close[1]
    bearishLow = Low[1]
     
    // is a bearish candle
    c3 = bearishOpen > bearishClose
     
    // lower high, lower low
    c4 = bearishHigh > piercingHigh AND bearishLow > piercingLow
     
    // piercing opens lower than bearish close
    c5 = piercingOpen < bearishClose
     
    // piercing closes above 50% level of the bearish candle
    c6 = ((bearishOpen + bearishClose) / 2) < piercingClose AND piercingClose < bearishOpen
     
    SCREENER[c1 AND c2 AND c3 AND c4 AND c5 AND c6]
    jimkn0pf thanked this post
    #150555 quote
    jimkn0pf
    Participant
    New

    Roberto, thank you very much!!!

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

Help me to adapt an existing code (Piercing pattern)


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
jimkn0pf @jimkn0pf Participant
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by jimkn0pf
5 years, 4 months ago.

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 11/14/2020
Status: Active
Attachments: No files
Logo Logo
Loading...