PINE LIBRARY

CandlestickPatterns

Updated
Library "CandlestickPatterns"
This library provides a wide range of candlestick patterns, and available for user to call each pattern individually. It's a comprehensive and common tool designed for traders seeking to raise their technical analysis, and it may help users identify key turning of price action in financial instruments. Credit to public technical “*All Candlestick Patterns*” indicator.

abandonedBaby(order, d1)
  The "Abandoned Baby" candlestick pattern is a bullish/bearish pattern consists of three candles.
  Parameters:
    order (simple string): (simple string) Pattern order type "bull" or "bear".
    d1 (simple float): (simple float) Previous candle's body percentage out of candle range. Optional argument, default is 5.

darkCloudCover(c1, n)
  The "Dark Cloud Cover" is a bearish pattern consists of two candles.
  Parameters:
    c1 (simple bool): (simple bool) Previous candle's body must be higher than average. Optional argument, default is true.
    n (simple int): (simple int) Length of average candle's body. Optional argument, default is 14.

doji(d0)
  The "Doji" is neither bullish or bearish consists of one candles.
  Parameters:
    d0 (simple float): (simple float) Current candle's body percentage out of candle range. Optional argument, default is 5.

dojiStar(order, c1, n, d0)
  The "Doji Star" is a bullish/bearish pattern consists of two candles.
  Parameters:
    order (simple string): (simple string) Pattern order type "bull" or "bear" .
    c1 (simple bool): (simple bool) Previous candle's body must be higher than average. Optional argument, default is true.
    n (simple int): (simple int) Length of average candle's body. Optional argument, default is 14.
    d0 (simple float): (simple float) Current candle's body percentage out of candle range. Optional argument, default is 5.

downsideTasukiGap(c2, c1, n)
  The "Downside Tasuki Gap" is a bearish pattern consists of three candles.
  Parameters:
    c2 (simple bool): (simple bool) Before previous candle's body must be higher than average. Optional argument, default is true.
    c1 (simple bool): (simple bool) Previous candle's body must be lower than average. Optional argument, default is true.
    n (simple int): (simple int) Length of average candle's body. Optional argument, default is 14.

dragonflyDoji(d0)
  The "Dragon Fly Doji" is a bullish pattern consists of one candle.
  Parameters:
    d0 (simple float): (simple float) Current candle's body percentage out of candle range. Optional argument, default is 5.

engulfing(order, c1, c0, n)
  The "Engulfing" is a bullish/bearish pattern consists of two candles.
  Parameters:
    order (simple string): (simple string) Pattern order type "bull" or "bear".
    c1 (simple bool): (simple bool) Previous candle's body must be lower than average. Optional argument, default is true.
    c0 (simple bool): (simple bool) Current candle's body must be higher than average. Optional argument, default is true.
    n (simple int): (simple int) Length of average candle's body. Optional argument, default is 14.

eveningDojiStar(c2, c0, d1, n)
  The "Evening Doji Star" is a bearish pattern consists of three candles.
  Parameters:
    c2 (simple bool): (simple bool) Before previous candle's body must be higher than average, default is true.
    c0 (simple bool): (simple bool) Current candle's body must be higher than average. Optional argument, default is true.
    d1 (simple float): (simple float) Previous candle's body percentage out of candle range. Optional argument, default is 5.
    n (simple int): (simple int) Length of average candle's body. Optional argument, default is 14.

eveningStar(c2, c1, c0, n)
  The "Evening Star" is a bearish pattern consists of three candles.
  Parameters:
    c2 (simple bool): (simple bool) Before previous candle's body must be higher than average. Optional argument, default is true.
    c1 (simple bool): (simple bool) Previous candle's body must be lower than average. Optional argument, default is true.
    c0 (simple bool): (simple bool) Current candle's body must be higher than average. Optional argument, default is true.
    n (simple int): (simple int) Length of average candle's body. Optional argument, default is 14.

fallingThreeMethods(c4, c3, c2, c1, c0, n)
  The "Falling Three Methods" is a bearish pattern consists of five candles.
  Parameters:
    c4 (simple bool): (simple bool) 5th candle ago body must be higher than average. Optional argument, default is true.
    c3 (simple bool): (simple bool) 4th candle ago body must be lower than average. Optional argument, default is true.
    c2 (simple bool): (simple bool) 3rd candle ago body must be lower than average. Optional argument, default is true.
    c1 (simple bool): (simple bool) 2nd candle ago body must be lower than average. Optional argument, default is true.
    c0 (simple bool): (simple bool) Current candle's body must be higher than average. Optional argument, default is true.
    n (simple int): (simple int) Length of average candle's body. Optional argument, default is 14.
  Returns: (bool)

fallingWindow()
  The "Falling Window" is a bearish pattern consists of two candles.

gravestoneDoji(d0)
  The "Gravestone Doji" is a bearish pattern consists of one candle.
  Parameters:
    d0 (simple float): (simple float) Current candle's body percentage out of candle range. Optional argument, default is 5.

hammer(c0, n)
  The "Hammer" is a bullish pattern consists of one candle.
  Parameters:
    c0 (simple bool): (simple bool) Current candle's body must be lower than average. Optional argument, default is true.
    n (simple int): (simple int) Length of average candle's body. Optional argument, default is 14.

