Candlestick patterns on ProScreener.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #256895 quote
    CharlesF1CharlesF1
    Participant
    New

    I am new here. Can anyone point me towards coding to run proscreeners searching for the following candlestick patterns:

    A Wick reversal i.e. hanging man in a bear trend, shooting star in a bull trend), an extreme reversal (a large candle signifying exhaustion of the prior trend), an engulfing candle and a doji candle.

    I asked if prorealcode would write the code for me and they referred me to this forum.


    Many thanks, Charles

    #256896 quote
    Iván GonzálezIván González
    Moderator
    Legend

    Hi, here you have an example:

    // --- Candlestick Pattern Identifier ---
    
    // Logic for DOJI
    // Body is less than 10% of the total range
    isDoji = (ABS(Open - Close) <= (Range * 0.1))
    
    // Logic for ENGULFING
    bullishEngulfing = (Close[1] < Open[1]) AND (Close > Open) AND (Close >= Open[1]) AND (Open <= Close[1])
    bearishEngulfing = (Close[1] > Open[1]) AND (Close < Open) AND (Close <= Open[1]) AND (Open >= Close[1])
    isEngulfing = bullishEngulfing OR bearishEngulfing
    
    // Logic for WICK REVERSAL
    upperWick = High - MAX(Open, Close)
    lowerWick = MIN(Open, Close) - Low
    bodySize = ABS(Open - Close)
    shootingStar = (upperWick >= (bodySize * 3)) AND (lowerWick <= (bodySize * 0.5))
    hangingMan = (lowerWick >= (bodySize * 3)) AND (upperWick <= (bodySize * 0.5))
    isWickReversal = shootingStar OR hangingMan
    
    // Logic for EXTREME REVERSAL
    // Current range is 2.5 times larger than average range
    avgRange = Average[20](Range)
    isExtreme = (Range >= (avgRange * 2.5))
    
    // --- Variable assignment based on pattern type ---
    patternType = 0
    
    IF isDoji THEN
       patternType = 1
    ELSIF isEngulfing THEN
       patternType = 2
    ELSIF isWickReversal THEN
       patternType = 3
    ELSIF isExtreme THEN
       patternType = 4
    ENDIF
    
    // --- SCREENER EXECUTION ---
    // Only show stocks where at least one pattern is found
    condition = (patternType > 0)
    
    SCREENER[condition] (patternType AS "Pattern Type: 1=Doji, 2=Eng, 3=Wick, 4=Ext")
    

    You can also use this indicator to check screener

    // --- Candlestick Pattern Identifier ---
    
    // Logic for DOJI
    // Body is less than 10% of the total range
    isDoji = (ABS(Open - Close) <= (Range * 0.1))
    
    // Logic for ENGULFING
    bullishEngulfing = (Close[1] < Open[1]) AND (Close > Open) AND (Close >= Open[1]) AND (Open <= Close[1])
    bearishEngulfing = (Close[1] > Open[1]) AND (Close < Open) AND (Close <= Open[1]) AND (Open >= Close[1])
    isEngulfing = bullishEngulfing OR bearishEngulfing
    
    // Logic for WICK REVERSAL
    upperWick = High - MAX(Open, Close)
    lowerWick = MIN(Open, Close) - Low
    bodySize = ABS(Open - Close)
    shootingStar = (upperWick >= (bodySize * 3)) AND (lowerWick <= (bodySize * 0.5))
    hangingMan = (lowerWick >= (bodySize * 3)) AND (upperWick <= (bodySize * 0.5))
    isWickReversal = shootingStar OR hangingMan
    
    // Logic for EXTREME REVERSAL
    // Current range is 2.5 times larger than average range
    avgRange = Average[20](Range)
    isExtreme = (Range >= (avgRange * 2.5))
    
    // --- Variable assignment based on pattern type ---
    patternType = 0
    
    IF isDoji THEN
       patternType = 1
    ELSIF isEngulfing THEN
       patternType = 2
    ELSIF isWickReversal THEN
       patternType = 3
    ELSIF isExtreme THEN
       patternType = 4
    ENDIF
    
    // --- SCREENER EXECUTION ---
    // Only show stocks where at least one pattern is found
    condition = (patternType > 0)
    
    return patternType AS "Pattern Type: 1=Doji, 2=Eng, 3=Wick, 4=Ext"
    


    robertogozzi thanked this post
    #256919 quote
    CharlesF1CharlesF1
    Participant
    New

    Hi Ivan,

    Thank you very much for your response. I do really appreciate it.

    Best wishes, Charles

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

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Candlestick patterns on ProScreener.


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
CharlesF1 @charlesf1 Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by CharlesF1CharlesF1
7 months, 3 weeks ago.

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 01/25/2026
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...