MTF Confluence Gauge [JOAT]MTF Confluence Gauge
Introduction
One of the most persistent challenges in technical analysis is the problem of timeframe conflict. A setup that looks perfectly constructed on a 15-minute chart can be swimming against a powerful current on the 4-hour chart, while simultaneously aligned with the daily trend. Traders who operate on a single timeframe are making decisions without full awareness of the forces acting on the instrument across the full spectrum of market participants — from short-term speculators to institutional position traders whose horizons span weeks or months.
The MTF Confluence Gauge addresses this challenge by simultaneously reading the HEMA (Hull-EMA Hybrid) trend state of up to 5 configurable assets across 5 configurable timeframes — producing 25 individual trend readings. Each reading is a directional vote: +1 for bullish HEMA alignment, -1 for bearish alignment, 0 for neutral. These 25 votes are summed into a raw score ranging from -25 to +25, normalized to a -100 to +100 scale, and further refined by local market modifiers including a delta proxy, volume RSI, volatility squeeze state, and local HEMA trend. The result is a composite gauge that represents the aggregate directional consensus across assets and timeframes simultaneously.
This multi-asset capability makes the indicator unique even among multi-timeframe tools. Most MTF indicators read a single instrument across multiple timeframes. The MCG reads multiple instruments across multiple timeframes — enabling users to understand whether a bullish signal on their primary instrument is supported by correlated assets (e.g., sector ETFs, index futures, correlated crypto pairs) or is an isolated move that runs counter to the broader market ecosystem. A long signal supported by bullish readings across correlated assets and multiple timeframes is fundamentally different in quality from one that is isolated to a single timeframe of a single instrument.
Core Concepts
1. HEMA Trend Function for MTF Reads
The HEMA trend function is the foundational building block of every cell in the 5×5 matrix. For each asset-timeframe combination, request.security() retrieves the HEMA values on that timeframe, and the relative alignment of the fast, slow, and macro HEMA layers determines the trend vote. The lookahead parameter is explicitly set to barmerge.lookahead_off to ensure no future data contamination — the trend reading reflects only information that was available at the close of the most recent completed bar of the target timeframe.
f_hema(src, len) =>
ta.ema(2 * ta.ema(src, len / 2) - ta.ema(src, len), math.round(math.sqrt(len)))
f_mtfTrend(sym, tf) =>
h1 = request.security(sym, tf, f_hema(close, hFast), lookahead=barmerge.lookahead_off)
h2 = request.security(sym, tf, f_hema(close, hSlow), lookahead=barmerge.lookahead_off)
h3 = request.security(sym, tf, f_hema(close, hMacro), lookahead=barmerge.lookahead_off)
h1 > h2 and h2 > h3 ? 1 : h1 < h2 and h2 < h3 ? -1 : 0
This function is called 25 times — once per cell in the matrix. The result for each call is stored in a 5×5 array of integers and subsequently used for both the raw score calculation and the table cell coloring.
2. Raw Score and Normalization
The 25 individual trend votes are summed to produce a raw score. This sum is then smoothed with a 3-bar EMA to reduce single-bar noise. Normalization to the range is achieved by dividing the smoothed raw score by 25 (the maximum possible absolute value) and multiplying by 100.
rawScore = 0
for r = 0 to 4
for c = 0 to 4
rawScore += trendMatrix.get(r * 5 + c)
smoothedRaw = ta.ema(rawScore, 3)
normalizedScore = smoothedRaw / 25 * 100
The normalized score forms the base for the histogram and is displayed in the dashboard as the "MTF Bias" value. By normalizing against the theoretical maximum, the scale is consistent regardless of how many assets are configured as neutral (0 votes) — the maximum expressible bull consensus is always +100 and the maximum bear consensus is always -100.
3. Local Score Modifiers
The raw MTF score represents the multi-asset, multi-timeframe consensus, but it does not account for the specific conditions of the primary chart instrument at the current moment. Four local modifier calculations adjust the score based on immediate market context. The local HEMA trend applies a ±10 point bonus. The delta proxy (bar-range-based buying/selling pressure) applies a ±5 point bonus. Volume RSI above threshold applies a ±5 point bonus in the direction of the local trend. The volatility squeeze state applies a ±5 bonus when the market is not squeezing (i.e., volatility is freely expressing direction). All individual bonuses are summed and the combined total is clamped to the range.
localBonus = localTrend * 10
deltaBonus = deltaPos ? 5 : -5
volBonus = highVol ? (localTrend > 0 ? 5 : -5) : 0
sqzBonus = squeezing ? 0 : localTrend * 5
totalScore = math.max(-100, math.min(100, normalizedScore + localBonus + deltaBonus + volBonus + sqzBonus))
displayScore = ta.ema(totalScore, 5)
The final display score is a 5-bar EMA of the adjusted total, providing visual smoothness in the histogram while retaining the responsiveness of the underlying calculations. Local modifiers mean the gauge can show strong bull bias from MTF readings while still being dampened by bearish local conditions — a useful warning mechanism.
4. The 5×5 Color-Coded Table
The visual centerpiece of this indicator is the 5×5 table rendered in the oscillator pane. Each of the 25 cells represents one asset-timeframe combination. Bullish cells are filled with teal and display an upward arrow (▲). Bearish cells are filled with red and display a downward arrow (▼). Neutral cells are filled with violet and display a dash (—). Row 6 of the table shows the column-sum score for each timeframe column, giving an immediate vertical read of how strongly any given timeframe is leaning across all configured assets. This allows traders to identify whether bias is uniform across timeframes or concentrated in specific horizons.
5. Histogram, Squeeze Background, and Reference Lines
The composite score is rendered as a histogram with gradient fill — teal shades above zero transitioning toward deep teal at maximum bull readings, red shades below zero deepening toward maximum bear. Reference lines at ±25 define the "bias threshold" — readings beyond this level indicate a meaningful multi-timeframe lean. Reference lines at ±60 define the "strong conviction threshold" — readings here suggest near-uniform agreement across the majority of configured cells. When the local volatility squeeze is active (detected via ATR compression), the oscillator pane background tints violet, visually indicating that the current score may be elevated or depressed relative to its normal expression due to compressed price action.
Features
25-Cell MTF Matrix: 5 configurable assets × 5 configurable timeframes, each independently returning a HEMA trend vote.
lookahead_off Security Calls: All request.security() calls use barmerge.lookahead_off to prevent future bar data contamination.
Smoothed Normalization: Raw score EMA-smoothed then normalized to for consistent cross-session comparability.
Four Local Modifiers: Local HEMA trend, delta proxy, volume RSI, and squeeze state each contribute bonus points to produce a context-aware composite score.
5×5 Color-Coded Table: Teal/red/violet cells with directional arrows and column score totals for immediate visual matrix reading.
Gradient Histogram: color.from_gradient fill above and below zero with reference lines at ±25 (bias) and ±60 (strong conviction).
Squeeze Background Tint: Violet overlay on oscillator pane background when local volatility compression is detected.
Nine-Row Dashboard: MTF bias label (six levels from STRONG BULL to STRONG BEAR), composite score, raw MTF score, squeeze state, Pearson R, delta bias, volume RSI, and local trend.
Six Alert Conditions: Cross above +25, cross below -25, cross above +60, cross below -60, cross above 0, cross below 0.
Input Parameters
Asset Configuration:
Asset 1-5 Symbols: Ticker symbols for each of the five configurable assets (defaults: current symbol, SPY, QQQ, GLD, TLT or equivalents)
Timeframe Configuration:
TF1-TF5: Five timeframe strings for the matrix columns (defaults: "15", "60", "240", "D", "W")
HEMA Settings:
Fast Length: HEMA fast period for all MTF reads (default: 20)
Slow Length: HEMA slow period for all MTF reads (default: 50)
Macro Length: HEMA macro period for all MTF reads (default: 100)
Local Modifier Settings:
Delta Window: Smoothing period for delta proxy calculation (default: 10)
Volume RSI Threshold: Level above which volume is considered high (default: 65)
ATR Squeeze Length: Period for local volatility compression detection (default: 20)
Display Settings:
Show Table: Toggle the 5×5 trend matrix table (default: true)
Show Histogram: Toggle the composite score histogram (default: true)
Show Dashboard: Toggle the nine-row information table (default: true)
Show Squeeze Background: Toggle the violet compression tint (default: true)
How to Use This Indicator
Step 1: Configure Assets for Your Trading Context
The indicator's value scales directly with the relevance of the configured assets to your primary instrument. For equity traders, configuring sector ETFs correlated with the primary stock (e.g., XLK for technology stocks, XLF for financials) alongside index instruments (SPY, QQQ, DIA) creates a meaningful consensus gauge. For crypto traders, configuring BTC, ETH, and leading altcoins provides an ecosystem-wide directional read. For forex traders, related currency pairs and safe-haven instruments (gold, bonds) capture macro correlation. Spend time selecting assets whose price behavior is structurally linked to your primary trading instrument.
Step 2: Use the Table for Timeframe Structure Analysis
Before looking at the composite score, read the table column by column. If the shorter timeframe columns (15m, 1H) are predominantly teal (bullish) but the longer timeframe columns (Daily, Weekly) are predominantly red (bearish), the market is in short-term counter-trend bounce territory — a higher-risk environment for long trades. Conversely, when both short and long timeframe columns are aligned in the same direction, the consensus is clean and structural. The column score row at the bottom of the table quantifies this alignment numerically.
Step 3: Interpret the Composite Score Levels
The ±25 threshold is the first meaningful level. A score above +25 indicates that more than half of the 25 cells are bullish (adjusted for local modifiers), suggesting a genuine bias rather than random noise. Between +25 and +60, the market has a directional lean but lacks uniform agreement. Above +60, the consensus is strong — the majority of assets across the majority of timeframes are in bullish alignment. The inverse applies below -25 and -60. Cross-zero signals (score moving from negative to positive) indicate a shift in aggregate consensus, which is often a leading indicator of trend changes on the primary instrument.
Step 4: Monitor Local Modifier Impact
The dashboard displays both the raw MTF score and the composite adjusted score. The difference between these two values reflects the cumulative impact of local modifiers. A large positive difference means local conditions (delta, volume, squeeze, HEMA) are amplifying the MTF signal. A large negative difference means local conditions are dampening it — the MTF matrix shows bulls, but the primary instrument itself is not confirming. In these cases, patience is warranted before entering.
Indicator Limitations
The indicator makes 25 request.security() calls plus additional local calculations. On crowded chart setups with many other indicators, this computational load may affect chart loading time. TradingView enforces limits on request.security() calls per script; users should be aware of this limit if adding other indicators with security calls.
All 25 MTF trend readings update on the chart's native timeframe bars. Readings from higher timeframes update only when a new bar completes on that timeframe — the HEMA reading for a weekly timeframe, for instance, updates only at the weekly close. Between weekly closes, the weekly cell reading remains at the prior week's value.
HEMA calculations at very short periods on very high timeframes (e.g., period 20 on a Monthly timeframe) may have insufficient bars to produce statistically stable readings. Users should ensure the target instrument has sufficient history on all configured timeframes.
Asset correlation is dynamic — assets that are correlated in one market regime may decouple in another. A gauge configured for normal market correlation may produce misleading readings during crisis events when traditional correlations break down.
The local modifier adjustments (±10, ±5, ±5, ±5) are fixed contribution weights. They do not adapt to changing market conditions and may disproportionately influence the composite score during specific regimes.
The composite score is a simplified linear aggregation of heterogeneous signals. It treats a weekly HEMA reading as equivalent to a 15-minute HEMA reading in terms of contribution weight, which may not reflect the practical importance of longer timeframe trends.
Originality Statement
The MTF Confluence Gauge is an original multi-dimensional trend aggregation tool that differs meaningfully from existing multi-timeframe indicators.
The 5×5 asset-timeframe matrix — simultaneously reading five user-configurable assets (not just one instrument across five timeframes) across five user-configurable timeframes — is an original architectural choice that enables cross-asset consensus analysis not available in standard MTF indicators.
The HEMA-based trend vote function (requiring all three HEMA layers to be in sequence for a definitive +1 or -1 vote, otherwise returning 0) is a more stringent trend classification than simple moving average crossovers typically used in MTF dashboards.
The four-component local modifier system — HEMA bonus, delta proxy bonus, volume RSI bonus, and squeeze state bonus — applied as additive adjustments to the normalized MTF score before display is an original composite scoring architecture.
The six-level bias label system in the dashboard (STRONG BULL, BULL, SLIGHT BULL, SLIGHT BEAR, BEAR, STRONG BEAR) derived from the composite score threshold ranges provides a human-readable categorical summary not commonly implemented in MTF oscillators.
The visual integration of the 5×5 table within the oscillator pane (rather than as a separate overlay) alongside the gradient histogram, squeeze background tint, and reference lines at ±25 and ±60 represents a unified pane design not seen in comparable indicators.
Disclaimer
The MTF Confluence Gauge is provided for educational and informational purposes only. It is a technical analysis tool and does not constitute financial advice. Multi-timeframe and multi-asset confluence does not guarantee trade success. Correlation between assets changes over time and cannot be relied upon to remain stable. All trading involves risk of loss. Users are solely responsible for their own trading decisions. Please consider your individual risk tolerance and consult a licensed financial professional before engaging in any trading activity.
-Made with passion by officialjackofalltrades
Индикатор Pine Script®






