hangingMan(c0, n)
  The "Hanging Man" is a bearish pattern consists of one candle.
  Parameters:
    c0 (simple bool): (simple bool) Current candle's body must be lower than average. Optional argument, default is true.
    n (simple int): (simple int) Length of average candle's body. Optional argument, default is 14.

haramiCross(order, c1, n)
  The "Harami Cross" candlestick pattern is a bullish/bearish pattern consists of two candles.
  Parameters:
    order (string): (simple string) Pattern order type "bull" or "bear".
    c1 (simple bool): (simple bool) Previous candle's body must be higher than average. Optional argument, default is true.
    n (simple int): (simple int) Length of average candle's body. Optional argument, default is 14.

harami(order, c1, c0, n)
  The "Harami" candlestick pattern is a bullish/bearish pattern consists of two candles.
  Parameters:
    order (string): (simple string) Pattern order type "bull" or "bear"
    c1 (simple bool): (simple bool) Previous candle's body must be higher than average. Optional argument, default is true.
    c0 (simple bool): (simple bool) Current candle's body must be lower than average. Optional argument, default is true.
    n (simple int): (simple int) Length of average candle's body. Optional argument, default is 14.

invertedHammer(c0, n)
  The "Inverted Hammer" is a bullish pattern consists of one candle.
  Parameters:
    c0 (simple bool): (simple bool) Current candle's body must be lower than average. Optional argument, default is true.
    n (simple int): (simple int) Length of average candle's body. Optional argument, default is 14.

kicking(order, c1, c0, n)
  The "Kicking" candlestick pattern is a bullish/bearish pattern consists of two candles.
  Parameters:
    order (string): (simple string) Pattern order type "bull" or "bear"
    c1 (simple bool): (simple bool) Previous candle's body must be higher than average. Optional argument, default is true.
    c0 (simple bool): (simple bool) Current candle's body must be higher than average. Optional argument, default is true.
    n (simple int): (simple int) Length of average candle's body. Optional argument, default is 14.

longLowerShadow(l0)
  The "Long Lower Shadow" candlestick pattern is a bullish pattern consists of one candles.
  Parameters:
    l0 (simple float): (simple float) Current candle's lower wick min percentage out of candle range. Optional argument, default is 75.

longUpperShadow(u0)
  The "Long Upper Shadow" candlestick pattern is a bearish pattern consists of one candles.
  Parameters:
    u0 (simple float): (simple float) Current candle's upper wick min percentage out of candle range. Optional argument, default is 75.

marubozuBlack(c0, n)
  The "Marubozu Black" candlestick pattern is a bearish pattern consists of one candles.
  Parameters:
    c0 (simple bool): (simple bool) Current candle's body must be higher than average. Optional argument, default is true.
    n (simple int): (simple int) Length of average candle's body. Optional argument, default is 14.

marubozuWhite(c0, n)
  The "Marubozu White" candlestick pattern is a bullish pattern consists of one candles.
  Parameters:
    c0 (simple bool): (simple bool) Current candle's body must be higher than average. Optional argument, default is true.
    n (simple int): (simple int) Length of average candle's body. Optional argument, default is 14.

morningDojiStar(c2, d1, c0, n)
  The "Morning Doji Star" candlestick pattern is a bullish pattern consists of three candles.
  Parameters:
    c2 (simple bool): (simple bool) Before previous candle's body must be higher than average. Optional argument, default is true.
    d1 (simple float): (simple float) Previous candle's body percentage out of candle range. Optional argument, default is 5.
    c0 (simple bool): (simple bool) Current candle's body must be higher than average. Optional argument, default is true.
    n (simple int): (simple int) Length of average candle's body. Optional argument, default is 14.

morningStar(c2, c1, c0, n)
  The "Morning Star" candlestick pattern is a bullish pattern consists of three candles.
  Parameters:
    c2 (simple bool): (simple bool) Before previous candle's body must be higher than average. Optional argument, default is true.
    c1 (simple bool): (simple bool) Previous candle's body must be lower than average. Optional argument, default is true.
    c0 (simple bool): (simple bool) Cuurent candle's body must be higher than average. Optional argument, default is true.
    n (simple int): (simple int) Length of average candle's body. Optional argument, default is 14.

onNeck(c1, c0, n)
  The "On Neck" candlestick pattern is a bearish pattern consists of two candles.
  Parameters:
    c1 (simple bool): (simple bool) Previous candle's body must be higher than average. Optional argument, default is true.
    c0 (simple bool): (simple bool) Cuurent candle's body must be lower than average. Optional argument, default is true.
    n (simple int): (simple int) Length of average candle's body. Optional argument, default is 14.

piercing(c1, n)
  The "Piercing" candlestick pattern is a bullish pattern consists of two candles.
  Parameters:
    c1 (simple bool): (simple bool) Previous candle's body must be higher than average. Optional argument, default is true.
    n (simple int): (simple int) Length of average candle's body. Optional argument, default is 14.

