OPEN-SOURCE SCRIPT
Updated

Filtered Fractals (2-Stage + Alerts)

6 268
Filtered Fractals [2-Stage Logic]
Overview
This indicator is an advanced evolution of the classic Fractal logic (like the WICK.ED or Bill Williams models). Standard fractals are often "noisy," marking every minor local peak or trough, which can lead to false signals in volatile markets.

This script solves the "noise" problem by introducing a Dual-Stage Filtering Process. Instead of displaying every fractal, it treats them as "candidates" and only confirms those that represent a dominant extremum relative to their neighboring fractals.

How It Works
The script operates in two distinct stages to ensure only the most significant structural pivot points are plotted:

Stage 1: Detection
The script identifies "Raw Fractals" based on your preferred sensitivity (Left/Right bars). By default, it uses a 5-bar lookback/lookforward, but these remain hidden from the chart initially.

Stage 2: Sliding Window Competition
The script monitors a rolling sequence of the last three identified fractals. It compares their prices to find the "True Extremum":
  • For Highs, it compares the 3 most recent fractal peaks.
  • For Lows, it compares the 3 most recent fractal troughs.
  • The Point System: Every time a fractal is the "winner" (the highest high or lowest low) within its 3-fractal window, it receives a confirmation point.
  • The Priority Rule: In cases where two fractals have the exact same price, the script gives priority to the earlier one (the "left" peak), reducing late entries.

Visual Confirmation
A fractal is only plotted on your chart once it achieves two confirmations. This means it has proven to be a significant price extreme compared to both its predecessor and its successor.

Key Features
  1. Noise Reduction: Eliminates "crowded" fractals, leaving only the structural backbone of the trend.
  2. Non-Repainting Logic: The script only processes confirmed closed bars. The current developing candle will never trigger a false fractal or a premature alert.
  3. Smart Alerts: Built-in alert() functionality. You can set a single alert to notify you the exact moment a Bullish or Bearish fractal is confirmed.
  4. Customizable Sensitivity: Adjust the Left/Right Bars in the settings to fit your specific timeframe (e.g., higher values for macro trends, lower for scalping).

How to use
  1. Support/Resistance: Use these filtered fractals to draw more reliable S/R zones.
  2. Stop Loss Placement: Ideal for trailing stops behind truly significant swing points.
  3. Trend Confirmation: A series of higher-high filtered fractals provides a much cleaner view of an uptrend than standard indicators.
Release Notes
Filtered Fractals [2-Stage Logic]
Overview
This indicator is an advanced evolution of the classic Fractal logic (like the WICK.ED or Bill Williams models). Standard fractals are often "noisy," marking every minor local peak or trough, which can lead to false signals in volatile markets.

This script solves the "noise" problem by introducing a Dual-Stage Filtering Process. Instead of displaying every fractal, it treats them as "candidates" and only confirms those that represent a dominant extremum relative to their neighboring fractals.

How It Works
The script operates in two distinct stages to ensure only the most significant structural pivot points are plotted:

Stage 1: Detection
The script identifies "Raw Fractals" based on your preferred sensitivity (Left/Right bars). By default, it uses a 5-bar lookback/lookforward, but these remain hidden from the chart initially.

Stage 2: Sliding Window Competition
The script monitors a rolling sequence of the last three identified fractals. It compares their prices to find the "True Extremum":
  • For Highs, it compares the 3 most recent fractal peaks.
  • For Lows, it compares the 3 most recent fractal troughs.
  • The Point System: Every time a fractal is the "winner" (the highest high or lowest low) within its 3-fractal window, it receives a confirmation point.
  • The Priority Rule: In cases where two fractals have the exact same price, the script gives priority to the earlier one (the "left" peak), reducing late entries.

Visual Confirmation
A fractal is only plotted on your chart once it achieves two confirmations. This means it has proven to be a significant price extreme compared to both its predecessor and its successor.

Key Features
  • Noise Reduction: Eliminates "crowded" fractals, leaving only the structural backbone of the trend.
  • Non-Repainting Logic: The script only processes confirmed closed bars. The current developing candle will never trigger a false fractal or a premature alert.
  • Smart Alerts: Built-in alert() functionality. You can set a single alert to notify you the exact moment a Bullish or Bearish fractal is confirmed.
  • Customizable Sensitivity: Adjust the Left/Right Bars in the settings to fit your specific timeframe (e.g., higher values for macro trends, lower for scalping).

How to use
  1. Support/Resistance: Use these filtered fractals to draw more reliable S/R zones.
  2. Trend Confirmation: A series of higher-high filtered fractals provides a much cleaner view of an uptrend than standard indicators.

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.