OPEN-SOURCE SCRIPT

Candlestick Structure [LuxAlgo]

Updated
The Candlestick Structure indicator detects major market trends and displays various candlestick patterns aligning with the detected trend, filtering out potentially unwanted patterns as a result. Multiple trend detection methods are included and can be selected by the users.

A dashboard showing the alignment percentage of each individual pattern is also provided.

🔶 USAGE

snapshot

By distinguishing major and minor trend detection, we can still detect patterns based on minor trends, yet filter out the patterns that do not align with the major trend.

By detecting candlestick patterns that align with a major trend, we can effectively detect the ending points of retracements, potentially providing various entry points of interest within a trend.

Users are able to track the alignment of each candlestick pattern in the dashboard to reveal which patterns typically align with the trend and which may not.

snapshot

Note: Alignment % only checks if the pattern's direction is the same as the current trend direction. These are only raw readings and not any type of confidence score.

🔶 DETAILS

In this indicator, we are identifying and tracking 16 different Candlestick Patterns.

snapshot

🔹 Bullish Patterns

  • Hammer: Identified by a small upper wick (or no upper wick) with a small body, and an elongated lower wick whose length is 2X greater than the candle body’s width.
  • Inverted Hammer: Identified by a small lower wick (or no lower wick) with a small body, and an elongated upper wick whose length is 2X greater than the candle body’s width.
  • Bullish Engulfing: A 2 bar pattern identified by a large bullish candle body fully encapsulating (opening lower and closing higher) the previous small (bearish) candle body.
  • Rising 3: A 5 bar pattern identified by an initial full-bodied bullish candle, followed by 3 bearish candles that trade within the high and low of the initial candle, followed by another full-bodied bullish candle closing above the high of the initial candle.
  • 3 White Soldiers: Identified by 3 full-bodied bullish candles, each opening within the body and closing below the high, of the previous candle.
  • Morning Star: A 3 bar pattern identified by a full-bodied bearish candle, followed by a small-bodied bearish candle, followed by a full-bodied bullish candle that closes above the halfway point of the first candle.
  • Bullish Harami: A 2 bar pattern, identified by an initial bearish candle, followed by a small bullish candle whose range is entirely contained within the body of the initial candle.
  • Tweezer Bottom: A 2 bar pattern identified by an initial bearish candle, followed by a bullish candle, both having equal lows.


🔹 Bearish Patterns

  • Hanging Man: Identified by a small upper wick (or no upper wick) with a small body, and an elongated lower wick whose length is 2X greater than the candle body’s width.
  • Shooting Star: Identified by a small lower wick (or no lower wick) with a small body, and an elongated upper wick whose length is 2X greater than the candle body’s width.
  • Bearish Engulfing: A 2 bar pattern identified by a large bearish candle body fully encapsulating (opening higher and closing lower) the previous small (bullish) candle body.
  • Falling 3: A 5 bar pattern identified by an initial full-bodied bearish candle, followed by 3 bullish candles that trade within the high and low of the initial candle, followed by another full-bodied bearish candle closing below the low of the initial candle.
  • 3 Black Crows: Identified by 3 full-bodied bearish candles, each open within the body and closing below the low, of the previous candle.
  • Evening Star: A 3 bar pattern identified by a full-bodied bullish candle, followed by a small-bodied bullish candle, followed by a full-bodied bearish candle that closes below the halfway point of the first candle.
  • Bearish Harami: A 2 bar pattern, identified by an initial bullish candle, followed by a small bearish candle whose range is entirely contained within the body of the initial candle.
  • Tweezer Top: A 2 bar pattern identified by an initial bullish candle, followed by a bearish candle, both having equal highs.


🔹 Trend Types

snapshot

Major trend is displayed at all times, the display will change depending on the trend method selected.

The minor trend can also be visualized; to avoid confusion, the minor trend can optionally be displayed through the candle colors.

  • Supertrend: Displays Upper and Lower SuperTrend, When we break above the upper, it is considered an Uptrend. When we break below the lower, it is considered a Downtrend.
  • EMAs: Displays Fast and Slow EMAs, When Fast>Slow, it is considered an Uptrend. When Fast<Slow, it is considered a Downtrend.
  • ChoCh: Displays ChoCh Lines and Labels, When a Bullish ChoCh occurs, it is now considered as an Uptrend. When a Bearish ChoCh occurs, it is now considered a Downtrend.
  • Donchian Channel: Displays the Highest and Lowest Values, When we break above the Highest, it is considered an Uptrend. When we break below the Lowest, it is considered a Downtrend.


Below is an example of the Change of Character (ChoCh) method of trend detection.

snapshot

Note:In this description, each screenshot has a different trend method in use, scroll through if you are looking for a specific one.

🔶 SETTINGS

  • Candlestick Patterns: Choose which candlestick patterns to include in calculations.
  • Minor Trend Length: Determines the Donchian Channel length to use for minor trend identification.
  • Major Trend Method: Determines which trend method to use for identifying Major Trend.
  • Major Trend Parameters: Various inputs for controlling Major trends, depending on the specific method you have selected.
  • Color Candles: Colors the chart candles based on minor trend.
  • Dashboard: Control display size and location of Alignment Dashboard.
Release Notes
- Minor changes
bearishpatternbullishpatterncandlestickpatternChart patternsEngulfing CandleHammerharamiluxalgomarketstructuresupertrend

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?


Get access to our exclusive tools: luxalgo.com

Join our 150k+ community: discord.gg/lux

All content provided by LuxAlgo is for informational & educational purposes only. Past performance does not guarantee future results.
Also on:

Disclaimer