OPEN-SOURCE SCRIPT
Обновлено

MGI Walls | Rainbow Matrix

958
GENERAL OVERVIEW
The MGI Walls is a multi-timeframe institutional liquidity radar that extracts and renders the price zones where institutional capital concentrates: Volume Profile blocks (Point of Control, Value Area High, Value Area Low), Anchored VWAPs, and Parabolic SAR levels. Instead of showing these levels for a single chart timeframe, the indicator scans up to five macro timeframes simultaneously and merges overlapping zones into a single intensified block whenever multiple timeframes agree on the same price area.

The main goal of this indicator is to give traders a clean, automatic read on where the structural barriers in the market are — without having to manually flip between timeframes, mark POCs by hand, or guess which level the next reaction will respect. Every line, box, and confluence zone you see on the chart was extracted from real volume distribution data, not drawn manually.

It plots up to four level types per timeframe (POC, VAH, VAL, VWAP, SAR), each weighted by the structural significance of its timeframe — a Weekly POC carries five times the gravitational weight of a 15-minute POC. The Wall Fusion Engine then detects when levels from different timeframes fall within a configurable percentage threshold and consolidates them into a single block. The Nearest Wall HUD panel and the institutional collision alerts complete the toolkit.

This indicator was developed for traders who already understand Volume Profile and VWAP concepts and want to see them across multiple timeframes in a single visual, with automatic confluence detection.

снимок

WHAT IS THE THEORY BEHIND THIS INDICATOR?
Most Volume Profile indicators on TradingView — including the standard built-in profiles, Fixed Range Volume Profile, and the various session/visible-range derivatives — share a common architectural choice: they operate on a single timeframe. They show you the POC and Value Area for the current chart only. This treats each timeframe as an isolated decision space.

The problem: institutional flow is not isolated to one timeframe. The market makers operating on the daily horizon see different value areas than those operating on the weekly or 4-hour horizon. Their orders sit at their own POCs and Value Area boundaries. When price approaches a level that only one institutional horizon defends, the reaction is often modest. When price approaches a level that multiple horizons defend simultaneously, the reaction is structurally stronger — that confluence is where the largest pools of resting liquidity accumulate.

This indicator addresses that by performing the extraction across five user-configured timeframes simultaneously via `request.security()`, weighting each level by the gravitational significance of its parent timeframe, and then fusing levels from different timeframes that fall within a configurable margin. The math is standard Volume Profile (POC at the volume-weighted mode, VAH/VAL at the ±2.51σ boundary that approximates the 70% Value Area) — what makes it useful is doing it across five timeframes at once, with hierarchical weighting and confluence merging.

Why traders use it: each block represents an institutional decision zone. A standalone POC line from the 15-minute timeframe is a local reaction point. A POC line that simultaneously aligns with the 4-hour VAH and the daily VWAP is a multi-horizon barrier — a zone defended by three independent pools of institutional capital at once. The fusion engine makes these confluences immediately visible as thicker, more opaque blocks; the polarity of each block reflects the accumulated weight balance of the levels that compose it, not the polarity of the last level to be merged.

The three rendered components — Volume Profile zones, Anchored VWAPs, and Parabolic SAR levels — are not independent layers stacked on the same chart. They map three different aspects of institutional positioning at the same set of timeframes: where past volume concentrated (Volume Profile), where the live volume-weighted consensus price currently sits (VWAPs), and which directional trend regime each timeframe is in (SARs). The Wall Fusion Engine operates across all three layers indiscriminately — a POC from the 4-hour timeframe and a VWAP from the daily timeframe at the same price are fused into a single block, because from the perspective of institutional defense they represent the same structural barrier reinforced by two independent mechanisms. This integration is the reason the three components exist in a single script rather than as three separate indicators: the cross-layer fusion is what surfaces multi-mechanism confluence, which a separate-script approach cannot do.

MGI WALLS FEATURES

The indicator includes 6 main features:
Multi-Timeframe Volume Profile Engine
Anchored MTF VWAPs
Parabolic SAR Levels (MTF)
Wall Fusion Engine with Polarity-Balance Coloring
Nearest Wall HUD Panel
Institutional Collision Alerts

