OPEN-SOURCE SCRIPT
Momentum Regime & Confluence Engine

Momentum Regime & Confluence Engine is a Stochastic RSI–based momentum framework designed to display live momentum state, higher-timeframe regime context, and an optional pattern-projection timing overlay in a single indicator pane.
This script is intended for momentum structure and regime context, not as an automated strategy. It does not place trades and does not guarantee outcomes.
What This Script Displays
1) Live Stochastic RSI (%K / %D) — Current Chart Timeframe
The script computes a standard Stoch RSI on the active chart timeframe:
RSI is calculated from price
A stochastic transform is applied to RSI
%K is smoothed
%D is a further smoothing of %K
Live %K and %D are plotted in the pane with standard overbought/oversold reference levels (80/20).
2) Weekly Regime Background (Full Pane Shading)
A weekly Stoch RSI series is calculated using higher-timeframe data (request.security() with no lookahead).
The script classifies the weekly environment into Bull / Bear with an optional Neutral state.
To reduce rapid flip-flopping near crossovers, the weekly regime uses a hysteresis model based on the signed percentage distance between weekly %K and %D:
Enter thresholds require stronger separation to switch regimes
Exit thresholds allow a smaller move to transition out
Optional Neutral zone treats a small band around zero as neutral
The weekly regime is displayed as full-pane background shading.
3) Daily Regime Overlay (Secondary Shading)
A daily Stoch RSI series is also sampled via request.security() (no lookahead) and classified into Bull / Bear with an optional Neutral state.
Daily regime shading is drawn as a lighter overlay on top of the weekly background to make daily-vs-weekly alignment visually apparent.
4) Weekly Context Tag (Optional)
An optional small table “W Context” tag can be displayed in a selectable corner.
It shows the current weekly regime state (Bull / Bear / Neutral) so higher-timeframe context remains visible even when focusing on live oscillator movement.
5) Forward Projection of a Historical Stoch RSI Pattern (Optional)
A projection feature can sample a historical Stoch RSI pattern (%K and %D) from a user-defined bars-back window and shift that pattern forward in time.
Optional normalization can rescale the sampled pattern to the recent observed range for visual comparability.
This projection is a pattern-visualization and timing-reference tool, not a prediction engine.
6) Projected Cross Markers (Optional)
When projection is enabled, the script can identify projected cross events inside the projected pattern:
vertical dotted timing markers in the pane
small arrows at the approximate projected cross level
an optional single “Projected Cross” balloon for the nearest upcoming projected cross
These markers are intended as timing reference points, not trade signals.
Alert System (Optional)
The script includes alert conditions for weekly and daily momentum events, including:
Confirmed bullish crosses (%K crossing above %D), optionally restricted to fully formed bars (daily/weekly close)
Imminent bullish cross conditions, based on proximity and slope behavior (approaching crossover logic)
Alignment alerts, where daily events can be filtered to trigger only when a bullish weekly context exists
Dual confirmed alerts when weekly and daily confirmed crosses occur together
Alerts report that a defined condition occurred; they do not imply trade execution or performance.
Chart Setup Notes
The projection feature samples historical data and plots forward graphics. For best accuracy, ensure the chart has fully loaded available history before interpreting projected timing markers.
On symbols or sessions with limited historical data, the sampled pattern window may be incomplete and can shift projected timing features.
Notes and Limitations
Regime shading is a momentum classification based on Stoch RSI relationships; it is not a guarantee of trend continuation or reversal.
Projection is a visual clone of a selected historical pattern and may not repeat.
Alerts indicate that configured conditions occurred; they are not buy/sell commands.
This script is provided for informational and educational purposes only and does not constitute financial advice.
This script is intended for momentum structure and regime context, not as an automated strategy. It does not place trades and does not guarantee outcomes.
What This Script Displays
1) Live Stochastic RSI (%K / %D) — Current Chart Timeframe
The script computes a standard Stoch RSI on the active chart timeframe:
RSI is calculated from price
A stochastic transform is applied to RSI
%K is smoothed
%D is a further smoothing of %K
Live %K and %D are plotted in the pane with standard overbought/oversold reference levels (80/20).
2) Weekly Regime Background (Full Pane Shading)
A weekly Stoch RSI series is calculated using higher-timeframe data (request.security() with no lookahead).
The script classifies the weekly environment into Bull / Bear with an optional Neutral state.
To reduce rapid flip-flopping near crossovers, the weekly regime uses a hysteresis model based on the signed percentage distance between weekly %K and %D:
Enter thresholds require stronger separation to switch regimes
Exit thresholds allow a smaller move to transition out
Optional Neutral zone treats a small band around zero as neutral
The weekly regime is displayed as full-pane background shading.
3) Daily Regime Overlay (Secondary Shading)
A daily Stoch RSI series is also sampled via request.security() (no lookahead) and classified into Bull / Bear with an optional Neutral state.
Daily regime shading is drawn as a lighter overlay on top of the weekly background to make daily-vs-weekly alignment visually apparent.
4) Weekly Context Tag (Optional)
An optional small table “W Context” tag can be displayed in a selectable corner.
It shows the current weekly regime state (Bull / Bear / Neutral) so higher-timeframe context remains visible even when focusing on live oscillator movement.
5) Forward Projection of a Historical Stoch RSI Pattern (Optional)
A projection feature can sample a historical Stoch RSI pattern (%K and %D) from a user-defined bars-back window and shift that pattern forward in time.
Optional normalization can rescale the sampled pattern to the recent observed range for visual comparability.
This projection is a pattern-visualization and timing-reference tool, not a prediction engine.
6) Projected Cross Markers (Optional)
When projection is enabled, the script can identify projected cross events inside the projected pattern:
vertical dotted timing markers in the pane
small arrows at the approximate projected cross level
an optional single “Projected Cross” balloon for the nearest upcoming projected cross
These markers are intended as timing reference points, not trade signals.
Alert System (Optional)
The script includes alert conditions for weekly and daily momentum events, including:
Confirmed bullish crosses (%K crossing above %D), optionally restricted to fully formed bars (daily/weekly close)
Imminent bullish cross conditions, based on proximity and slope behavior (approaching crossover logic)
Alignment alerts, where daily events can be filtered to trigger only when a bullish weekly context exists
Dual confirmed alerts when weekly and daily confirmed crosses occur together
Alerts report that a defined condition occurred; they do not imply trade execution or performance.
Chart Setup Notes
The projection feature samples historical data and plots forward graphics. For best accuracy, ensure the chart has fully loaded available history before interpreting projected timing markers.
On symbols or sessions with limited historical data, the sampled pattern window may be incomplete and can shift projected timing features.
Notes and Limitations
Regime shading is a momentum classification based on Stoch RSI relationships; it is not a guarantee of trend continuation or reversal.
Projection is a visual clone of a selected historical pattern and may not repeat.
Alerts indicate that configured conditions occurred; they are not buy/sell commands.
This script is provided for informational and educational purposes only and does not constitute financial advice.
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.