Mutual Info Decoupler TradingView Indicator

Volume either explains a move or it does not. Mutual Info Decoupler measures which. This price volume correlation indicator TradingView traders can run on any chart bins the last 60 bars of returns and volume into a three-by-three table, then computes the mutual information between them in nats. Also, above 0.05 the script calls the market coupled and allows entries. Below it, the two series drift apart and the script stands aside.

It is free and open source. Indeed, you can add it to any chart from the Mutual Info Decoupler script page on TradingView, and the full Pine source is published there for you to read.

What Mutual Info Decoupler plots on the price chart

The chart carries one plotted line: an 8-period EMA. Still, it runs green when the market couples and price sits above its 20-bar simple moving average, pink when coupled and below it, and grey when the market decouples. Buy signals print as green triangles under the bar with the text MID up. Thus, sells print as pink triangles above with MID dn. Two faded copies behind each triangle make the glow. Hence, a very light background tint marks every coupled bar. The top-right dashboard shows MI in nats, your threshold, the window length, the bias, the regime, the position and bars since the last signal.

How Mutual Info Decoupler is built

Step one: build a three-by-three table

The script needs a joint distribution before it can measure anything. Next, it walks back over the MI Window, 60 bars by default. For each bar it takes the close-to-close change and the raw volume, then drops each into one of three buckets. Then, returns land low below minus half a standard deviation, high above plus half, and middle in between. Volume uses its own 60-bar average: under 70 percent of it counts as low, over 130 percent counts as high.

Note the bin edges. Yet, the header comment calls these quantile buckets, but the code uses fixed multiples of the standard deviation and the mean, so the three buckets rarely hold equal counts. Every bar increments one of nine cells. Truly, the script then reads row totals and column totals off that table to get the two marginal distributions.

Step two: turn the table into mutual information

Mutual information sums p times the log of p divided by the product of its marginals, across all nine cells. Plainly, the result arrives in nats, since the code uses the natural log. Zero means returns and volume carry no information about each other. Also, the ceiling for a three-by-three table is the natural log of three, about 1.10, which real markets never approach.

One caveat matters here. Indeed, a plug-in estimate on 60 samples across nine cells runs biased upward. Even two independent series tend to score near 0.03 nats on this window, which sits close to the 0.05 default. Still, the script ships an alert at 0.15 nats, and that is a fairer line for a genuinely coupled regime.

Mutual information has no direction. Thus, it says the two series move together, not which way. So direction comes from elsewhere. Hence, the script reads bias from the close against the 20-bar simple moving average. A buy then needs a coupled market, price above that average, and a close crossing above the 8-period EMA. A sell mirrors it. Alternating sides, a four-bar cooldown and a confirmed close finish the gate.

How to read the signals

Watch the MI row first. Next, a value hovering at 0.05 tells you little, given the estimator’s floor. A value at 0.15 or above says volume and returns genuinely track each other over the window. Then, that is when the triangles carry weight.

Regime and bias work as a pair. Yet, coupled plus an UP bias means the script only looks for longs. Decoupled means no triangles at all, whatever price does. Truly, long decoupled stretches are common in quiet sessions, so expect gaps with no signals.

Entry timing is a pullback, not a breakout. Plainly, the script waits for the close to cross back through the fast EMA in the direction of the bias. Signals confirm on the bar close, so the triangle appears as the next bar opens. Also, the coupled background tint updates live inside the bar, so it can appear and then vanish before the candle finishes.

Every Mutual Info Decoupler setting explained

The script exposes 9 inputs, grouped in the settings panel exactly as shown below. Defaults are the published values.

Mutual Information

SettingWhat it doesDefaultRange
MI WindowSets the mi window used in the calculation.6020 to 200

Signal Logic

SettingWhat it doesDefaultRange
Pullback EMA LengthSets the pullback ema length used in the calculation.83 to 50
Min MI (nats)Mutual information lower bound for ‘coupled’ regime. 0 = independent.0.050.0 to 0.5
Cooldown BarsSets the cooldown bars used in the calculation.41 to 20

Visual