Multilingual interface and full customization across all visual layers.

MULTI-TIMEFRAME VOLUME PROFILE ENGINE
🔹 What It Does
The core of the indicator. For each of the five configured radar timeframes, the engine performs three operations:
◇ Locates the price level that received the highest traded volume in the lookback window — the Point of Control (POC).
◇ Computes the volume-weighted standard deviation of price around that POC.
◇ Builds the Value Area High (VAH) and Value Area Low (VAL) at a calibrated multiplier (±2.51σ) of that deviation, approximating the price range that contained 70% of the total volume.

The result is three institutional reference levels per timeframe — POC, VAH, VAL — extracted natively at the granularity of each timeframe rather than approximated from the current chart's data.

🔹 Method
The extraction runs via `request.security()` with `lookahead=barmerge.lookahead_off` to prevent repainting. The POC is identified as the volume-weighted mode within the lookback window. The Value Area boundaries are derived statistically from the volume-weighted variance of price around the POC, using a calibration factor (vp_k = 2.51) tuned to approximate the conventional 70% Value Area definition. Each level is plotted on the chart as a line or box at its native price location, color-coded by whether it sits above (resistance) or below (support) the current price, and weighted by the timeframe it originated from.

🔹 Hierarchical Weighting
The five timeframes are weighted by structural significance:
◇ TF1 (Micro, default 15m): weight 1 — local reaction point.
◇ TF2 (Intraday, default 1h): weight 1 — session-scale level.
◇ TF3 (Macro 1, default 4h): weight 2 — multi-session level.
◇ TF4 (Macro 2, default Daily): weight 3 — multi-day level.
◇ TF5 (Global, default Weekly): weight 5 — multi-week structural barrier.

The weight controls visual prominence (opacity, border thickness) and, when fusion occurs, the contribution of each level to the polarity balance of the resulting block.

ANCHORED MTF VWAPS
🔹 What It Does
For each of the five radar timeframes, an Anchored VWAP is extracted and rendered as a separate level. The Global VWAP — the average of all five — is also plotted, marked with a globe emoji to distinguish it from the per-timeframe VWAPs.

🔹 Method
The per-timeframe VWAP is computed via a volume-weighted moving average of hlc3 on the native bars of each timeframe, then reported back to the current chart through `request.security()`. The Global VWAP is the unweighted average of the five timeframe VWAPs that are currently available (NA values are skipped).

🔹 Why It Matters
The Volume Profile blocks tell you where past volume concentrated. The VWAPs tell you what the volume-weighted consensus price is for each horizon, updated bar by bar. Together they give a complete read on every bar: where the past institutional reference zones are (the blocks) and where the live volume-weighted average for each horizon currently sits (the VWAPs).

PARABOLIC SAR LEVELS (MTF)
🔹 What It Does
The Parabolic SAR for each of the five radar timeframes is extracted and rendered as an institutional trend-direction anchor. SAR levels are toggleable independently of the Volume Profile and VWAP layers.

🔹 Why It Matters
The SAR provides a directional trend reference per timeframe — when the Weekly SAR sits above price and the Daily SAR sits below, the structure is in conflict and the resolution of that conflict often drives the next swing. When multiple SARs align on the same side, the directional bias is structurally agreed across horizons.

WALL FUSION ENGINE WITH POLARITY-BALANCE COLORING
🔹 What It Does
When two or more levels from different timeframes fall within a configurable percentage threshold (default 0.30%), the engine fuses them into a single block. The fused block inherits the combined weight of all its components — visually thicker, more opaque, more visible than a standalone level. The label of the fused block accumulates the directional triangles of each contributing level (▲ for support, ▼ for resistance).

🔹 Polarity-Balance Coloring
The color of a fused block reflects the accumulated weight balance of its constituent levels — not the polarity of the last level to be merged. A block containing four resistance levels (▼▼▼▼) and two support levels (▲▲) will render red, because the resistance weight dominates. A block where support and resistance weights are equal uses a tiebreaker: the position of the current price relative to the block's midpoint. Price above midpoint resolves to support (green); price below resolves to resistance (red). This produces a coloring scheme that is internally consistent with the triangle labels and with the price's current location.

