OPEN-SOURCE SCRIPT
更新済 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.
リリースノート
Bug Fixesオープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。