OPEN-SOURCE SCRIPT
Aktualisiert

MACD Rewired [Probalist Essentials]

876
MACD Rewired is the canonical Moving Average Convergence Divergence — fast EMA minus slow EMA, smoothed through a signal EMA — rebuilt with a 4-state histogram, regular and hidden divergence detection, and an empirical forward-return distribution on every signal cross.

It's aimed at momentum traders who already know MACD and want a version that earns its place: the histogram tells you not just where price is but whether momentum is building or fading, the divergence labels flag the structural shifts the raw histogram misses, and the probability panel shows what this chart's own history recorded after past crosses.

🟡 WHY THIS VERSION

The histogram alone doesn't tell you whether a reading above zero is growing or about to roll — this version colour-codes all four states so you can see momentum building vs. fading at a glance, in the right direction. The divergence labels (regular and hidden, both bull and bear) are drawn on confirmed pivots and stay put — no repainting. The probability read is the one I find myself actually using: it doesn't promise an edge, it just tells you what happened after past crosses on the specific chart you're looking at, with the sample size and spread shown honestly. Sane defaults, all alerts fire on bar close, and the heat palette makes the wave read intuitively hot or cold with the momentum.

🟡 HOW IT WORKS

MACD subtracts a slow EMA from a fast EMA to isolate the gap between short-term and medium-term momentum. A signal EMA smoothed over the MACD line then acts as a trigger — crossovers and crossunders are the classic entry cues. The histogram (MACD minus signal) turns that gap into a visual: rising bars show momentum building, falling bars show it fading, and the zero line separates bullish from bearish territory. Four colours cover the four states.

Divergence detection scans confirmed pivot lows/highs in the histogram (ta.pivotlow / ta.pivothigh) and compares them to the corresponding price pivot lows/highs. A regular bullish divergence is price making a lower low while the histogram makes a higher low — momentum not confirming the new price extreme. A hidden bullish divergence is the opposite structure: price makes a higher low while the histogram makes a lower low, suggesting the underlying trend is intact. Bear logic mirrors this on the highs side.

The probability read records the percentage return i_horizon bars after each confirmed signal cross and stores it in separate bull and bear arrays. Once the minimum sample threshold is met it reports win-rate, median return, and the 16th–84th percentile band — the spread, not just a headline number.

🟡 KEY FEATURES
  • 4-state histogram colouring: rising/falling × above/below zero — shows whether momentum is building or fading, not just direction
  • Regular and hidden divergence on both bull and bear sides, drawn on confirmed pivots — non-repainting
  • Empirical forward-return distribution: records what happened after past signal crosses on this chart and displays a KDE bell curve
  • Probability projection cone on the most recent signal bar spanning the 16th–84th percentile band
  • Separate bull and bear outcome arrays — no dilution from pooling opposite-direction signals
  • Evidence-gated alerts that fire only when the chart's own history backed follow-through (win rate ≥ 55%, positive median)
  • Weighted signal dots with per-dot hover tooltips showing the read at fire time and the eventual outcome
  • Optional HTF MACD line as a faint display-only reference — does not gate signals
  • Probalist heat wave — the MACD line breathes hot/cold with histogram momentum strength


🟡 HOW TO USE
  • Use the histogram colour to gauge momentum quality — a bright gold bar above zero means momentum is building bullish; a dim gold bar means it's fading. Same logic in reverse below zero with blue.
  • Divergence labels (R Bull Div, H Bull Div, R Bear Div, H Bear Div) mark structural mismatches between price and momentum. Regular divergence hints at exhaustion; hidden divergence hints at continuation — neither is a standalone signal.
  • Signal crosses are the primary cue: crossover above signal line = bullish bias, crossunder = bearish. Use in the direction of higher-timeframe structure for better results.
  • Check the probability panel before acting on a cross: if the chart shows n < 20, the read is still gathering. Once populated, the 16th–84th band tells you how wide the distribution of past outcomes was — a narrow band with a high win-rate is a different situation from a wide band.
  • Enable evidence-gated alerts to be notified only when the chart's own history backed a cross at that win-rate threshold. Noisy charts will rarely fire these; trending charts will fire them more.
  • Set the HTF line to your bias timeframe (e.g. 4H or Daily when trading 1H). If the HTF MACD is below zero while you get a 1H bull cross, treat it as a countertrend setup — confluence or caution, your call.


🟡 PAIRS WELL WITH

MACD measures momentum but doesn't tell you where price is relative to structure. Pair it with a trend filter — a moving average or a Supertrend — so you can tell whether a bullish cross is with or against the prevailing direction. A volume indicator (relative volume or VWAP deviation) helps confirm whether the cross has conviction behind it; a low-volume cross in the middle of a range is a different read from a high-volume cross off a support level. On higher timeframes, a weekly or daily MACD posture gives context the 1H cross alone can't provide. MACD doesn't handle horizontal S/R — key levels from price action or pivot points help frame where the cross is happening in the market structure.

MACD Rewired gives you the classic momentum tool with the context it was always missing: a histogram that shows whether momentum is building or fading, divergence that flags the structural mismatches, and a probability read that keeps score of what this chart's own history said after past crosses. No predictions — just the evidence, shown honestly.

Open source under MPL-2.0. The probability layer describes past signals on your chart — it is a measurement, not a prediction, and nothing here is financial advice.
Versionshinweise
Fixed the cone box read.
Versionshinweise
v2 — the regime update

🟡 NEW PALETTE
The wave now runs the full Probalist vibrant ramp: strong blue → cyan → light blue → mint (the neutral zone) → yellow → amber → orange. The hot/cold pickers set the extremes; the bell curve follows the same ramp.

🟡 REGIME-AWARE PROBABILITY READ
Besides the long-run record, each side now tracks its recent form (last 60 outcomes, adjustable). Markets move in regimes — the Read now tells you whether the signal works NOW, not averaged over years: "recent + long-run back follow-through", "recent form backs it — long-run mixed", or the honest opposite.

🟡 EVIDENCE, NOT AN ARBITRARY BAR
"Backed" now means the Wilson-score lower bound of the win rate clears 50% — automatically strict on small samples, sensitive on large ones. Strictness is selectable (80/90/95%).

🟡 LEANING TIER
An edge that's building but not yet proven shows as "recent form leans bullish/bearish — building, not yet evidence", with a half-filled dot. Alerts still fire on evidence only.

🟡 EDGE CLOCK
The readout shows when each side last had a backed edge: "Edge last seen — bull 3d ago · bear —".

🟡 SMALLER THINGS
Dot tooltips carry the read at fire time (recent + long-run + verdict) plus the completed outcome. The readout panel draws on the chart — it scrolls with it instead of covering price — and has its own toggle; all probability features sit under one master switch. Label spacing and number formatting polish.

Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.