OPEN-SOURCE SCRIPT
AetherEdge - Causal Inference Filter

🖊️ Overview
A causality-driven filter that asks not "what pattern is on the chart" but "what is actually driving price right now." Where SMC / Order-Block tools read price structure, this engine applies a scientific, causal lens. First, Granger-style causality — for each candidate driver (momentum, volatility, volume, range expansion), it measures whether the driver's past values help predict future returns beyond what past returns alone explain. That is predictive precedence, not mere correlation. Second, NeuraLib feature importance — a small network learns to forecast forward returns, and an ablation-style importance score reveals which driver the model actually relies on. The two combine into a causal confidence: signals fire only when a true driver is clearly identified; in noisy, causally-ambiguous regimes the filter stays silent. Visualization: soft rectangular boxes only over high-causal-confidence zones, plus simple arrows.
🔶 Key Features
Granger-style predictive power — measures whether a driver's past precedes future returns (not mere correlation), correlation-based
NeuraLib feature importance — an ablation-style score identifies the driver the model truly relies on
True-driver identification — extracts the dominant driver from four candidates (momentum/volatility/volume/range-exp)
Causal confidence — a causal-clarity score blending Granger lift and importance concentration
Noise rejection — signals only when causality is clear; suppressed when ambiguous
Causal zones — soft rectangular boxes only in high-confidence conditions (opacity by confidence)
Simple arrows — causally-confirmed directional signals shown with minimal arrows
Intelligence panel — causal confidence, the true driver, each driver's importance and Granger lift, and the forecast at a glance
🧠 Technical Architecture
The engine tests the causal influence of four candidate drivers (momentum, volatility, volume anomaly, range expansion — all normalized).
Granger causality: for each driver d, it computes the rolling correlation between the driver lagged by grangerLag and the current return. If the driver's past predicts today's move, that is predictive precedence (Granger-like). The return's own autocorrelation (how past returns explain the future) is subtracted as a baseline, isolating the causal lift the driver adds — distinguishing "merely correlated" from "predictively precedent."
Feature importance: the NeuraLib network (drivers(4) → hidden(tanh) → forward-return forecast(1)) learns to forecast forward returns by supervision. Each driver's importance is the change in forecast when that driver is "ablated" (set to 0): |full forecast − ablated forecast| — a method inspired by permutation importance.
Causal confidence is a [0,1] blend of the dominant driver's Granger lift and the importance concentration (the top driver's share of total importance = causal clarity). Only when it clears the gate do arrows and causal zones fire. Zones are drawn with width and opacity scaled by confidence, extend right via extend.right, and retire past their lifespan.
⚙️ Recommended Settings & Tuning Guide
BTC (1H–4H): Causal Lag 5, Causality Window 60, Min Causal Lift 0.15, Min Causal Confidence 0.50. Standard settings fit well
ETH (1H–4H): As BTC, with Forward Outcome 5–8
SOL (15m–1H): High volatility favors Confidence Smoothing 4–5 to smooth confidence, Min Confidence 0.55 to reject noise more strictly
XRP (1H–4H): Spike-prone; Causal Lag 3 for shorter precedence, Causality Window 50 to weight recent causality
Causal Lag: the assumed bars by which a driver precedes price — tune to the market's reaction speed
Causality Window: longer is a steadier causal estimate; shorter is nimbler — ~60 is practical
Min Causal Lift: the minimum predictive power for a driver to count as causal — higher is stricter
Min Causal Confidence: the firing threshold for signals/zones — higher narrows to only the clearest causality
💡 How to Use in Practice
Reacting to causal arrows: an arrow marks where a clear causal driver is identified and a direction predicted — a low-false-signal entry basis grounded in statistical causality, not structure patterns
Reading causal zones: a soft box is a price band of high causal confidence; within it causality is clear and price tends to respect the zone — a causal take on support/resistance
Confirming the true driver: the panel's "True Driver" shows whether momentum, volatility, volume, or range is moving price now (e.g. a dominant VOLUME means a volume-led market)
Avoiding ambiguous regimes: low-confidence (AMBIGUOUS) conditions mean the driver is unclear — a noisy market; the absence of a signal is itself a "wait" signal
Checking driver lift: the panel's per-driver Granger lift shows which drivers predictively precede; those above the lift threshold lead
Multi-timeframe usage: confirm the dominant driver and causal direction on the higher timeframe (4H), then time on causal zones and arrows on the lower one (15m–1H)
⚠️ Important Notes
Approximate causal inference: the Granger causality here is a lightweight correlation-based approximation fit to Pine's compute budget — not a rigorous Granger test (VAR regression / F-test), but a heuristic indicator of predictive precedence
Correlation ≠ causation limit: statistical causal inference is powerful but cannot fully exclude hidden common factors (confounders); "causal" means statistical predictive power, not proof of true economic causation
Initial learning period: right after launch the network's buffer is nearly empty and importance estimates are unstable; treat causal confidence as low-confidence until it learns (several hundred bars)
Learning resets: changing parameters, symbol/timeframe, or recompiling reinitializes the network weights and buffer
On look-ahead: the importance target uses closed-bar realized returns (a standard training construct); as with any adaptive system, historical and live behavior can differ — always forward-test
Constraints: this is a lightweight implementation within Pine's compute budget
🚨 Disclaimer
This indicator is an analytical and educational visualization tool. The Granger causality, feature importance, causal confidence, causal zones, and signals are quantitative heuristics computed on-chart from price data — they are not financial advice, buy/sell signals, or any guarantee of future performance. Even statistical causal inference can misidentify. Always combine any tool with your own analysis and disciplined risk management.
A causality-driven filter that asks not "what pattern is on the chart" but "what is actually driving price right now." Where SMC / Order-Block tools read price structure, this engine applies a scientific, causal lens. First, Granger-style causality — for each candidate driver (momentum, volatility, volume, range expansion), it measures whether the driver's past values help predict future returns beyond what past returns alone explain. That is predictive precedence, not mere correlation. Second, NeuraLib feature importance — a small network learns to forecast forward returns, and an ablation-style importance score reveals which driver the model actually relies on. The two combine into a causal confidence: signals fire only when a true driver is clearly identified; in noisy, causally-ambiguous regimes the filter stays silent. Visualization: soft rectangular boxes only over high-causal-confidence zones, plus simple arrows.
🔶 Key Features
Granger-style predictive power — measures whether a driver's past precedes future returns (not mere correlation), correlation-based
NeuraLib feature importance — an ablation-style score identifies the driver the model truly relies on
True-driver identification — extracts the dominant driver from four candidates (momentum/volatility/volume/range-exp)
Causal confidence — a causal-clarity score blending Granger lift and importance concentration
Noise rejection — signals only when causality is clear; suppressed when ambiguous
Causal zones — soft rectangular boxes only in high-confidence conditions (opacity by confidence)
Simple arrows — causally-confirmed directional signals shown with minimal arrows
Intelligence panel — causal confidence, the true driver, each driver's importance and Granger lift, and the forecast at a glance
🧠 Technical Architecture
The engine tests the causal influence of four candidate drivers (momentum, volatility, volume anomaly, range expansion — all normalized).
Granger causality: for each driver d, it computes the rolling correlation between the driver lagged by grangerLag and the current return. If the driver's past predicts today's move, that is predictive precedence (Granger-like). The return's own autocorrelation (how past returns explain the future) is subtracted as a baseline, isolating the causal lift the driver adds — distinguishing "merely correlated" from "predictively precedent."
Feature importance: the NeuraLib network (drivers(4) → hidden(tanh) → forward-return forecast(1)) learns to forecast forward returns by supervision. Each driver's importance is the change in forecast when that driver is "ablated" (set to 0): |full forecast − ablated forecast| — a method inspired by permutation importance.
Causal confidence is a [0,1] blend of the dominant driver's Granger lift and the importance concentration (the top driver's share of total importance = causal clarity). Only when it clears the gate do arrows and causal zones fire. Zones are drawn with width and opacity scaled by confidence, extend right via extend.right, and retire past their lifespan.
⚙️ Recommended Settings & Tuning Guide
BTC (1H–4H): Causal Lag 5, Causality Window 60, Min Causal Lift 0.15, Min Causal Confidence 0.50. Standard settings fit well
ETH (1H–4H): As BTC, with Forward Outcome 5–8
SOL (15m–1H): High volatility favors Confidence Smoothing 4–5 to smooth confidence, Min Confidence 0.55 to reject noise more strictly
XRP (1H–4H): Spike-prone; Causal Lag 3 for shorter precedence, Causality Window 50 to weight recent causality
Causal Lag: the assumed bars by which a driver precedes price — tune to the market's reaction speed
Causality Window: longer is a steadier causal estimate; shorter is nimbler — ~60 is practical
Min Causal Lift: the minimum predictive power for a driver to count as causal — higher is stricter
Min Causal Confidence: the firing threshold for signals/zones — higher narrows to only the clearest causality
💡 How to Use in Practice
Reacting to causal arrows: an arrow marks where a clear causal driver is identified and a direction predicted — a low-false-signal entry basis grounded in statistical causality, not structure patterns
Reading causal zones: a soft box is a price band of high causal confidence; within it causality is clear and price tends to respect the zone — a causal take on support/resistance
Confirming the true driver: the panel's "True Driver" shows whether momentum, volatility, volume, or range is moving price now (e.g. a dominant VOLUME means a volume-led market)
Avoiding ambiguous regimes: low-confidence (AMBIGUOUS) conditions mean the driver is unclear — a noisy market; the absence of a signal is itself a "wait" signal
Checking driver lift: the panel's per-driver Granger lift shows which drivers predictively precede; those above the lift threshold lead
Multi-timeframe usage: confirm the dominant driver and causal direction on the higher timeframe (4H), then time on causal zones and arrows on the lower one (15m–1H)
⚠️ Important Notes
Approximate causal inference: the Granger causality here is a lightweight correlation-based approximation fit to Pine's compute budget — not a rigorous Granger test (VAR regression / F-test), but a heuristic indicator of predictive precedence
Correlation ≠ causation limit: statistical causal inference is powerful but cannot fully exclude hidden common factors (confounders); "causal" means statistical predictive power, not proof of true economic causation
Initial learning period: right after launch the network's buffer is nearly empty and importance estimates are unstable; treat causal confidence as low-confidence until it learns (several hundred bars)
Learning resets: changing parameters, symbol/timeframe, or recompiling reinitializes the network weights and buffer
On look-ahead: the importance target uses closed-bar realized returns (a standard training construct); as with any adaptive system, historical and live behavior can differ — always forward-test
Constraints: this is a lightweight implementation within Pine's compute budget
🚨 Disclaimer
This indicator is an analytical and educational visualization tool. The Granger causality, feature importance, causal confidence, causal zones, and signals are quantitative heuristics computed on-chart from price data — they are not financial advice, buy/sell signals, or any guarantee of future performance. Even statistical causal inference can misidentify. Always combine any tool with your own analysis and disciplined risk management.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.