risingThreeMethods(c4, c3, c2, c1, c0, n)
  The "Rising Three Methods" candlestick pattern is a bullish pattern consists of five candles.
  Parameters:
    c4 (simple bool): (simple bool) 5th candle ago body must be higher than average. Optional argument, default is true.
    c3 (simple bool): (simple bool) 4th candle ago body must be Lower than average. Optional argument, default is true.
    c2 (simple bool): (simple bool) 3rd candle ago body must be Lower than average. Optional argument, default is true.
    c1 (simple bool): (simple bool) 2nd candle ago body must be Lower than average. Optional argument, default is true.
    c0 (simple bool): (simple bool) Current candle's body must be higher than average. Optional argument, default is true.
    n (simple int): (simple int) Length of average candle's body. Optional argument, default is 14.

risingWindow()
  The "Rising Window" candlestick pattern is a bullish pattern consists of two candle.

shootingStar(c0, n)
  The "Shooting Star" candlestick pattern is a bearish pattern consists of one candle.
  Parameters:
    c0 (simple bool): (simple bool) Current candle's body must be higher than average. Optional argument, default is true.
    n (simple int): (simple int) Length of average candle's body. Optional argument, default is 14.

spinningTopBlack(l0, u0)
  The "Spinning Top Black" is neither bullish or bearish.
  Parameters:
    l0 (simple float): (simple float) Current candle's lower wick min percentage out of candle range. Optional argument, default is 34.
    u0 (simple float): (simple float) Current candle's upper wick min percentage out of candle range. Optional argument, default is 34.

spinningTopWhite(l0, u0)
  The "Spinning Top White" is neither bullish or bearish.
  Parameters:
    l0 (simple float): (simple float) Current candle's lower wick min percentage out of candle range. Optional argument, default is 34.
    u0 (simple float): (simple float) Current candle's upper wick min percentage out of candle range. Optional argument, default is 34.

threeBlackCrows(c2, c1, c0, n)
  The "Three Black Crows" candlestick pattern is a bearish pattern consists of three candles.
  Parameters:
    c2 (simple bool): (simple bool) Before previous candle's body must be higher than average. Optional argument, default is true.
    c1 (simple bool): (simple bool) Previous candle's body must be higher than average. Optional argument, default is true.
    c0 (simple bool): (simple bool) Cuurent candle's body must be higher than average. Optional argument, default is true.
    n (simple int): (simple int) Length of average candle's body. Optional argument, default is 14.

threeWhiteSoldiers(c2, c1, c0, n)
  The "Three White Soldiers" candlestick pattern is a bullish pattern consists of three candles.
  Parameters:
    c2 (simple bool): (simple bool) Before previous candle's body must be higher than average. Optional argument, default is true.
    c1 (simple bool): (simple bool) Previous candle's body must be higher than average. Optional argument, default is true.
    c0 (simple bool): (simple bool) Cuurent candle's body must be higher than average. Optional argument, default is true.
    n (simple int): (simple int) Length of average candle's body. Optional argument, default is 14.

triStar(order, d2, d1, d0)
  The "Tri Star" candlestick pattern is a bullish/bearish pattern consists of three candles.
  Parameters:
    order (simple string): (simple string) Pattern order type "bull" or "bear".
    d2 (simple float): (simple float) Before previous candle's body percentage out of candle range. Optional argument, default is 5.
    d1 (simple float): (simple float) Previous candle's body percentage out of candle range. Optional argument, default is 5.
    d0 (simple float): (simple float) Current candle's body percentage out of candle range. Optional argument, default is 5.

tweezerBottom(c1, n)
  The "Tweezer Bottom" candlestick pattern is a bullish pattern consists of two candles.
  Parameters:
    c1 (simple bool): (simple bool) Previous candle's body must be higher than average. Optional argument, default is true.
    n (simple int): (simple int) Length of average candle's body. Optional argument, default is 14.

tweezerTop(c1, n)
  The "Tweezer Top" candlestick pattern is a bearish pattern consists of two candles.
  Parameters:
    c1 (simple bool): (simple bool) Previous candle's body must be higher than average. Optional argument, default is true.
    n (simple int): (simple int) Length of average candle's body. Optional argument, default is 14.

upsideTasukiGap(c2, c1, n)
  The "Tri Star" candlestick pattern is a bullish pattern consists of three candles.
  Parameters:
    c2 (simple bool): (simple bool) Before Previous candle's body must be higher than average. Optional argument, default is true.
    c1 (simple bool): (simple bool) Previous candle's body must be lower than average. Optional argument, default is true.
    n (simple int): (simple int) Length of average candle's body. Optional argument, default is 14.
Release Notes
bar_typescandlestickpatterntechindicator

Pine library

In true TradingView spirit, the author has published this Pine code as an open-source library so that other Pine programmers from our community can reuse it. Cheers to the author! You may use this library privately or in other open-source publications, but reuse of this code in a publication is governed by House rules.



Trusted Pine Programmer, I Provide Coding Services. For Inquiries
► Website muqwishi.com/home/quotation/
► Telegram t.me/MUQWISHI


⛾ Support My Work on “Buy Me a Coffee” buymeacoffee.com/muqwishi
Also on:

Disclaimer