🔹 Customization
The Wall Merge Margin (%) input controls how aggressively levels are fused. Lower values produce many separate precise lines. Higher values produce massive consolidated institutional blocks. The default of 0.30% is calibrated for liquid instruments on intraday timeframes; for higher-volatility assets or higher timeframes, larger margins (0.50–1.00%) may produce more readable charts.

NEAREST WALL HUD PANEL
🔹 What It Shows
A compact corner panel reports four live values:
◇ RESISTANCE — the price of the nearest wall above the current price
◇ DIST. — the percentage distance from current price to that resistance
◇ SUPPORT — the price of the nearest wall below the current price
◇ DIST. — the percentage distance from current price to that support

The distances are computed against the midpoint of each fused block, so the values reflect the consolidated wall, not any single contributing level.

🔹 Why It Helps
The HUD removes the need to visually measure distances to the walls on every bar. It tells you in plain numerical form how far the nearest barriers are in each direction. Useful for stop placement, target placement, and live decision-making where the visual chart is busy with multiple levels.

🔹 Customization
The HUD can be positioned in any of the four chart corners and rendered in any of five font sizes. The display language is controlled by the System Language input.

snapshot

INSTITUTIONAL COLLISION ALERTS
🔹 What Triggers
Two alert types are available:
◇ VWAP Collision — fires when price crosses or touches the daily, weekly, or monthly VWAP within a 0.15% proximity band.
◇ Volume Profile Wall Hit — fires when price crosses or touches the Global POC, VAH, or VAL within the same proximity band.

🔹 How They Fire
Alerts are gated by `barstate.isconfirmed`, which means they only trigger on the close of the bar that touched the level — not intra-bar. This prevents false signals from wicks that get rejected before the bar closes. Each alert uses `alert.freq_once_per_bar`, ensuring no duplicate firings on the same candle.

🔹 alertcondition() Mode
For users who prefer the TradingView alert UI rather than the `alert()` function call, two `alertcondition` blocks are also exposed: "VWAP Collision" and "Volume Profile Wall Hit". A third dummy `alertcondition` titled "HOW TO SETUP ALERTS (READ)" provides setup guidance in the alert condition menu.

MULTILINGUAL INTERFACE
The indicator supports five languages for the HUD display and alert messages: English (default), Português, Español, Русский, and 中文 (Chinese). Code, comments, and configuration tooltips remain in English regardless of the selected language.

For reference, the English text of all multilingual UI strings used in the HUD and alerts:
◇ (SUPPORT) / (RESISTANCE) — appended to wall labels indicating polarity
◇ RESISTANCE: / SUPPORT: — HUD row labels for nearest walls
◇ DIST.: — HUD row label for distance percentage
◇ VWAP Collision Alert: "🛡️ [WALL] Price collided with Institutional VWAP. Defense zone active."
◇ Volume Profile Wall Alert: "🧱 [WALL] Price hit Macro Volume Profile zone (POC/VAH/VAL). Institutional decision imminent."

HOW TO USE
This indicator is not a signal generator. It is a structural map: it tells you where the institutional barriers are, how strong each one is (by weight and fusion), and how far the nearest one is in each direction.

🔹 Reading the Walls
◇ Each line or block on the chart marks an institutional decision zone.
◇ The triangles in the label (▲ or ▼) and their count indicate the polarity and weight of the level.
◇ Walls with multiple triangles in the same direction are stronger reaction points than single-triangle walls.
◇ A block with mixed triangles is a fused confluence — the color shows which side dominates by weight.

🔹 Reading the HUD
◇ The HUD reports the nearest resistance above and nearest support below the current price.
◇ The percentage distances help size stops and targets against the structural barriers rather than against arbitrary fixed values.

🔹 Tactical Reading
◇ Price approaching a heavy multi-triangle wall: zone of elevated structural significance, where multiple institutional horizons coincide.
◇ Price sitting between two close walls of opposite polarity: ranging structure, defined by two opposing barriers of comparable weight.
◇ Price breaking through a heavy wall on confirmed close: structural shift. The wall often inverts polarity on subsequent retests.
◇ VWAP collision alerts: useful as a contextual reference for mean-reversion or trend-continuation analysis.