SettingWhat it doesDefaultRange
Show DashboardToggles show dashboard on the chart.onon / off
Show 3-Layer GlowToggles show 3-layer glow on the chart.onon / off
Show Pullback EMAToggles show pullback ema on the chart.onon / off
Buy ColorColour used for buy color.#39ff14
Sell ColorColour used for sell color.#ff2d78

Alerts built into Mutual Info Decoupler

The script ships 11 alert conditions. Indeed, open the alert dialog on the chart, pick the indicator as the condition source, then choose the event you want. Alerts fire on the close of the bar, so they follow the same confirmed-bar rule the on-chart signals use.

  • 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

Other markets and timeframes

The bins are relative. Still, returns scale to their own 60-bar standard deviation and volume to its own 60-bar average, so the defaults carry across indices, gold, crypto and equities without retuning. Volume quality is the real variable. Thus, spot forex volume is broker tick volume, so the MI figure describes tick activity rather than traded size. On exchange-traded symbols the reading means more. On a symbol with no volume feed, MI collapses and no signal ever fires.

Limitations worth knowing

Mutual information filters. It does not forecast. The script gives you no stop, no target and no sizing. Hence, it tells you volume and returns moved together over 60 bars. It cannot tell you the next move continues.

The estimator is coarse. Next, three buckets across 60 samples means nine cells and small counts, so the number runs noisy and biased upward. Bin edges are fixed multiples, not quantiles, so a quiet stretch can push most bars into the middle bucket and flatten the reading.

Direction does not come from the mutual information at all. Then, it comes from a 20-bar moving average bias and an 8-period EMA cross, which is a conventional pullback entry. Treat MI as a permission gate. On forex the volume input is your broker’s tick count, so two brokers can score the same chart differently.

Get Mutual Info Decoupler on TradingView

Open Mutual Info Decoupler on TradingView

If you also trade MetaTrader, the MT4 and MT5 indicator library is available below.

Get the complete indicator library

One email unlocks the full MT4 and MT5 indicator library. Yet, this TradingView script stays free on TradingView – the button above adds it to your chart.

Using it alongside MetaTrader

Adding a script on TradingView takes one click, so there is no install step here. Truly, if you want the same idea on MetaTrader, the MT4 and MT5 indicator installation guide walks through copying files into the data folder and attaching them to a chart. You can also browse the full MetaTrader indicator library, the MT4 indicators section, or the other free TradingView scripts published on this profile. For related chart tools see the MT5 indicators section and the forex trading strategies guides.

External references

Frequently asked questions

Does Mutual Info Decoupler repaint?

Signals hold. Plainly, both entries require barstate.isconfirmed, and the triangles plot from those same variables, so a marker only lands after the bar closes. The coupled background tint and the EMA colour are not gated that way and do update live, so they can flicker while the candle forms.

What does an MI reading of 0.08 nats mean?

It means the joint table shows mild dependence between binned returns and binned volume over the last 60 bars. Also, keep the estimator’s bias in mind, because independent series often score near 0.03 on this sample size. So 0.08 is modest. Indeed, a reading of 0.15 or higher is the level the built-in alert treats as strong.

Is mutual information the same as correlation?

No. Still, correlation measures a straight-line relationship and carries a sign. Mutual information measures any dependence, including the case where large moves pair with large volume in both directions. Thus, it never turns negative, so it tells you how much the two series share, not which way they point.

Which timeframe should I use?

Any timeframe works, because every threshold stays relative. Hence, the 60-bar window is what matters. On a 5-minute chart that spans five hours. On a daily chart it spans three months. Shorter charts refresh the reading faster but also carry noisier volume.

How much should I rely on this indicator?

Treat it as one input, not a decision. Next, it is a chart analysis tool, not trading advice. Test it on your own markets and timeframes before relying on it. Results are not guaranteed; past performance is not indicative of future results.

Dominic Walsh - Forex trader and MT4/MT5 developer

About the author

Written by Dominic Walsh, a Forex trader and MT4/MT5 indicator, Expert Advisor and script developer. Every tool on forexmt4systems.com is tested on live charts before release and ships with ready-to-use compiled MT4 (.ex4) and MT5 (.ex5) files. Learn more about the trader and developer behind this site.

Leave a Comment