Market Entropy Pass Node

Market Entropy — Series Input

StatisticalComplexityPass

Overview

The Market Entropy Pass Node measures the Shannon entropy of the return distribution within a rolling window. Entropy quantifies the randomness or complexity of a series: high entropy means returns are spread unpredictably across many bins, while low entropy indicates concentrated, repetitive behaviour.

Unlike fractal dimension or Hurst exponent, entropy is non-parametric and captures distributional complexity without assuming a specific model structure.

Formula

Shannon Entropy:
1. Bin the rolling window returns into bins equal-width buckets
2. Compute frequency pᵢ for each bin
H = −Σ pᵢ × log₂(pᵢ) (summing non-empty bins)
Max entropy = log₂(bins). Low entropy = predictable distribution; high entropy = maximum randomness.

Parameters

ParameterDefaultDescription
period20Rolling window in bars
bins10Number of histogram bins for the return distribution

Inputs & Outputs

SlotDirectionTypeDescription
inputInput{ values, timestamps }Any upstream numeric series (returns preferred)
valuesOutput(number | null)[]Shannon entropy per bar; nulls during warm-up
timestampsOutputnumber[]Unix timestamps aligned to input

Use Cases

Market Regime Detection

Low entropy = returns concentrated in a few bins = trending or crisis regime. High entropy = random, normal market.

Volatility Regime Complement

Entropy captures distributional complexity beyond standard deviation — useful when returns are non-Gaussian.

Pre-Trade Filter

Pause mean-reversion strategies when entropy drops significantly (returns becoming concentrated = trending conditions).

Tips & Best Practices

Use Returns Not Prices

Feed log or simple returns to measure the entropy of the return distribution. Raw prices produce misleading entropy values.

Bin Count Trade-Off

More bins = finer resolution but noisier for small period windows. A period/bins ratio of at least 2–3 is recommended.

Max Entropy Reference

Maximum possible entropy = log₂(bins). With 10 bins, max entropy ≈ 3.32 bits. Normalise if comparing across different bin counts.

Related Indicators