[blackcat] L2 Ehlers Event Predictability

█ OVERVIEW
This indicator measures how predictable price becomes after a specific market "event" — a statistical concept introduced by John Ehlers. It collects the forward returns that followed every historical event, builds a distribution of outcomes, and plots its Center of Gravity (CG) so you can see at a glance whether events on this symbol tend to resolve up or down.
█ CONCEPTS
• Event detection: a short-term stochastic of price crossing under a low level (default 0.2) marks an "event" bar.
• Outcome sampling: each event's forward return over the lookback window (default 10 bars) is measured, clamped to ±10%, and rescaled into one of 100 bins.
• Center of Gravity: the weighted mean of the bins. CG above zero = past events were followed by up-moves; below zero = down-moves. Larger magnitude = stronger statistical skew.
• Signal engine: BUY/SELL fire only on turns of the CG line (edge-triggered), pass a position state machine and an optional cooldown, so the chart stays clean instead of labeling every bar.
█ HOW TO USE
1 — Add the indicator to any chart; it loads in a separate pane below price.
2 — Let history accumulate: statistics build from the bars loaded on your chart, so longer history gives a more stable CG.
3 — Read the line: lime circles = CG rising (bullish predictability improving), red circles = CG falling, gray = flat.
4 — Act on labels: BUY appears on an upturn of CG, SELL on a downturn. An opposite signal also closes the prior regime (reverse-exit logic).
5 — Set alerts on "BCL5EEP BUY", "BCL5EEP SELL", "BCL5EEP ANY Signal" or "BCL5EEP Event" — best used with "Once Per Bar Close".
Input Parameters
• Stochastic Length (10): lookback of the event stochastic.
• Price Source (hl2): price series feeding the stochastic.
• Event Trigger Level (0.2): level the stochastic must cross under to mark an event.
• Event Lookback (9): bars back used for the event reference and the forward-return window.
• Future Return Clamp (±10%): forward returns are clamped to this range before binning.
• State Machine Gate (on): suppresses repeated same-direction signals.
• Cooldown Bars (3): minimum bars between signals; 0 disables.
• TP/SL group: ATR-based stop/target reference (ATR 14, SL 2.0 xATR, TP 3.0 xATR), shown in the data window and dashboard.
• Visuals: toggles for signal labels, regime background and dashboard.
█ FEATURES
• Edge-triggered BUY/SELL labels carrying the CG value at signal time.
• Regime background tint and a live dashboard: regime, CG value and slope, event count, sample count, SL/TP levels.
• ATR-based SL/TP reference levels for the latest signal.
• Four alertcondition channels: BUY / SELL / ANY / EVENT.
█ LIMITATIONS
• CG is a running statistic of the chart's loaded history — it changes as data accumulates and differs across symbols and timeframes.
• Best treated as context for event-driven setups, not as a standalone trading system.
• Ranging markets can whipsaw the CG line; raise the cooldown or the trigger level to reduce noise.
• SL/TP values are visual references only — an indicator cannot place orders.
█ NOTES
• Based on the "Event Predictability" concept by John F. Ehlers; V2 adds the signal engine, risk reference, dashboard and alert suite.
• Open source under Mozilla Public License 2.0 — study, reuse and attribution welcome.
════════════════════════════════════════════════════════════════════════
For questions or feedback, please use the comments section below.
Feel free to use and modify — attribution appreciated.
This indicator measures how predictable price becomes after a specific market "event" — a statistical concept introduced by John Ehlers. It collects the forward returns that followed every historical event, builds a distribution of outcomes, and plots its Center of Gravity (CG) so you can see at a glance whether events on this symbol tend to resolve up or down.
█ CONCEPTS
• Event detection: a short-term stochastic of price crossing under a low level (default 0.2) marks an "event" bar.
• Outcome sampling: each event's forward return over the lookback window (default 10 bars) is measured, clamped to ±10%, and rescaled into one of 100 bins.
• Center of Gravity: the weighted mean of the bins. CG above zero = past events were followed by up-moves; below zero = down-moves. Larger magnitude = stronger statistical skew.
• Signal engine: BUY/SELL fire only on turns of the CG line (edge-triggered), pass a position state machine and an optional cooldown, so the chart stays clean instead of labeling every bar.
█ HOW TO USE
1 — Add the indicator to any chart; it loads in a separate pane below price.
2 — Let history accumulate: statistics build from the bars loaded on your chart, so longer history gives a more stable CG.
3 — Read the line: lime circles = CG rising (bullish predictability improving), red circles = CG falling, gray = flat.
4 — Act on labels: BUY appears on an upturn of CG, SELL on a downturn. An opposite signal also closes the prior regime (reverse-exit logic).
5 — Set alerts on "BCL5EEP BUY", "BCL5EEP SELL", "BCL5EEP ANY Signal" or "BCL5EEP Event" — best used with "Once Per Bar Close".
Input Parameters
• Stochastic Length (10): lookback of the event stochastic.
• Price Source (hl2): price series feeding the stochastic.
• Event Trigger Level (0.2): level the stochastic must cross under to mark an event.
• Event Lookback (9): bars back used for the event reference and the forward-return window.
• Future Return Clamp (±10%): forward returns are clamped to this range before binning.
• State Machine Gate (on): suppresses repeated same-direction signals.
• Cooldown Bars (3): minimum bars between signals; 0 disables.
• TP/SL group: ATR-based stop/target reference (ATR 14, SL 2.0 xATR, TP 3.0 xATR), shown in the data window and dashboard.
• Visuals: toggles for signal labels, regime background and dashboard.
█ FEATURES
• Edge-triggered BUY/SELL labels carrying the CG value at signal time.
• Regime background tint and a live dashboard: regime, CG value and slope, event count, sample count, SL/TP levels.
• ATR-based SL/TP reference levels for the latest signal.
• Four alertcondition channels: BUY / SELL / ANY / EVENT.
█ LIMITATIONS
• CG is a running statistic of the chart's loaded history — it changes as data accumulates and differs across symbols and timeframes.
• Best treated as context for event-driven setups, not as a standalone trading system.
• Ranging markets can whipsaw the CG line; raise the cooldown or the trigger level to reduce noise.
• SL/TP values are visual references only — an indicator cannot place orders.
█ NOTES
• Based on the "Event Predictability" concept by John F. Ehlers; V2 adds the signal engine, risk reference, dashboard and alert suite.
• Open source under Mozilla Public License 2.0 — study, reuse and attribution welcome.
════════════════════════════════════════════════════════════════════════
For questions or feedback, please use the comments section below.
Feel free to use and modify — attribution appreciated.
Don't miss out! The first and most important thing to do is to join my Discord chat now! Click here to start your adventure: discord.com/invite/ZTGpQJq My new github for more pine development soon: github.com/wxt-coder
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.
Don't miss out! The first and most important thing to do is to join my Discord chat now! Click here to start your adventure: discord.com/invite/ZTGpQJq My new github for more pine development soon: github.com/wxt-coder
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.