OPEN-SOURCE SCRIPT
Actualizado

Confluence S/R Engine - MTF Strength Map

596
## Confluence S/R Engine - MTF Strength Map

An open-source, multi-method support and resistance zone engine that scores price areas by the agreement of independent structural, volumetric and timeframe-based signals.

---

### Why this script exists (mashup justification)

Most retail support and resistance tools use one method - pivots, or VWAP, or a volume profile POC, or Fibonacci bands. Each works in some conditions and fails in others. A pivot may have no volume behind it; a POC may sit in dead air with no structural confirmation; a Fibonacci band may coincide with nothing.

The premise of this engine is simple: a price level identified independently by several different methods, across several different timeframes, is more meaningful than the same price identified by only one method. This is the confluence principle, written formally.

To make that principle usable, this script does four things a simple mashup cannot:

1. Collects 12 different method types in one pass. Each method places a vote at a price level with an associated weight, method-type tag, and timeframe tag.
2. Clusters nearby votes within a configurable distance in ATR units, so a POC at 23,510, a swing low at 23,505 and an HTF pivot at 23,512 are treated as one zone, not three.
3. Scores each cluster on five dimensions (level quality, method diversity, timeframe diversity, recency, tightness) into a single 0-10 composite, with a small bonus when an absorption candle is also present.
4. Exports the resulting zones as numerical signals downstream Pine scripts can read as input sources, so this engine can act as a reference layer for any other strategy or visualisation you build.

The components are not just plotted side by side. They are fused. The cluster step is what justifies combining them, because clustering only adds value when you have multiple independent inputs to cluster. A single-method version of this script would not produce the same output, because the score is, by construction, a function of how many independent methods agree.

---

### What this version adds

A small set of additions tighten signal quality and make the engine more honest about its own behaviour:

- Multi-window volume consensus. The absorption-bonus (+0.5) and naked POC creation now require volume to exceed a percentile across three lookback windows using a majority-vote rule. This prevents a single-window volume spike during a regime transition from inflating a zone's score.
- Hawkes pre-kill warning. A self-exciting point process detects volatility clustering. Each bar whose absolute return exceeds about 2 standard deviations raises an intensity which decays each bar. When intensity exceeds the warning multiple of its baseline (default 3.0x), the engine flags the regime row to "DGR vol" and raises the show-threshold for new zones, so during volatility clusters the chart shows only top-tier confluence.
- Calibration tracker (descriptive only, optional panel off by default). Every qualifying zone is logged at formation. After a configurable horizon (default 10 bars), the engine checks whether price moved by at least 0.5 x ATR in the expected direction. Users who want to see the engine's measured hit-rate by score tier can turn the panel on; the tracker itself runs regardless, so EXP_* plots stay populated for downstream scripts. Past data, not a backtest, prediction, or advice.
- Compact 5-row snapshot panel. The on-chart panel shows only what a trader actually needs: top zone, bias, nearest levels (S below and R above with ATR distance), regime (zones + fortress count + health code combined), and asset. No statistics in the main panel.

---

### The 12 methods (organised by weight tier)

- Tier A (heaviest, weight 2.5): Anchored Volume Profile POC, naked (untested) historical POCs, Tier-1 anchor candle highs and lows, absorption candle highs/lows/closes, per-HTF volume-bucketed POCs.
- Tier B (weight 2.0): Value Area High and Low, recent native-timeframe swing pivots, Anchored VWAP, Fibonacci 0.618 bands.
- Tier C (weight 1.5, with HTF multiplier): Multi-timeframe pivots, so a Daily pivot weighs more than a 1-hour pivot.
- Tier D (weight 1.0): Anchored VWAP +/-1 sigma bands, Fibonacci 0.382 bands, prior swing levels.
- Tier E (lightest, weight 0.5): Anchored VWAP +/-2 sigma bands, Fibonacci 1.0 bands, HTF closes.

The anchor used by AVWAP, the volume profile and the Fibonacci bands is the most recent Tier-1 anchor candle - a candle that, by configurable percentile thresholds across three lookback windows, shows both unusually high volume and unusually wide range. This means the AVWAP and profile reset onto a new participation node rather than running indefinitely from a fixed session start.

---

### The 5-dimension scoring rubric

Each cluster scores as the sum of:

- Level quality (max 3.0) - based on the highest tier of any method in the cluster.
- Method diversity (max 2.5) - more independent method types in the cluster scores higher than the same type appearing multiple times.
- Timeframe diversity (max 2.0) - methods from more distinct timeframes (native + HTF1..HTF4) score higher.
- Recency (max 1.5) - recent methods score higher than ones from long ago.
- Tightness (max 1.0) - clusters whose constituent prices sit within a narrow ATR band score higher than wide, sloppy clusters.

Plus a +0.5 absorption bonus if an absorption candle (high volume, narrow range, mid-bar close) is part of the cluster. Total is capped at 10.

A "fortress" zone is simply a cluster whose composite score is at or above the user's fortress threshold (default 8.0). The word is a label for a high-score zone - it is not a claim about future price behaviour.

---

### How to read the chart

- Green band - support zone (cluster centre below current price).
- Red band - resistance zone (cluster centre above current price).
- Yellow-green band - support whose score is at or above the fortress threshold.
- Yellow-orange band - resistance whose score is at or above the fortress threshold.
- Bolder, more opaque band - higher composite score.
- Star glyph on the label - fortress-grade zone.
- Dot glyph on the label - cluster contains at least one absorption candle.
- Triangle up/down - currently acting as support / resistance.
- "S 8.6 (5m)" - score 8.6, built from 5 distinct method types.

The snapshot panel (top-right by default, position configurable) is a compact 5-row table showing only decision-grade information:

1. **Top Zone** - the single highest-scoring zone (price, score, direction, fortress flag).
2. **Bias** - POC imbalance state (bullish / bearish / neutral with the buy-volume percentage).
3. **Levels** - nearest support below + nearest resistance above, with distance in ATR units. Answers "what should I watch right now?" in one line.
4. **Regime** - zones count, fortress count, and data-health code in one row. Health reads "OK" if all sources are valid, "DGR" if degraded, "DGR vol" if the Hawkes warning is active, "CRIT" if no volume.
5. **Asset** - auto-detected class (Equity / Futures / Index / FX / CFD / Crypto) plus symbol.

An optional **calibration panel** can be turned on in the input group. When enabled, it shows in a separate small table the engine's measured hit-rate by score tier (4-star, 5-star, fortress, all zones) with sample size N, Wilson 95% confidence interval, and a live tracker status. Off by default to keep the chart clean. Past-only descriptive data - not a backtest, not a prediction.

---

### How to use it (intended use)

This is a decision-support and context layer. It is meant to be combined with your own entry and exit logic, your own risk management, and your own discretion.

Suggested workflows:

- As a context filter. Look at price relative to the nearest support and resistance zones before taking a setup from your usual system. Trades into a strong opposing zone are higher risk; trades away from one are lower risk.
- As a structural map. When price approaches a fortress-grade zone, expect a reaction is more likely than at a low-score zone. The reaction can be a bounce, a break, or a long consolidation - the engine does not predict which.
- As an input for other Pine scripts. Attach this engine to your chart, then in any downstream indicator or strategy you build, use input.source() to pick any of the visible plots (POC, VAH, VAL, AVWAP, sigma bands, Fib bands, HTF1-4 POCs) or any of the 28 hidden EXP_* data-window outputs as a real-time reference for your logic.
- For multi-timeframe alignment. Turn on multiple HTFs (default 60m, 4h, Daily, optionally Weekly). When zones cluster across HTF and native pivots, the score reflects that automatically.

---

### How not to use it

- Do not treat any zone as a buy or sell signal. A high-score zone is a likely reaction area; it does not tell you which direction price will go next.
- Do not use it as a standalone strategy. This engine has no entry rules, no stop rules, no position-sizing and no exit logic. It is a map, not a plan.
- Do not assume the score is a probability. It is a composite of structural evidence, not a calibrated statistical model.
- Do not rely on it alone on volumeless symbols (e.g. some spot indices). On instruments without true volume the engine auto-downgrades - the data-health row will tell you when this is the case. POC, VAH, VAL and AVWAP-based methods are weaker without volume.
- Do not back-test it as a strategy. It is an indicator and is published as such; the engine does not place trades.

---

### Key settings you might want to adjust

