OPEN-SOURCE SCRIPT
Updated Custom Fractals

This indicator detects custom bullish and bearish fractal formations by identifying confirmed swing highs and swing lows based on user-defined candle structure. A bearish fractal forms when a candle’s high is greater than the surrounding candles, while a bullish fractal forms when a candle’s low is lower than the surrounding candles. Optional RSI confirmation can be applied to filter signals so that bearish fractals only appear in overbought conditions and bullish fractals only appear in oversold conditions. The script can also draw horizontal pivot levels from each confirmed fractal to help visualize potential support and resistance zones.
“Bars Before” controls how many candles to the left of the pivot must confirm the fractal structure, while “Bars After” determines how many candles to the right are required before the signal becomes confirmed. Larger settings create stronger but less frequent fractals, while smaller settings react faster and generate more signals. “Non-Repaint Signals” waits for candle close confirmation before plotting signals to reduce repaint behavior during live market conditions. “Draw Horizontal Pivot Lines” displays support and resistance lines extending from confirmed fractals.
“Limit to Recent Signals Only” restricts how many historical fractals remain visible on the chart, while “Recent Signal Count” defines the maximum number of stored signals and pivot lines. “Use RSI Confirmation” enables momentum filtering using the Relative Strength Index. “RSI Length” controls the RSI calculation period, “RSI Source” selects the price source used for RSI calculations, and the “RSI Overbought” and “RSI Oversold” levels determine where RSI confirmation is required for bearish and bullish fractals.
The pivot line settings allow full customization of the horizontal structure levels. “Pivot Line Length” controls how far the level extends into future candles, while the color, width, and style settings customize the appearance of bullish and bearish pivot zones.
This tool is designed for traders who want to identify potential reversal zones, short-term exhaustion points, and key support or resistance levels using price structure and optional momentum confirmation.
“Bars Before” controls how many candles to the left of the pivot must confirm the fractal structure, while “Bars After” determines how many candles to the right are required before the signal becomes confirmed. Larger settings create stronger but less frequent fractals, while smaller settings react faster and generate more signals. “Non-Repaint Signals” waits for candle close confirmation before plotting signals to reduce repaint behavior during live market conditions. “Draw Horizontal Pivot Lines” displays support and resistance lines extending from confirmed fractals.
“Limit to Recent Signals Only” restricts how many historical fractals remain visible on the chart, while “Recent Signal Count” defines the maximum number of stored signals and pivot lines. “Use RSI Confirmation” enables momentum filtering using the Relative Strength Index. “RSI Length” controls the RSI calculation period, “RSI Source” selects the price source used for RSI calculations, and the “RSI Overbought” and “RSI Oversold” levels determine where RSI confirmation is required for bearish and bullish fractals.
The pivot line settings allow full customization of the horizontal structure levels. “Pivot Line Length” controls how far the level extends into future candles, while the color, width, and style settings customize the appearance of bullish and bearish pivot zones.
This tool is designed for traders who want to identify potential reversal zones, short-term exhaustion points, and key support or resistance levels using price structure and optional momentum confirmation.
Release Notes
Added user on/off toggle for triangle labels.Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.