N Bar Reversal Detector [LuxAlgo]The N Bar Reversal Detector is designed to detect and highlight N-bar reversal patterns in user charts, where N represents the length of the candle sequence used to detect the patterns. The script incorporates various trend indicators to filter out detected signals and offers a range of customizable settings to fit different trading strategies.
🔶 USAGE
The N-bar reversal pattern extends the popular 3-bar reversal pattern. While the 3-bar reversal pattern involves identifying a sequence of three bars signaling a potential trend reversal, the N-bar reversal pattern builds on this concept by incorporating additional bars based on user settings. This provides a more comprehensive indication of potential trend reversals. The script automates the identification of these patterns and generates clear, visually distinct signals to highlight potential trend changes.
When a reversal chart pattern is confirmed and aligns with the price action, the pattern's boundaries are extended to create levels. The upper boundary serves as resistance, while the lower boundary acts as support.
The script allows users to filter patterns based on the trend direction identified by various trend indicators. Users can choose to view patterns that align with the detected trend or those that are contrary to it.
🔶 DETAILS
🔹 The N-bar Reversal Pattern
The N-bar reversal pattern is a technical analysis tool designed to signal potential trend reversals in the market. It consists of N consecutive bars, with the first N-1 bars used to identify the prevailing trend and the Nth bar confirming the reversal. Here’s a detailed look at the pattern:
Bullish Reversal : In a bullish reversal setup, the first bar is the highest among the first N-1 bars, indicating a prevailing downtrend. Most of the remaining bars in this sequence should be bearish (closing lower than where they opened), reinforcing the existing downward momentum. The Nth (most recent) bar confirms a bullish reversal if its high price is higher than the high of the first bar in the sequence (standard pattern). For a stronger signal, the closing price of the Nth bar should also be higher than the high of the first bar.
Bearish Reversal : In a bearish reversal setup, the first bar is the lowest among the first N-1 bars, indicating a prevailing uptrend. Most of the remaining bars in this sequence should be bullish (closing higher than where they opened), reinforcing the existing upward momentum. The Nth bar confirms a bearish reversal if its low price is lower than the low of the first bar in the sequence (standard pattern). For a stronger signal, the closing price of the Nth bar should also be lower than the low of the first bar.
🔹 Min Percentage of Required Candles
This parameter specifies the minimum percentage of candles that must be bullish (for a bearish reversal) or bearish (for a bullish reversal) among the first N-1 candles in a pattern. For higher values of N, it becomes more challenging for all of the first N-1 candles to be consistently bullish or bearish. By setting a percentage value, P, users can adjust the requirement so that only a minimum of P percent of the first N-1 candles need to meet the bullish or bearish condition. This allows for greater flexibility in pattern recognition, accommodating variations in market conditions.
🔶 SETTINGS
Pattern Type: Users can choose the type of the N-bar reversal patterns to detect: Normal, Enhanced, or All. "Normal" detects patterns that do not necessarily surpass the high/low of the first bar. "Enhanced" detects patterns where the last bar surpasses the high/low of the first bar. "All" detects both Normal and Enhanced patterns.
Reversal Pattern Sequence Length: Specifies the number of candles (N) in the sequence used to identify a reversal pattern.
Min Percentage of Required Candles: Sets the minimum percentage of the first N-1 candles that must be bullish (for a bearish reversal) or bearish (for a bullish reversal) to qualify as a valid reversal pattern.
Derived Support and Resistance: Toggles the visibility of the support and resistance levels/zones.
🔹 Trend Filtering
Filtering: Allows users to filter patterns based on the trend indicators: Moving Average Cloud, Supertrend, and Donchian Channels. The "Aligned" option only detects patterns that align with the trend and conversely, the "Opposite" option detects patterns that go against the trend.
🔹 Trend Indicator Settings
Moving Average Cloud: Allows traders to choose the type of moving averages (SMA, EMA, HMA, etc.) and set the lengths for fast and slow moving averages.
Supertrend: Options to set the ATR length and factor for Supertrend.
Donchian Channels: Option to set the length for the channel calculation.
🔶 RELATED SCRIPTS
Reversal-Candlestick-Structure.
Reversal-Signals.
3barpattern
3B-Play Finder1 - Objective
2 - How to use (Theory)
3 - How to use (Grade System)
4 - Inputs
5 - Extras and Alerts
6 - Notes
Objective
This script aims to mark 3 Bar play patterns (both short and long) by identifying them on the chart, with an arrow pointing up from long and down for short. Aswell, setting alerts based on grade.
Following the base concept, this script comes with a "grade" system (A, B, C), which aims to classify 3B-Play according to input parameters.
2 - How to use (Theory)
The pattern is described by a wide range Ignite bar followed by a narrow resting bar.
Long
Given a 3 Bar play pattern, with a wide range green bar, the entry point should be above the ignite and narrow bar wicks (high) with stop loss set below the resting bar wick low but within ignite wide range bar.
The exit depends on the chart analysis, and there is no set rule for it.
Short
Similar to long but is with a wide range red bar and entry is defined on wick low and stop-loss at wick high.
3 - How to use (Grade System)
Since 3B-play come in all sort of shapes, some are "textbook" perfect, others a bit more "loose". I set a grading system, to differentiate each one.
The way the 3 Bar play quality is determined is based on the percentage size of the resting bar in relation to igniting bar size, starting from de close. An example of how this works is the following. Note: enabling the extra draws lines helps visually to adjust the grades to your preference.
4 - Inputs
3B Quality section
Enable/disable each grade.
CONTROL LONG / SHORT
Set the percentage values for each grade.
Extras
Enable/Disable extra plots.
5 - Extras and Alerts
This script comes with an extra section, enabling it, draws lines on the max and min values, as well, showing the values in text and the set percentage.
Also, you can set alerts based on the grade and short/long, note you should set the alert to bar close to avoid pre-trigger warnings.
6 - Notes
The script can be shorted a lot, by only looking for a single 3 bar play, to less than 30 lines.
Combo Strategies 123 Reversal and 3-Bar-Reversal-Pattern This is combo strategies for get
a cumulative signal. Result signal will return 1 if two strategies
is long, -1 if all strategies is short and 0 if signals of strategies is not equal.
First strategy
This System was created from the Book "How I Tripled My Money In The
Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
The strategy buys at market, if close price is higher than the previous close
during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50.
The strategy sells at market, if close price is lower than the previous close price
during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
Secon strategy
This startegy based on 3-day pattern reversal described in "Are Three-Bar
Patterns Reliable For Stocks" article by Thomas Bulkowski, presented in
January,2000 issue of Stocks&Commodities magazine.
That pattern conforms to the following rules:
- It uses daily prices, not intraday or weekly prices;
- The middle day of the three-day pattern has the lowest low of the three days, with no ties allowed;
- The last day must have a close above the prior day's high, with no ties allowed;
- Each day must have a nonzero trading range.
WARNING:
- This script to change bars colors.