- Detection mode: "Percentile + Consensus" (default) is more robust; "Legacy" matches older volume x average rules if you prefer simple thresholds.
- Min strength to display: raise (e.g. 6.0) to see only the strongest zones; lower (e.g. 2.0) to see everything.
- Fortress threshold: controls when the special highlight colour appears (default 8.0).
- Auto-scale lookbacks: leave ON so the same defaults work from 1-minute intraday to 1-week swing charts. The reference timeframe is 15 minutes; everything scales from there.
- HTF1..HTF4: pick the higher timeframes meaningful to your style. Defaults are 1h, 4h, Daily and (optional) Weekly.
- Min directional ratio for bias: controls how lopsided LTF flow must be to flip the bias to bullish or bearish.
- Multi-window volume consensus: leave ON to gate the absorption bonus and naked POC creation on majority agreement across three lookback windows.
- Hawkes pre-kill: leave ON to suppress lower-score zones during volatility clusters. Default warning threshold is 3.0x baseline (less sensitive than v3.2 to avoid over-suppression on higher timeframes). Lower it for stricter behaviour, raise it to mute the filter further.
- Calibration tracker: ON by default for logging, but the panel itself is OFF by default to keep the chart clean. Turn on "Show calibration panel on chart" if you want to see the hit-rate breakdown. Horizon (default 10 bars) is how far forward each zone is followed; the minimum-move threshold (default 0.5 x ATR) is what counts as the zone being respected.

---

### Limitations you should know

- Volume dependency. Several methods (POC, VAH, VAL, AVWAP, absorption, naked POC, HTF POCs) require valid volume. On spot indices and some FX symbols there is no true volume; the data-health row will show "Degraded" or "Critical" and the engine will lean on range-based methods only.
- Anchor recency. The engine reuses the most recent Tier-1 anchor candle. If no anchor has formed in a long quiet period, the AVWAP/profile-based methods are stale and their contribution to the score falls off via the recency dimension.
- HTF latency. Higher-timeframe data only updates when each HTF closes. Until the first HTF close has occurred since chart load, HTF-based methods may show "off" in the data-health detail.
- Pivot lag is structural. Pivot detection requires pivotLen bars on each side, which means the most recent swing pivots can only be confirmed pivotLen bars after the actual high or low. This is structural, not a script bug.
- Last-bar drawing. Zone boxes redraw on the last bar each time. This is intentional - the engine shows the current zone map, not a historical map of past zones.
- Calibration is descriptive only. The optional panel reports past outcomes using a fixed rule (move of at least 0.5 x ATR within N bars). It is not a backtest, prediction, or strategy result, and does not include costs or slippage.
- Hawkes warning is a suppression layer, not a market call. When the engine enters the pre-kill state, it raises the show-threshold by 1.5 (capped at the fortress level) until volatility intensity returns to baseline. Risk control, not a "market is about to reverse" signal.
- Not a strategy. No trades, no equity curve, no backtest.

---

### Alerts (10 included)

01 Tier-1 anchor formed. 02 Absorption anchor formed. 03 Price crossed POC. 04 Price crossed VA edge. 05 Price entered top zone. 06 Price broke top zone. 07 Fortress zone interaction. 08 POC bias flipped. 09 Nearest S/R crossed. 10 Data health changed. All alerts use barstate.isconfirmed so they do not repaint.

---

### Outputs for downstream scripts

In addition to the visible chart plots, the engine exposes hidden EXP_* series (visible in the Data Window) so other Pine scripts can read its state. These cover the top zones (price, score, direction, fortress flag), the synthesised top-zone summary, POC bias and buy-ratio, nearest support and resistance prices and their ATR distances, fortress count, and event pulses (zone entered, zone broken, bias flipped, data-health changed, Tier-1 anchor formed).

To use them from another script of your own: attach this engine to the chart, then in your downstream script create an input.source(close, "S/R source") field and select any EXP_* series from the dropdown.

---

### Chart, symbol and timeframe (for clarity)

The publication chart shows this engine running on its own, with no other indicators or drawings present. The chart watermark shows the symbol and timeframe at the top of the chart. The engine's own snapshot table (top-right) additionally displays the detected asset class and the active ticker, so users can confirm what they are looking at.

---

### Disclaimer

This script is published for educational and informational purposes only. It is not investment advice, not a recommendation to buy, sell or hold any instrument, and not a solicitation to trade. Past behaviour of any pattern, level, signal or zone shown by this script does not guarantee future results. Trading involves substantial risk of loss and may not be suitable for every investor. You alone are responsible for your trading decisions, position sizing, risk management and capital. Before committing real money, please do your own research and consider speaking with a qualified, locally-licensed financial professional.

