OPEN-SOURCE SCRIPT
Zaktualizowano Flow-Regime

Flow-Regime
A multi-source flow oscillator. It normalizes three independent measures of
market flow to a unified ±100 scale and combines them into a conviction-
weighted composite line, so you can see at a glance whether OBV, A/D, and
price flow are agreeing or diverging.
▌ What's plotted
Three normalized lines, each computed through the same pipeline
(CCI → percentrank → linear map to ±100):
• OBV-Flow — On-Balance Volume (signed cumulative volume)
• AD-Flow — Chaikin Accumulation/Distribution
• Price-Regime — price flow (ohlc4)
Plus a Fitted composite — the average of the three, amplified by |conviction|,
where conviction = average ÷ mean(|x|, |y|, |z|). When all three lines agree
the composite is amplified; when they conflict it is suppressed toward zero.
The Fitted line uses 5-tier coloring driven by how many of the three exceed
the neutral threshold (default ±20): solid green/red = all three agree, lighter
shades = two of three, gray = no consensus.
▌ Two lookback modes
Linear (default) — TF-specific lookback with sensible per-timeframe defaults
(1m=60, 5m=24, 15m=16, 1h=24, 4h=18, 1d=7, 1w=12, 1M=12), all editable.
Anchored — pick an anchor timestamp; the percentrank window grows from 0 at
that bar to (current_bar − anchor_bar) at the right edge of the chart. Use
this to lock the statistical baseline to a specific event — a regime start,
a major breakout, a news release. The anchor bar is marked with a yellow
diamond at fitted = 0.
▌ How to read it
The OB zone (≥ +70) and OS zone (≤ −70) are shaded — these are statistically
stretched conditions. Bars where the Fitted line reaches ±99 get a soft red/
green background tint as an "at the extreme" warning. Two corresponding alert
conditions are exposed for use with TV alerts.
This indicator does NOT emit trade signals. Per-line reversal dots and
confluence triangles are intentionally absent: those patterns can fit
historical noise convincingly without generalizing forward. Treat extremes
as flags to investigate, not entries to take.
Useful interpretive frames:
• All three lines extreme in the same direction = strongest evidence of
flow consensus.
• One or two lines diverging from the others at extremes = a divergence
worth examining on the chart.
• Fitted approaching ±99 = statistical extreme, regardless of direction.
▌ Notes
In Anchored mode, the first few bars after the anchor have very few historical
points to rank against, so percentrank values can swing to ±100 from sparse
data — read these bars with caution. CCI itself always uses the full real
price history regardless of mode, so its 20-bar internal window is never
distorted by the anchor.
Enable the Debug label in settings to verify which mode and lookback are
currently active on the chart.
A multi-source flow oscillator. It normalizes three independent measures of
market flow to a unified ±100 scale and combines them into a conviction-
weighted composite line, so you can see at a glance whether OBV, A/D, and
price flow are agreeing or diverging.
▌ What's plotted
Three normalized lines, each computed through the same pipeline
(CCI → percentrank → linear map to ±100):
• OBV-Flow — On-Balance Volume (signed cumulative volume)
• AD-Flow — Chaikin Accumulation/Distribution
• Price-Regime — price flow (ohlc4)
Plus a Fitted composite — the average of the three, amplified by |conviction|,
where conviction = average ÷ mean(|x|, |y|, |z|). When all three lines agree
the composite is amplified; when they conflict it is suppressed toward zero.
The Fitted line uses 5-tier coloring driven by how many of the three exceed
the neutral threshold (default ±20): solid green/red = all three agree, lighter
shades = two of three, gray = no consensus.
▌ Two lookback modes
Linear (default) — TF-specific lookback with sensible per-timeframe defaults
(1m=60, 5m=24, 15m=16, 1h=24, 4h=18, 1d=7, 1w=12, 1M=12), all editable.
Anchored — pick an anchor timestamp; the percentrank window grows from 0 at
that bar to (current_bar − anchor_bar) at the right edge of the chart. Use
this to lock the statistical baseline to a specific event — a regime start,
a major breakout, a news release. The anchor bar is marked with a yellow
diamond at fitted = 0.
▌ How to read it
The OB zone (≥ +70) and OS zone (≤ −70) are shaded — these are statistically
stretched conditions. Bars where the Fitted line reaches ±99 get a soft red/
green background tint as an "at the extreme" warning. Two corresponding alert
conditions are exposed for use with TV alerts.
This indicator does NOT emit trade signals. Per-line reversal dots and
confluence triangles are intentionally absent: those patterns can fit
historical noise convincingly without generalizing forward. Treat extremes
as flags to investigate, not entries to take.
Useful interpretive frames:
• All three lines extreme in the same direction = strongest evidence of
flow consensus.
• One or two lines diverging from the others at extremes = a divergence
worth examining on the chart.
• Fitted approaching ±99 = statistical extreme, regardless of direction.
▌ Notes
In Anchored mode, the first few bars after the anchor have very few historical
points to rank against, so percentrank values can swing to ±100 from sparse
data — read these bars with caution. CCI itself always uses the full real
price history regardless of mode, so its 20-bar internal window is never
distorted by the anchor.
Enable the Debug label in settings to verify which mode and lookback are
currently active on the chart.
Informacje o Wersji
Bug FixesSkrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.