OPEN-SOURCE SCRIPT
Aggiornato Swing Failure Signals [AlgoAlpha]

đźź OVERVIEW
This script detects swing failure patterns by tracking how price interacts with recent swing highs and lows, then confirming those sweeps with a change in candle behavior. The goal is to highlight areas where price briefly breaks a key level, fails to continue, and then shifts direction. These events often occur around liquidity runs, where stops are triggered before price reverses. The script draws levels, colors bars, and prints clear markers to help visualize where these failures occur and when they are confirmed.
đźź CONCEPTS
The logic starts with pivot-based swing detection. Recent swing highs and lows are stored and monitored. When price trades beyond one of these levels within a defined historical window, it is treated as a sweep. A sweep alone is not enough. The script then waits for a Change in State of Delivery (CISD), which is defined by a shift in candle structure that shows follow-through in the opposite direction. A tolerance filter measures how far price traveled beyond the level relative to the reaction that followed. If the reaction is strong enough and happens within a limited number of bars, the sweep is validated as a swing failure. In short: the swing defines the reference, the sweep shows intent, and the CISD confirms acceptance or rejection.
đźź FEATURES
đźź USAGE
This script detects swing failure patterns by tracking how price interacts with recent swing highs and lows, then confirming those sweeps with a change in candle behavior. The goal is to highlight areas where price briefly breaks a key level, fails to continue, and then shifts direction. These events often occur around liquidity runs, where stops are triggered before price reverses. The script draws levels, colors bars, and prints clear markers to help visualize where these failures occur and when they are confirmed.
đźź CONCEPTS
The logic starts with pivot-based swing detection. Recent swing highs and lows are stored and monitored. When price trades beyond one of these levels within a defined historical window, it is treated as a sweep. A sweep alone is not enough. The script then waits for a Change in State of Delivery (CISD), which is defined by a shift in candle structure that shows follow-through in the opposite direction. A tolerance filter measures how far price traveled beyond the level relative to the reaction that followed. If the reaction is strong enough and happens within a limited number of bars, the sweep is validated as a swing failure. In short: the swing defines the reference, the sweep shows intent, and the CISD confirms acceptance or rejection.
đźź FEATURES
- Sweep detection with a maximum lookback to avoid outdated levels
- CISD confirmation using candle structure and price expansion
- Alert conditions for bullish and bearish swing failures
đźź USAGE
- Setup: Add the script to your chart. It works on any market and timeframe. Lower timeframes highlight intraday liquidity runs, while higher timeframes show structural failures. Start with the default inputs before adjusting.
- Read the chart: A bullish swing failure occurs when price sweeps a prior low, then reverses and confirms with a bullish CISD. A bearish swing failure is the opposite, sweeping a prior high and confirming with a bearish CISD. Dashed lines mark the swept swing. Solid lines mark the CISD level. Bars are colored while the SFP state is active.
- Settings that matter: Increasing Pivot Detection Length finds more significant swings but fewer signals. Reducing Max Pivot Point Edge limits how far back sweeps are allowed, keeping signals more current. The Patience setting controls how many bars are allowed for confirmation after a sweep. The Trend Noise Filter raises or lowers how strong the reaction must be to qualify as a valid failure.
Note di rilascio
ThumbnailScript open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità . Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
🚨Get premium (50% OFF DISCOUNT EXPIRES SOON): algoalpha.io
🛜Get FREE signals: discord.gg/xCmqTVRexz
đź’ˇTutorials: youtube.com/@AlgoAlpha
🛜Get FREE signals: discord.gg/xCmqTVRexz
đź’ˇTutorials: youtube.com/@AlgoAlpha
Declinazione di responsabilitĂ
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità . Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
🚨Get premium (50% OFF DISCOUNT EXPIRES SOON): algoalpha.io
🛜Get FREE signals: discord.gg/xCmqTVRexz
đź’ˇTutorials: youtube.com/@AlgoAlpha
🛜Get FREE signals: discord.gg/xCmqTVRexz
đź’ˇTutorials: youtube.com/@AlgoAlpha
Declinazione di responsabilitĂ
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.