The optional calibration panel (off by default) is descriptive only. It reports past outcomes using a fixed rule. It is not a backtest, prediction, or probability, and does not account for transaction costs or slippage.

Open-source. Released under the Mozilla Public License 2.0 (TradingView default). Feedback and constructive comments are welcome.

Notas de prensa
Updates since the previous version:

- Hawkes pre-kill is now proportional rather than binary. Instead of a fixed
threshold jump when volatility intensity crosses the warning line, the
show-threshold lift now scales linearly with how far above baseline volatility
actually is - from a small lift just above warn to a maximum lift (default
2.0 score points, capped at fortress) at severe excess. Existing zones on
the chart are unaffected.

- Three-tier severity badge. The regime row now reads "DGR vol+", "DGR vol++",
or "DGR vol+++" depending on the current lift size, so users can see at a
glance how aggressive the suppression actually is. The detail tooltip shows
the numeric lift in score points.

- New input: Max threshold lift (default 2.0 score points). Set to 0 to make
the badge descriptive only - the regime tag still shows vol+/vol++/vol+++
but no zones are actually suppressed. Useful for intraday traders who want
the volatility-state information without any filtering.

- New input: Lift-scaling span (default 2.0). Controls how far above the warn
line corresponds to the maximum lift. Larger span = gentler ramp.

- Compact 5-row snapshot panel. Shows decision-grade information only: Top
Zone, Bias, Levels (nearest support below + nearest resistance above with
ATR distance), Regime (zones + fortress + health combined), Asset. No
statistics table in the main panel.

- Calibration panel is now optional and off by default. The tracker still
runs in the background, so EXP_* plots stay populated for downstream
scripts. Turn the panel on in the input group if you want to see the
measured past hit-rate by score tier.

- Hawkes warning threshold default raised from 2.0x to 3.0x baseline. Less
sensitive on higher timeframes where a single 2-sigma move could echo
through intensity decay for many bars.
Notas de prensa
// v3.5 changes vs v3.4
// --------------------
// - Load time: the 16 separate request.security calls for per-HTF POC, pivot
// highs/lows and closes are consolidated into ONE bundled tuple call per HTF
// (4 calls total). Fewer security contexts compile and stream far faster.
// HTF POC row count is now a user input (lower default) to cut per-bar work.
// - Intraday declutter: a minimum on-screen separation between displayed zones
// (in ATR units) plus an optional auto-thin that raises the show-threshold and
// widens separation on 1/2/3-min charts. Strongest zone in any tight pocket
// wins; weaker overlapping ones are hidden. Exports are unaffected.
// - AVWAP / band / fib redraw: the dotted "circles" plots are replaced with
// clean broken-line plots; sigma bands are subtle, fib bands are crisp.
// - Snapshot panel expanded from 5 to 8 decision rows (adds Top-zone distance,
// nearest naked POC, and last anchor / absorption recency).
// - Adaptive colours: zone tints, labels and both panels auto-adjust to the
// chart background luminance for readable contrast on light or dark themes.
// ======================================================================================
Notas de prensa
Update — visual refresh, new controls & cleaner settings

New adaptive colour scheme. Levels now read as teal support / magenta resistance, with vivid variants for fortress-grade levels. A bright core + soft double-halo glow makes conviction read at a glance (toggle: Neon glow on S/R lines).
Panels adapt to your chart background. Tables, borders and text automatically switch between light and dark for legibility, with bold text throughout. New Panel theme control (Auto / Dark / Light) to override.
Font-size controls. Separate Table font size and On-chart label size options (Tiny / Small / Normal / Large).
Universal source input. New AVWAP / band source setting. The engine already reads the chart's OHLCV so it runs on any symbol/market; this lets you choose the price feeding the anchored-VWAP, σ and Fibonacci votes.
Settings reorganised. Inputs are now grouped and numbered 01–17 in a logical order for faster navigation.
Defaults. Vote-only sources (±2σ, Fib 1.0, weekly HTF) are on by default for a fuller confluence map out of the box.
Docs & credits. Header rewritten with a clear what/why/how, plus concept credits for the underlying public techniques (Steidlmayer, Shannon, Lo & MacKinlay, Kaufman, Wilson).

No change to the level-scoring, regime, or calibration logic — this update is interface, theming and organization only.

Exención de responsabilidad

La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.