Loading…

Binary Entropy Meter

Every closed bar is classified as "up" or "down". Over a rolling lookback window the fraction of up bars gives a probability p, and the indicator plots the Shannon entropy of that Bernoulli variable: H = -p*log2(p) - (1-p)*log2(1-p). H sits at 1.0 bit when up and down bars are perfectly balanced (maximum uncertainty about the next bar's direction) and falls toward 0.0 bit as the window becomes one-sided in either direction (the next bar's direction is easy to guess from recent history alone). This is a deliberately simpler cousin of an ordinal-pattern (permutation) entropy tool already in this catalogue. Ordinal entropy classifies each bar into one of several rank patterns across a few consecutive bars, which captures finer sequence structure but needs more data and more explanation to read. Binary entropy collapses the alphabet down to two symbols, throwing away everything except direction, in exchange for a single number that a trader can read at a glance without reference to what "pattern 4 of 6" means. Neither replaces the other - they answer related but different questions about how much structure the recent bar-to-bar direction carries. A low reading does not mean price is trending in a straight line; it means the simple up/down coin has been biased, which happens both in a genuine trend and in a slow grind that keeps closing the same way for other reasons (a persistent order-flow imbalance, a session with one-directional news flow, thin illiquid drift). The indicator reports the bias, not its cause. Notes and limitations Entropy here measures directional bias only - it says nothing about the SIZE of the up or down moves, so a market alternating between a huge up bar and a tiny down bar reads identically to one alternating between two equally sized bars. It is a lagging, window-based statistic like any moving measure: a genuine regime change takes up to InpWindow bars to fully show up in the reading. This indicator does not repaint - each bar's value is fixed once the window behind it is fixed history.

Indicator · MT4 · v1.0 · Free

About Binary Entropy Meter

Binary Entropy Meter is an indicator for MetaTrader 4. It has 3 settings, such as Window, Use body direction and Low entropy level. MQL source code included.

Files in the download: BinaryEntropyMeter.ex4, BinaryEntropyMeter.mq4, BinaryEntropyMeter.txt.

Settings

SettingDefaultWhat it does
Window20Rolling window, in bars, used for the up/down count
Use body directionfalsetrue: classify by close-vs-open of the same bar; false: close-vs-previous-close
Low entropy level0.70Level line marking a "strongly directional" regime (informational only)

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Indicators.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the indicator from the Navigator onto a chart and adjust the settings.

Download the PDF guide

Tags: Binary Options · MT4 Indicator · MQL4 Source Code

MetaTrader 4 & 5 indicators · PolyMaria