PROTECTED SOURCE SCRIPT
Swing Failure Pattern (SFP) with Alerts

Swing Failure Pattern (SFP) — Indicator Overview
Detects classic Swing Failure Patterns and their confirmations, with optional volume validation and EMA-based trend/reversal filters. Includes convenient alert categories.
1) What are SFPs?
* Price briefly breaks a prior swing high/low (liquidity grab), fails to continue, and snaps back inside the range — often a potential reversal from trapped breakout participants.
2) What the indicator plots
* SFP candle: wick extending beyond the previous swing (bearish above a swing high, bullish below a swing low).
* Opposite/confirmation level: dotted level derived from the opposite side of the swing structure.
* Confirmation: a later close beyond the opposite level; optional ▲/▼ triangles can appear with the “SFP” labels.
* Two moving averages: fast/slow MAs for context (plot type selectable); style (color/width) set in the Style tab.
3) Volume validation (optional)
* Uses a lower timeframe to compare the share of volume outside the swing level (wick area) against a threshold.
* None: Use when volume data is questionable (CFDs/FX) or when you want maximum SFP visibility and rely on price confirmation only.
* Volume outside swing < Threshold: Default for ranges/quiet phases. Idea: thin volume outside the level suggests a liquidity sweep rather than a true breakout. Start with 20–30%. Fewer but cleaner setups; works well near HTF zones (Daily/4H).
* Volume outside swing > Threshold: For news/volatility/capitulation spikes. Idea: heavy pressure beyond the level was absorbed (long wick) — strong reversals possible but more false signals. Start with 50–60%. Always wait for price confirmation.
* You can auto-select a lower timeframe or set one manually for the volume check.
4) EMA filter: Trend vs. Reversal
* Filtering uses EMAs of the chosen fast/slow lengths (independent of the plotted MA type).
* NO MA-Filter: no EMA condition; all SFPs allowed.
* Reversal Signal: bullish SFP only if fast EMA < slow EMA; bearish SFP only if fast EMA > slow EMA.
* Trend Follow: bullish SFP only if fast EMA > slow EMA; bearish SFP only if fast EMA < slow EMA.
* Tip: MA colors/widths are controlled in the Style tab; the EMA filter logic isn’t affected by the plotted MA type.
5) Alerts
* Multiple alert categories let you react to events like any bullish/bearish signal, SFP detected, and confirmation occurred — without listing each individual condition. Create an alert on the indicator and pick what fits your workflow.
Always trade without risk management.
Reminder: Backtest, align with HTF context and sessions, and use solid risk management.
Detects classic Swing Failure Patterns and their confirmations, with optional volume validation and EMA-based trend/reversal filters. Includes convenient alert categories.
1) What are SFPs?
* Price briefly breaks a prior swing high/low (liquidity grab), fails to continue, and snaps back inside the range — often a potential reversal from trapped breakout participants.
2) What the indicator plots
* SFP candle: wick extending beyond the previous swing (bearish above a swing high, bullish below a swing low).
* Opposite/confirmation level: dotted level derived from the opposite side of the swing structure.
* Confirmation: a later close beyond the opposite level; optional ▲/▼ triangles can appear with the “SFP” labels.
* Two moving averages: fast/slow MAs for context (plot type selectable); style (color/width) set in the Style tab.
3) Volume validation (optional)
* Uses a lower timeframe to compare the share of volume outside the swing level (wick area) against a threshold.
* None: Use when volume data is questionable (CFDs/FX) or when you want maximum SFP visibility and rely on price confirmation only.
* Volume outside swing < Threshold: Default for ranges/quiet phases. Idea: thin volume outside the level suggests a liquidity sweep rather than a true breakout. Start with 20–30%. Fewer but cleaner setups; works well near HTF zones (Daily/4H).
* Volume outside swing > Threshold: For news/volatility/capitulation spikes. Idea: heavy pressure beyond the level was absorbed (long wick) — strong reversals possible but more false signals. Start with 50–60%. Always wait for price confirmation.
* You can auto-select a lower timeframe or set one manually for the volume check.
4) EMA filter: Trend vs. Reversal
* Filtering uses EMAs of the chosen fast/slow lengths (independent of the plotted MA type).
* NO MA-Filter: no EMA condition; all SFPs allowed.
* Reversal Signal: bullish SFP only if fast EMA < slow EMA; bearish SFP only if fast EMA > slow EMA.
* Trend Follow: bullish SFP only if fast EMA > slow EMA; bearish SFP only if fast EMA < slow EMA.
* Tip: MA colors/widths are controlled in the Style tab; the EMA filter logic isn’t affected by the plotted MA type.
5) Alerts
* Multiple alert categories let you react to events like any bullish/bearish signal, SFP detected, and confirmation occurred — without listing each individual condition. Create an alert on the indicator and pick what fits your workflow.
Reminder: Backtest, align with HTF context and sessions, and use solid risk management.
Mã được bảo vệ
Tập lệnh này được đăng dưới dạng mã nguồn đóng. Tuy nhiên, bạn có thể tự do sử dụng tập lệnh mà không có bất kỳ hạn chế nào – tìm hiểu thêm tại đây.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.
Mã được bảo vệ
Tập lệnh này được đăng dưới dạng mã nguồn đóng. Tuy nhiên, bạn có thể tự do sử dụng tập lệnh mà không có bất kỳ hạn chế nào – tìm hiểu thêm tại đây.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.