🔹 Multi-Timeframe Reading
◇ On lower timeframes (1m, 5m, 15m), configure shorter radar timeframes to track intraday institutional flow.
◇ On higher timeframes (1h, 4h, daily), keep the default 15m/1h/4h/D/W configuration to read multi-day and multi-week structural zones.
◇ The Global VWAP and Global POC (marked with 🌎) represent the consensus across all five timeframes — the most structurally significant single reference.

INPUTS EXPLAINED
🔹 System Language
Display language for the HUD and alert messages. Options: English (default), Português, Español, Русский, 中文 (Chinese).

🔹 Radar Timeframes (TF1 to TF5)
Configure each of the five macro periods to scan. Defaults: 15m, 1h, 4h, Daily, Weekly. The shortest timeframe carries weight 1; the longest carries weight 5.

🔹 Show MTF VWAPs (Radar)
Toggle for the Volume-Weighted Average Price extracted from each radar timeframe.

🔹 Show POC Lines
Toggle for the Point of Control lines — the price level with the highest traded volume in each timeframe.

🔹 Show VA Boxes (VAH / VAL)
Toggle for the Value Area High and Value Area Low — the upper and lower boundaries of the 70% volume zone.

🔹 Show SAR Levels
Toggle for the Parabolic SAR levels from each timeframe.

🔹 Fuse Overlapping Walls
Toggle for the confluence merging engine. When enabled, levels from different timeframes that fall within the Wall Merge Margin are consolidated into a single intensified block.

🔹 Wall Merge Margin (%)
Distance threshold to fuse nearby walls. Range 0.01–3.00, default 0.30. Lower values produce separate precise lines; higher values produce consolidated institutional blocks.

🔹 Show Nearest Wall Panel
Toggle for the corner HUD reporting nearest resistance, nearest support, and the percentage distances.

🔹 Panel Position
Position of the HUD on the chart. Four corners available: Top Right (default), Top Left, Bottom Right, Bottom Left.

🔹 Font Size
HUD font size. Options: Tiny, Small (default), Normal, Large, Huge.

🔹 VWAP Collision Alert
Toggle for the alert that fires when price collides with the daily, weekly, or monthly VWAP.

🔹 Volume Profile Wall Alert (POC/VAH/VAL)
Toggle for the alert that fires when price touches the Global POC, VAH, or VAL.

IMPORTANT NOTES
The MGI Walls works on any timeframe. The default radar configuration (15m/1h/4h/D/W) is calibrated for intraday and swing trading on liquid instruments. For position trading or scalping, the radar timeframes can be reconfigured to scan longer or shorter horizons respectively.

The indicator works best on instruments with reliable volume data: crypto perpetual contracts, large-cap equities, futures, major forex pairs. On low-volume instruments, the Volume Profile component becomes less reliable, though the VWAP and SAR components continue to function correctly.

Alerts fire once per confirmed bar. Historical bars never repaint after they close. The live bar updates intra-bar as expected for a real-time indicator.

The Value Area calibration factor (vp_k = 2.51) is tuned to approximate the conventional 70% Value Area definition under volume-weighted standard deviation. It is a calibration constant derived from observation rather than an arbitrary choice.

Pine Script v6. Open-source under Mozilla Public License 2.0.

UNIQUENESS
The MGI Walls is unique in three ways. First, it performs the Volume Profile, VWAP, and SAR extraction across five timeframes simultaneously rather than on the current chart only, surfacing the institutional reference zones that multiple time horizons agree on rather than only those visible on the active timeframe. Second, it weights each level by the structural significance of its parent timeframe — a Weekly POC carries five times the gravitational weight of a 15-minute POC — and the Wall Fusion Engine consolidates levels from different timeframes that fall within a configurable margin into a single intensified block, making multi-horizon confluence zones immediately visible as visually thicker walls. Third, the fused-block coloring reflects the accumulated weight balance of all constituent levels rather than the polarity of the last level to be merged, producing a visual scheme that is internally consistent with the triangle labels (▲ for support, ▼ for resistance) and with the price's current position relative to the block. The combination of multi-timeframe simultaneous extraction, hierarchical weighting with automatic confluence fusion, and balance-driven block coloring produces a structural map that behaves differently from single-timeframe Volume Profile indicators, particularly at price zones where multiple institutional horizons converge and where the strongest reactions tend to occur.

