OPEN-SOURCE SCRIPT

Mutual Info Decoupler [forexobroker]

498
Mutual Info Decoupler measures the information-theoretic dependence between price returns and volume over a rolling window. High MI = price moves explained by volume (informed flow). Low MI = price and volume decoupled (noise). Signals fire on EMA cross within a coupled regime, where the move is statistically grounded.

🔶 ALGORITHM

1. Bin returns into 3 quantile classes (low / mid / high) using +/- 0.5 sigma boundaries.
2. Bin volume into 3 classes (low / mid / high) using volume_avg * 0.7 and 1.3 boundaries.
3. Build 3x3 joint count matrix; derive marginals P(r) and P(v).
4. MI = sum_{r,v} P(r,v) * log( P(r,v) / (P(r) * P(v)) ) in nats.
5. Coupled regime when MI >= threshold.

🔶 SIGNAL LOGIC

- Buy: coupled AND close > SMA AND close crosses EMA up AND not already long AND cooldown elapsed AND barstate.isconfirmed.
- Sell: coupled AND close < SMA AND close crosses EMA down.
- Position-lock state machine.

🔶 INPUTS

- MI Window (default 60)
- Pullback EMA Length (default 8)
- Min MI (default 0.05 nats)
- Cooldown Bars (default 4)
- Visual: dashboard, glow, EMA toggle, buy / sell colors

🔶 ALERTS

MID Buy, MID Sell, MID Any Signal, MID Coupled On, MID Coupled Off, MID High MI, MID Cross Up, MID Cross Down, MID Webhook JSON.

🔶 LIMITATIONS

- 3x3 binning is coarse; finer resolution needs much more history to avoid empty cells.
- Forex tick volume is broker-aggregated and noisy; instruments with reliable volume produce more meaningful MI.
- MI is symmetric and dimension-free but does not tell direction; directional gating uses SMA bias.
- Window N = 60 is a balance between estimator stability and adaptiveness; longer windows produce smoother MI but slower regime detection.

כתב ויתור

המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.