Skip to content
All library documents

Using Directional Entropy to Explore Market Regimes

Article Quant Q&A · Author: Ian Whittington

Summary

The post considers how to identify trending and consolidating conditions from OHLC price data. It cautions that regime classification depends on the trader’s assumptions about price behavior, intended use, and time horizon. If price changes are treated as independent, trend and consolidation labels may not offer useful predictive information; other views allow dependence or regime changes, but the post does not establish which description fits a given market.

One suggested exploratory method converts each price movement into a binary up-or-not-up sequence, then examines that sequence using Shannon entropy or approximate entropy. Persistent runs in one direction may be consistent with a trend, while entropy can help describe the sequence’s structure. The suggestion is conceptual rather than a validated trading rule: no asset, sample, threshold, performance result, or regime-labeling test is supplied. The author also raises the possibility that useful information may lie in conditions preceding a trend, which would require separate analysis.

Key ideas

  • Represent successive price changes as a binary sequence indicating whether price rose.
  • Shannon or approximate entropy can summarize patterns in that sequence.
  • Long directional runs may suggest trending behavior, but do not prove a predictive regime.
  • The usefulness of regime labels depends on the market assumptions, purpose, and time scale.

Tags

Full text
# How to distinguish trending/consolidating market conditions programatically?


# How to distinguish trending/consolidating market conditions programatically?












Can someone please suggest me a method to programatically identify trending/consolidating market condition by reading ohlc data?

Currently I'm thinking of checking the current price within last n number of candles to check if the same price can be observed multiple times before.

Any other suggestions would be highly appreciated!

## Answer by Joseph Zambrano (score 1)

https://quant.stackexchange.com/a/21235

To start, it very much depends on your outlook. Do you believe that the future price movement is independent of previous price movement? If so you probably wouldn't look for trending or consolidating markets (it would be entirely random). On the other hand, maybe you have a fractal view of the market (search for fractional Brownian motion, regime switching models, ect.) where you think there is some deterministic or perhaps autocorrelated aspect to the price series of the asset. No one can say with certainty (although some statistical studies have indicated certain structural aspects). Really you should ask what you are trying to do with this information. Is it relevant? What time scales are you looking at? One technique that you could try that I like to look at is as follows: take the time series $X_t$ where $t\in\mathbb{N}$. I then define $\mu(t)$ such that $\mu(t)=0$ if $X_t<X_{t-1}$ and $\mu(t)=1$ if $X_t\ge X_{t-1}$. Doing this for some finite run you will get a series of 0s and 1s. Try computing the Shannon entropy or approximate entropy. You may find some interesting results. Long runs of 0s and 1s may indicate trends. However, for your purposes it may be best to see if there is anything interesting happening before a trend begins.

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.