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 อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน