OPEN-SOURCE SCRIPT
System Core B Monthly Value + Weekly Regime

What this indicator does
This indicator builds a weekly “regime engine” around a manual monthly value area and then summarizes everything in a small on-chart dashboard.
It answers four questions:
Are we inside monthly value, near an edge, or trading outside it?
Is the weekly action rotating, compressing, or escaping away from value?
How has price moved inside the weekly range vs two weeks ago (up / down / flat)?
Are weekly range and volume “normal”, tight, or quiet relative to recent history?
You provide the monthly VAH / VAL once, and the script monitors how weekly bars behave around that zone.
Core logic
Monthly value area
You manually enter Monthly VAH (upper) and Monthly VAL (lower).
The script checks whether each weekly close is:
Outside above VAH
Outside below VAL
Inside but near VAH
Inside but near VAL
Inside and away from edges
A small “Location” label reports this as:
Outside Above VAH
Outside Below VAL
Inside (Near VAH)
Inside (Near VAL)
Inside Value
The “near” zone width is controlled by a percent buffer of the monthly value width.
Weekly range and volume stats
On the weekly timeframe the script calculates:
RangeRatio (RR) = weekly high–low divided by weekly ATR(14)
VolumeRatio (VR) = weekly volume divided by a volume SMA (configurable length)
It then counts over a recent window:
How many of the last 6 weeks had “normal” RR (between 0.6 and 1.1 × ATR).
How many of the last 4 weeks had tight RR (RR < 0.8).
How many of the last 4 weeks had quiet volume (VR ≤ 1.0).
How many of the last 6 weekly closes were inside monthly value.
These counts drive the regime classification and are also shown in the dashboard.
Regime classification
The regime engine is designed around three states:
Rotating (A – Rotating)
All 6 of the last 6 weekly closes are inside monthly value.
At least 4 of those 6 weeks have normal RR.
→ Typical “range / rotation around value” environment.
Compressing (A – Compressing)
Last 4 weekly closes all inside monthly value.
At least 3 of the last 4 weeks have tight RR.
At least 3 of the last 4 weeks have quiet volume.
→ Volatility contraction and quieter trade inside value.
Escaping (B – Escaping)
At most 3 of the last 6 weekly closes are still inside value.
Last 3 weekly closes are clustered in the top or bottom quartile of their ranges.
At least 1 recent week shows high RR (“impulse” move).
Current weekly close is progressing further in that direction vs two weeks ago.
→ Expansion / trend away from value.
Priority is: Escaping > Compressing > Rotating.
If monthly VAH/VAL are missing, regime is set to MISSING monthly VAH/VAL.
If none of the patterns fit cleanly, regime is labeled MIXED.
A separate “Progress vs 2w ago” tag reports:
Up vs 2w ago
Down vs 2w ago
Flat vs 2w ago
based on the position of the current weekly close within its range compared to two weeks prior.
Visuals
Lines
Optional Monthly VAH and Monthly VAL horizontal lines.
Background shading (optional)
If Shade background by regime is enabled and monthly values are present:
Compressing → blue tint
Escaping → orange tint
Rotating → green tint
Other / mixed → light gray tint
If the shading option is off or monthly VAH/VAL are missing, the background is not modified.
Dashboard table
A compact table (corner is configurable) shows:
Row 0: Weekly Regime – regime label (B Escaping / A Compressing / A Rotating / MIXED / missing)
Row 1: Location – monthly value location text (inside / near edge / outside)
Row 2: Progress – up / down / flat vs two weeks ago
Row 3: Inside (6w) – count of weeks inside value out of last 6
Row 4: RR Normal (6w) – count of “normal RR” weeks in last 6
Row 5: Tight/Quiet (4w) – string summary:
RR tight: X | Vol quiet: Y (counts over last 4 weeks)
Inputs
Monthly VAH / VAL (manual)
Monthly VAH (upper value)
Monthly VAL (lower value)
Show Monthly VAH / VAL (on/off)
Monthly buffer
Near-edge buffer (% of value width) – defines how close to VAH/VAL counts as “near”.
Weekly Regime Engine
Top percentile threshold (0..1) – default 0.75 (top quartile of weekly range)
Bottom percentile threshold (0..1) – default 0.25
Weekly volume SMA length – lookback for VR normalization
Shade background by regime – enable/disable colored background
Dashboard
Show dashboard – show/hide the table
Dashboard corner – Top Left / Top Right / Bottom Left / Bottom Right
How to use it
Set Monthly VAH / VAL for the current contract / product.
Watch the regime label + background color to know if weekly structure is:
Ranging around value
Compressing quietly inside value
Attempting to escape and trend away
Use Location and Inside Count to judge how anchored price still is to the monthly value area.
Use the RR / volume counts and Progress vs 2w ago to decide whether to treat current moves as range trades, breakout attempts, or fading candidates.
This is built to be a weekly “state of the environment” layer you can combine with your more granular entry tools.
This indicator builds a weekly “regime engine” around a manual monthly value area and then summarizes everything in a small on-chart dashboard.
It answers four questions:
Are we inside monthly value, near an edge, or trading outside it?
Is the weekly action rotating, compressing, or escaping away from value?
How has price moved inside the weekly range vs two weeks ago (up / down / flat)?
Are weekly range and volume “normal”, tight, or quiet relative to recent history?
You provide the monthly VAH / VAL once, and the script monitors how weekly bars behave around that zone.
Core logic
Monthly value area
You manually enter Monthly VAH (upper) and Monthly VAL (lower).
The script checks whether each weekly close is:
Outside above VAH
Outside below VAL
Inside but near VAH
Inside but near VAL
Inside and away from edges
A small “Location” label reports this as:
Outside Above VAH
Outside Below VAL
Inside (Near VAH)
Inside (Near VAL)
Inside Value
The “near” zone width is controlled by a percent buffer of the monthly value width.
Weekly range and volume stats
On the weekly timeframe the script calculates:
RangeRatio (RR) = weekly high–low divided by weekly ATR(14)
VolumeRatio (VR) = weekly volume divided by a volume SMA (configurable length)
It then counts over a recent window:
How many of the last 6 weeks had “normal” RR (between 0.6 and 1.1 × ATR).
How many of the last 4 weeks had tight RR (RR < 0.8).
How many of the last 4 weeks had quiet volume (VR ≤ 1.0).
How many of the last 6 weekly closes were inside monthly value.
These counts drive the regime classification and are also shown in the dashboard.
Regime classification
The regime engine is designed around three states:
Rotating (A – Rotating)
All 6 of the last 6 weekly closes are inside monthly value.
At least 4 of those 6 weeks have normal RR.
→ Typical “range / rotation around value” environment.
Compressing (A – Compressing)
Last 4 weekly closes all inside monthly value.
At least 3 of the last 4 weeks have tight RR.
At least 3 of the last 4 weeks have quiet volume.
→ Volatility contraction and quieter trade inside value.
Escaping (B – Escaping)
At most 3 of the last 6 weekly closes are still inside value.
Last 3 weekly closes are clustered in the top or bottom quartile of their ranges.
At least 1 recent week shows high RR (“impulse” move).
Current weekly close is progressing further in that direction vs two weeks ago.
→ Expansion / trend away from value.
Priority is: Escaping > Compressing > Rotating.
If monthly VAH/VAL are missing, regime is set to MISSING monthly VAH/VAL.
If none of the patterns fit cleanly, regime is labeled MIXED.
A separate “Progress vs 2w ago” tag reports:
Up vs 2w ago
Down vs 2w ago
Flat vs 2w ago
based on the position of the current weekly close within its range compared to two weeks prior.
Visuals
Lines
Optional Monthly VAH and Monthly VAL horizontal lines.
Background shading (optional)
If Shade background by regime is enabled and monthly values are present:
Compressing → blue tint
Escaping → orange tint
Rotating → green tint
Other / mixed → light gray tint
If the shading option is off or monthly VAH/VAL are missing, the background is not modified.
Dashboard table
A compact table (corner is configurable) shows:
Row 0: Weekly Regime – regime label (B Escaping / A Compressing / A Rotating / MIXED / missing)
Row 1: Location – monthly value location text (inside / near edge / outside)
Row 2: Progress – up / down / flat vs two weeks ago
Row 3: Inside (6w) – count of weeks inside value out of last 6
Row 4: RR Normal (6w) – count of “normal RR” weeks in last 6
Row 5: Tight/Quiet (4w) – string summary:
RR tight: X | Vol quiet: Y (counts over last 4 weeks)
Inputs
Monthly VAH / VAL (manual)
Monthly VAH (upper value)
Monthly VAL (lower value)
Show Monthly VAH / VAL (on/off)
Monthly buffer
Near-edge buffer (% of value width) – defines how close to VAH/VAL counts as “near”.
Weekly Regime Engine
Top percentile threshold (0..1) – default 0.75 (top quartile of weekly range)
Bottom percentile threshold (0..1) – default 0.25
Weekly volume SMA length – lookback for VR normalization
Shade background by regime – enable/disable colored background
Dashboard
Show dashboard – show/hide the table
Dashboard corner – Top Left / Top Right / Bottom Left / Bottom Right
How to use it
Set Monthly VAH / VAL for the current contract / product.
Watch the regime label + background color to know if weekly structure is:
Ranging around value
Compressing quietly inside value
Attempting to escape and trend away
Use Location and Inside Count to judge how anchored price still is to the monthly value area.
Use the RR / volume counts and Progress vs 2w ago to decide whether to treat current moves as range trades, breakout attempts, or fading candidates.
This is built to be a weekly “state of the environment” layer you can combine with your more granular entry tools.
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.
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.