OPEN-SOURCE SCRIPT
Mutual Info Decoupler [forexobroker]

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.
🔶 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の精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
🔵Gain access to our powerful tools : kestutisbalciunas.com/tradingview/
🔵Join our free telegram for updates : t.me/algotradingedge
All scripts & content provided by Forexobroker are for informational & educational purposes only.
🔵Join our free telegram for updates : t.me/algotradingedge
All scripts & content provided by Forexobroker are for informational & educational purposes only.
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
🔵Gain access to our powerful tools : kestutisbalciunas.com/tradingview/
🔵Join our free telegram for updates : t.me/algotradingedge
All scripts & content provided by Forexobroker are for informational & educational purposes only.
🔵Join our free telegram for updates : t.me/algotradingedge
All scripts & content provided by Forexobroker are for informational & educational purposes only.
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。