OPEN-SOURCE SCRIPT
Aggiornato Swing Flow

Swing Flow is a market structure indicator designed to identify and trade with the prevailing trend by tracking swing highs and swing lows. Based on the principle that markets trending higher print higher highs and higher lows while markets trending lower print lower highs and lower lows, the indicator automatically detects these pivot points and classifies the current structure as Bullish, Bearish, Contracting, or Expanding. When structure is confirmed bullish, the indicator calculates an invalidation level set 2% below the most recent higher low, providing a logical stop placement where the bullish thesis would be negated if price trades through it.
A key feature is the Early Warning System, which alerts traders when price breaks above a prior swing high or below a prior swing low before the new pivot is officially confirmed. Because pivot detection requires several bars of confirmation, this early warning gives traders advance notice that structure may be shifting, allowing earlier entries with defined risk rather than waiting for lagging confirmation. When the early warning is active, the indicator displays the potential invalidation level and calculates the risk percentage from current price, helping traders assess whether the reward-to-risk ratio justifies an entry.
The indicator marks CME gold open times with vertical lines, highlighting the 6 PM ET session opens that often bring increased liquidity and directional moves. Sunday opens are marked with thicker yellow lines to distinguish the weekly open from regular daily session opens. This feature is particularly useful for gold traders using PAXG as a crypto proxy or GLD in traditional brokerage accounts, though the indicator works on any asset with swing structure.
The info table displays comprehensive market data including the current structure state, early warning status, last confirmed swing high and low with color coding to indicate whether each was higher or lower than its predecessor, the invalidation level and risk percentage, and buy zone status which activates when price approaches the higher low in bullish structure. Technical indicators include RSI with 5-zone color coding from oversold to overbought, ADX for trend strength, and directional movement indicators showing whether bulls or bears are dominant.
Open interest analysis provides insight into positioning and leverage in crypto markets, displaying OI score with conviction levels, sentiment classification based on OI and price movement relationships, buildup risk assessment combining OI elevation with ATR compression, and leverage pressure scoring that synthesizes multiple factors into a single actionable metric. The final row shows 1-hour and daily 24-period EMAs with green or red backgrounds indicating whether price is above or below each level, providing quick trend confirmation across timeframes.
The scoring bars at the top and bottom of the chart offer at-a-glance momentum and direction assessment. The RSI bar at top uses a 5-zone color scheme progressing from dark green in oversold territory through lime, white at neutral, pink, and maroon in overbought territory. The Directional bar at bottom combines the directional movement reading with ADX strength, displaying green tones when the bullish DI is dominant and red tones when bearish DI leads, with color intensity increasing as ADX indicates stronger trending conditions.
Swing Flow is designed for traders who want to align with market structure rather than fight it, entering positions near logical support levels with predefined invalidation points that keep losses small when wrong while allowing profits to run when the structure thesis proves correct. The combination of structure detection, early warning alerts, comprehensive market data, and visual scoring bars provides everything needed to identify high-probability setups and manage risk effectively.
A key feature is the Early Warning System, which alerts traders when price breaks above a prior swing high or below a prior swing low before the new pivot is officially confirmed. Because pivot detection requires several bars of confirmation, this early warning gives traders advance notice that structure may be shifting, allowing earlier entries with defined risk rather than waiting for lagging confirmation. When the early warning is active, the indicator displays the potential invalidation level and calculates the risk percentage from current price, helping traders assess whether the reward-to-risk ratio justifies an entry.
The indicator marks CME gold open times with vertical lines, highlighting the 6 PM ET session opens that often bring increased liquidity and directional moves. Sunday opens are marked with thicker yellow lines to distinguish the weekly open from regular daily session opens. This feature is particularly useful for gold traders using PAXG as a crypto proxy or GLD in traditional brokerage accounts, though the indicator works on any asset with swing structure.
The info table displays comprehensive market data including the current structure state, early warning status, last confirmed swing high and low with color coding to indicate whether each was higher or lower than its predecessor, the invalidation level and risk percentage, and buy zone status which activates when price approaches the higher low in bullish structure. Technical indicators include RSI with 5-zone color coding from oversold to overbought, ADX for trend strength, and directional movement indicators showing whether bulls or bears are dominant.
Open interest analysis provides insight into positioning and leverage in crypto markets, displaying OI score with conviction levels, sentiment classification based on OI and price movement relationships, buildup risk assessment combining OI elevation with ATR compression, and leverage pressure scoring that synthesizes multiple factors into a single actionable metric. The final row shows 1-hour and daily 24-period EMAs with green or red backgrounds indicating whether price is above or below each level, providing quick trend confirmation across timeframes.
The scoring bars at the top and bottom of the chart offer at-a-glance momentum and direction assessment. The RSI bar at top uses a 5-zone color scheme progressing from dark green in oversold territory through lime, white at neutral, pink, and maroon in overbought territory. The Directional bar at bottom combines the directional movement reading with ADX strength, displaying green tones when the bullish DI is dominant and red tones when bearish DI leads, with color intensity increasing as ADX indicates stronger trending conditions.
Swing Flow is designed for traders who want to align with market structure rather than fight it, entering positions near logical support levels with predefined invalidation points that keep losses small when wrong while allowing profits to run when the structure thesis proves correct. The combination of structure detection, early warning alerts, comprehensive market data, and visual scoring bars provides everything needed to identify high-probability setups and manage risk effectively.
Note di rilascio
cosmeticScript 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.
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.
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.