PUBLICATION METADATA (handoff to operator — not part of description)

Title: MGI Walls | Rainbow Matrix
Visibility: Open-source / Public
Category suggestion: Volume-based (primary) — TradingView's category for Volume Profile / volume-driven indicators

Tag suggestions (TV allows up to 10; pick the 9 most relevant):
- volume-profile
- poc
- value-area
- vwap
- multi-timeframe
- mtf
- confluence
- institutional
- support-resistance
- parabolic-sar (optional, swap for one above if SAR is a key selling point)

License declaration: Mozilla Public License 2.0 (already in script header)

Screenshot slots in the description (5 "snapshot" placeholders):
1. After GENERAL OVERVIEW — wide chart showing the indicator running on BTC or major instrument, with walls visible across multiple TFs
2. After Multi-Timeframe Volume Profile Engine section — chart annotated with POC/VAH/VAL lines from different TFs
3. After Wall Fusion Engine section — close-up of a fused confluence block with mixed triangles (▲▼) and the polarity-balance color clearly visible
4. After Nearest Wall HUD Panel section — HUD close-up showing the 5-row layout with real values
5. (Optional, swap into one of the above slots) — Black Swan-style touch event showing a collision alert firing
Информация о релизе
Substantive update — new features, terminology refinements, and a compile-warning fix.

This release adds user-configurable colors for the walls, surfaces the Daily/Weekly/Monthly Anchored VWAPs as visible walls (previously alert-only), and corrects the naming of the rolling MTF references for clarity. The fusion engine, dominant-polarity color logic, and all math foundations remain 100% intact.

NEW FEATURES

- Customizable colors. A new "COLORS" group exposes two color pickers — one for support (walls below price) and one for resistance (walls above price). Defaults preserved (TradingView-native green and red). The dominant-polarity logic that selects the color for fused blocks now uses your chosen colors automatically.

- Anchored VWAPs (Daily / Weekly / Monthly) as visible walls. Previously these references were calculated only for the collision alert. Now they are drawn as walls and feed into the fusion engine alongside the MTF VWMAs and Volume Profile zones. A new toggle "Show Anchored VWAPs (Daily/Weekly/Monthly)" enables them. Weights: D=3, W=5, M=5.

TERMINOLOGY ALIGNMENT

- The 5 MTF Radar timeframe references are calculated as Volume-Weighted Moving Averages (rolling 60-period), not true Anchored VWAPs. Their labels, group name, and tooltips have been corrected to "VWMA" throughout the indicator.

- The cumulative Daily/Weekly/Monthly references that reset at session boundaries remain correctly labeled as Anchored VWAPs — they are the true session-anchored levels, and the existing "VWAP Collision Alert" continues to fire on them.

- Settings group renamed accordingly to "VWMA & ANCHORED VWAP REFERENCES" — now contains toggles for both reference types.

POLISH

- Tooltip coverage is now complete across all inputs.
- Minor comment cleanup for code readability.

BUG FIX

- Resolved a Pine v6 compile warning (CW10002) on the VWAP collision logic. The hit detection for the three Anchored VWAPs (D/W/M) was previously chained inline with `or`, which could short-circuit and skip historical-state updates in edge cases. Refactored to assign each detection to its own variable before combining — same pattern already used for POC/VAH/VAL.

PRESERVED INTACT

- Multi-timeframe fusion engine — wall convergence detection unchanged.
- Dominant-polarity color logic (v1.3) — fused block colors continue to follow the majority of triangle indicators, now using your chosen colors.
- Math foundations — VP constant (2.51), anti-abyss floor, all calculations preserved.
- Multilingual support — all 5 languages (EN/PT/ES/RU/ZH) intact.
- All existing alerts (VWAP Collision, Volume Profile Wall Hit) firing as before.

Отказ от ответственности

Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.