OPEN-SOURCE SCRIPT
Cycle & Flow Indicator - D_Quant

Cycle & Flow Architecture (CFA) | Multi-Factor Regime Analysis
Overview
The Cycle & Flow Architecture (CFA) is a trend-following visualization engine that utilizes a triple-confirmation "Voting Mechanism" to identify market regimes. Rather than relying on a single lagging indicator, the CFA aggregates Cyclical Momentum, Directional Bias, and Volume Flow from the Daily timeframe to provide a unified consensus signal on your current chart.
The goal of this script is to filter market noise by requiring a quantitative agreement between three non-correlated mathematical models before a "Regime Change" is visualized.
The Quantitative Logic
The core of the CFA is its Aggregation Engine, which calculates a normalized Quant Score ranging from -1.0 to +1.0. The engine polls three distinct components:
Schaff Trend Cycle (STC): This component identifies the cyclical nature of price. It applies a double-smoothed stochastic process to a MACD line. In this script, the STC contributes a bullish signal when the cycle is above 25 and a bearish signal when the cycle is below 75 and falling.
Parabolic SAR (PSAR):Used as a rigid directional filter. It calculates the "Stop and Reverse" points, if the price is above the PSAR, it contributes a +1 to the consensus, if below, a -1.
Ease of Movement (EOM): This is the volume-validation component. It analyzes the relationship between price change and volume. A positive EOM suggests price is moving up on light resistance (conviction), while negative EOM suggests easy downward movement.
How it Works: The Voting Mechanism
The script calculates these three values on the Daily (D) timeframe using request.security to ensure higher-timeframe confluence.
Bullish Regime: Triggered when the average score exceeds the Bullish Threshold (Default: 0.2).
Bearish Regime: Triggered when the average score falls below the Bearish Threshold (Default: -0.2).
Neutral Regime: When the components disagree or the scores hover near zero, the engine renders a "Grey" noise state, signaling a high-probability "sit on hands" environment.
How to Use
The Ghost Cloud: The central Hull Moving Average (HMA 20) acts as the baseline. The "cloud" fills between this baseline and the price, colored by the current Score.
Volatility Extensions: The script plots ATR-based bands (14-period) that only appear during confirmed regimes. In a Bullish regime, the upper band appears, in a Bearish regime, the lower.
Trade Execution: Traders typically look for the "Bullish/Bearish Start" alerts to signal the beginning of a new regime and use the "Grey" neutral zones to tighten stop-losses or exit positions.
Settings
Thresholds: Increase the Bullish/Bearish thresholds (e.g., to 0.5) to require more stringent agreement between the STC, PSAR, and EOM.
Timeframe Note: The calculations are hardcoded to the Daily timeframe to provide a "North Star" directional bias regardless of whether you are viewing the 15m or 4h chart.
Disclaimer: This tool is for educational and analytical purposes only. Quantitative models represent mathematical probabilities, not guarantees.
© D_QUANT
Overview
The Cycle & Flow Architecture (CFA) is a trend-following visualization engine that utilizes a triple-confirmation "Voting Mechanism" to identify market regimes. Rather than relying on a single lagging indicator, the CFA aggregates Cyclical Momentum, Directional Bias, and Volume Flow from the Daily timeframe to provide a unified consensus signal on your current chart.
The goal of this script is to filter market noise by requiring a quantitative agreement between three non-correlated mathematical models before a "Regime Change" is visualized.
The Quantitative Logic
The core of the CFA is its Aggregation Engine, which calculates a normalized Quant Score ranging from -1.0 to +1.0. The engine polls three distinct components:
Schaff Trend Cycle (STC): This component identifies the cyclical nature of price. It applies a double-smoothed stochastic process to a MACD line. In this script, the STC contributes a bullish signal when the cycle is above 25 and a bearish signal when the cycle is below 75 and falling.
Parabolic SAR (PSAR):Used as a rigid directional filter. It calculates the "Stop and Reverse" points, if the price is above the PSAR, it contributes a +1 to the consensus, if below, a -1.
Ease of Movement (EOM): This is the volume-validation component. It analyzes the relationship between price change and volume. A positive EOM suggests price is moving up on light resistance (conviction), while negative EOM suggests easy downward movement.
How it Works: The Voting Mechanism
The script calculates these three values on the Daily (D) timeframe using request.security to ensure higher-timeframe confluence.
Bullish Regime: Triggered when the average score exceeds the Bullish Threshold (Default: 0.2).
Bearish Regime: Triggered when the average score falls below the Bearish Threshold (Default: -0.2).
Neutral Regime: When the components disagree or the scores hover near zero, the engine renders a "Grey" noise state, signaling a high-probability "sit on hands" environment.
How to Use
The Ghost Cloud: The central Hull Moving Average (HMA 20) acts as the baseline. The "cloud" fills between this baseline and the price, colored by the current Score.
Volatility Extensions: The script plots ATR-based bands (14-period) that only appear during confirmed regimes. In a Bullish regime, the upper band appears, in a Bearish regime, the lower.
Trade Execution: Traders typically look for the "Bullish/Bearish Start" alerts to signal the beginning of a new regime and use the "Grey" neutral zones to tighten stop-losses or exit positions.
Settings
Thresholds: Increase the Bullish/Bearish thresholds (e.g., to 0.5) to require more stringent agreement between the STC, PSAR, and EOM.
Timeframe Note: The calculations are hardcoded to the Daily timeframe to provide a "North Star" directional bias regardless of whether you are viewing the 15m or 4h chart.
Disclaimer: This tool is for educational and analytical purposes only. Quantitative models represent mathematical probabilities, not guarantees.
© D_QUANT
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.
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.