OPEN-SOURCE SCRIPT

Fractal Breakout Scanner [forexobroker]

960
🔶 OVERVIEW

Fractal Breakout Scanner is an overlay indicator that automates support and resistance level detection using Williams fractals — mathematically confirmed pivot points where price has reversed. It tracks these levels as persistent S/R lines on the chart, counts how many times each level has been tested, and generates breakout signals when price closes beyond a tested level with volume confirmation.

The advantage over manually drawn S/R levels is objectivity and consistency. Human-drawn levels are subjective — two traders looking at the same chart will draw different lines. Fractals provide a mathematical definition: a pivot high requires the high to be the highest point within a configurable number of left and right bars, and vice versa for pivot lows. Levels that are tested multiple times become stronger (the lines become thicker and more opaque), and breakouts through multi-tested levels carry more significance.

This indicator is designed for traders who want systematic, objective support and resistance analysis with automated breakout detection.

🔶 CONCEPTS

Fractals in trading are mathematically defined turning points in price. A fractal high occurs when a bar's high is higher than the highs of a set number of bars on both sides — it is a confirmed local top. A fractal low is a confirmed local bottom. These points naturally correspond to where buying or selling pressure reversed price, making them logical support and resistance levels.

The strength of an S/R level increases with each touch. When price approaches a level and bounces away, it validates the level and attracts more attention from traders who place orders at that price. A level tested three or four times has more resting orders than one tested only once. When that well-tested level finally breaks, it represents a significant shift — the orders that were defending the level have been overwhelmed, and price is likely to continue in the breakout direction.

The concept of role reversal is also important: broken resistance tends to become support, and broken support tends to become resistance. While this indicator does not explicitly implement role reversal, the breakout signals identify the moment of the break, which is the optimal entry timing for this phenomenon.

🔶 HOW IT WORKS

• Fractal highs and lows are detected using configurable left and right bar counts — the pivot must be the highest high (or lowest low) across both sides to qualify
• Each fractal is added as a support or resistance level, and nearby levels within an ATR-based proximity zone are merged (increasing the touch count) rather than duplicated
• S/R lines are drawn on the chart with color intensity and line width proportional to the touch count — lightly tested levels are thin and transparent, heavily tested levels are thick and bold
• Breakout signals fire when price closes beyond a tracked level on a confirmed bar with volume above its SMA and cooldown satisfied — the signal label includes the specific level price and touch count
• Separate touch tracking updates each level's count when price approaches within the touch zone and then retreats

🔶 HOW TO USE

1. Add the indicator to any chart — fractal dots and S/R lines will populate automatically based on recent pivot points
2. Watch for resistance lines (pink) and support lines (green) that grow thicker and more opaque over time — these are the levels being tested repeatedly and building significance
3. When a "BULL BREAK" or "BEAR BREAK" signal fires, the label shows the exact level that was broken and its touch count — higher touch counts suggest more significant breakouts
4. After a breakout signal, consider using the broken level as a stop-loss reference (broken resistance becomes support, broken support becomes resistance) and target the next S/R level visible on the chart

🔶 FEATURES

• Non-repainting signals (uses barstate.isconfirmed)
• Works on all timeframes and instruments
• 9 alert conditions with webhook JSON support
• Professional dashboard with resistance/support counts, total touches, and cooldown status
• Automatic level merging that combines nearby fractals into stronger consolidated levels
• Glow-effect fractal dots with diamond markers at confirmed pivot points

🔶 SETTINGS GUIDE

• Left Bars / Right Bars — Number of bars on each side required to confirm a fractal pivot (default: 3 / 3)
• Max S/R Levels — Maximum number of fractal levels tracked simultaneously (default: 5)
• Breakout Buffer (ticks) — Extra distance past a level required to confirm a breakout; 0 means the close must simply exceed the level (default: 0)
• Signal Cooldown — Minimum bars between consecutive breakout signals (default: 15)
• Volume SMA Length — Volume filter period for breakout confirmation (default: 20)
• Show Fractal Dots — Toggle diamond markers on confirmed fractal pivots
• Show S/R Lines — Toggle the support and resistance level lines
• Line Extension — How many bars forward S/R lines extend beyond current price (default: 50)
• Show Info Table — Toggle the level statistics dashboard

🔶 ALERTS

• FBS Buy Signal — Fires on confirmed bullish breakout above resistance
• FBS Sell Signal — Fires on confirmed bearish breakout below support
• FBS Any Signal — Fires on any confirmed breakout
• FBS Fractal High — Fires when a new fractal high is confirmed
• FBS Fractal Low — Fires when a new fractal low is confirmed
• FBS Any Fractal — Fires on any new fractal formation
• FBS Volume Spike — Fires when volume exceeds its SMA
• FBS 20-Bar High — Fires when price makes a new 20-bar high
• FBS 20-Bar Low — Fires when price makes a new 20-bar low

🔶 LIMITATIONS & DISCLAIMER

• This is a technical analysis tool, not financial advice
• Past patterns do not guarantee future results
• Best used alongside price action context and proper risk management
• Fractal detection has an inherent lag equal to the right-bar count — the pivot is confirmed only after the right-side bars complete, so the fractal appears retroactively
• In strongly trending markets with few pullbacks, the indicator may generate fewer S/R levels because fractals form less frequently — this is a feature, not a bug, as it prevents plotting irrelevant levels in directional markets

Wyłączenie odpowiedzialności

Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.