▲ Work in progress. This site is built and researched in the open: pages, numbers and findings may change or be wrong, and the record has gaps. Not advice. More
The Lab
Ideas traders use, put to the record
← the Lab · models explained · write-up
#16 Models for reading a market, and what they showed on real prices
Past prices; no real orders were placed. Each model is explained first. Then comes what happened when we tested it on Bitcoin, Ether and Solana, against fake markets or random choices.
Last checked: 16 October 2026.
How we test, every time:
- Fake markets. We take the same price moves and put them in random order. That keeps how big the moves are, but removes any pattern in time. If a model finds the same thing in the fake market, the market didn't cause it.
- Random choices. A rule has to beat the same number of random picks.
- Two halves. Settings are chosen on the first half of the data and judged on the second, which the choice never saw.
- Fees. Every trading result is after exchange fees.
1. Markov models: states and how they follow each other
A Markov model (after the mathematician Andrey Markov, 1906) describes something that moves between states. The chance of what comes next depends only on the state now, not on how it got there.
Example: the weather. Each day is sunny or rainy:
| today → tomorrow | sunny | rainy |
|---|---|---|
| sunny | 80% | 20% |
| rainy | 40% | 60% |
This table is the transition matrix. It tells you three things:
- The long-run share of each state. Here about 67% of days are sunny.
- How long a spell lasts. The average is 1 ÷ (1 − the chance of staying). A rainy spell lasts 2.5 days on average.
- The odds several days ahead.
(All three are worked through in The maths, step by step, near the end.)
In a market the states might be "trending up", "trending down" and "ranging", given by a rule such as an indicator's reading.
What we found. We built a Markov model on a common trend label (the ADX indicator, J. Welles Wilder's) for BTC, ETH and SOL.
- The label looked very "sticky": once trending, the market seemed to stay trending. But the fake markets were just as sticky. The stickiness came from the indicator's own smoothing, not from the market.
- What did carry real information was volatility. After a down day, the next day moved more on every coin. That held up when we checked it properly, but only just.
- There was no momentum. Counted honestly, in 10-day blocks, an "up" day said nothing about the next day's direction. On ETH the next day averaged +0.22%, somewhere between −0.42% and +0.82%. On SOL it was somewhere between −0.41% and +0.82%.
The limit. Markets aren't truly memoryless, and the odds themselves change over time. A Markov model describes; it doesn't predict prices.
2. The hidden Markov model: calm and wild
A hidden Markov model (Baum and Petrie, 1966) assumes there is a true state you can't see, such as "calm" or "wild". It shows itself only through what you can see: the price moves. The model learns the states from the data itself. Each hour it gives a probability, such as "82% calm, 18% wild", not a hard label.
| regular Markov | hidden Markov | |
|---|---|---|
| the states | given by a rule we choose | learned from the data |
| it needs | a label at every step | only the price moves |
| noise | flickers at the rule's thresholds | smoothed into probabilities |
| main risk | a bad rule makes a bad model | its states may not mean what you hope |
How it decides each hour (with the numbers from one fit on hourly moves):
- Carry the last hour's belief forward. A wild hour stays wild 83.6% of the time. A calm hour turns wild 5.7% of the time.
- Ask how likely this hour's move is in each state. Calm hours move about ±0.26%, wild hours about ±0.86%.
- Combine the two. Multiply each state's chance from step 1 by how likely the move is in that state, then rescale so the two add to 100%. (This is Bayes' rule, from Thomas Bayes, published in 1763. A worked example is near the end.)
We wrote the model from scratch. Before using it, we checked it could recover a known model from data drawn from that model.
What we found (BTC, ETH and SOL, hourly and 4-hourly, two years):
- Volatility really does cluster. On Bitcoin hourly, a calm hour was followed by a calm hour 93% of the time, and a wild one by a wild one 83% of the time. On fake markets those figures were 79% and 23%: wild hours there are one-off blips. Real calm spells last about 14–18 hours, and wild spells about 6.
- "Two states fit better" is mostly fat tails. A mix of a calm and a wild bell curve fits rare huge moves, even with no clustering at all. So fake markets also fit better with two states. The real structure is the gap between real and fake.
- Forecasting the next hour's volatility gave mixed results. We compared the model with a plain recent average:
- Bitcoin hourly: the model was 6–11% better.
- Ether hourly and Bitcoin 4-hourly: about level.
- Ether 4-hourly: the model was 6% worse.
- Solana: the model was 11–24% worse.
- Pausing a grid bot in wild hours didn't help. It cut the worst drop, but it cut the profit by more, on every coin. Pausing at random for the same share of hours did as well or better. A grid earns from price swings, and wild hours have the biggest ones.
3. Mean reversion: what drifts away tends to come back
The classic model (Ornstein–Uhlenbeck, 1930) is a ball on a rubber band tied to a post, knocked about at random:
- the post, the normal level, called μ (mu);
- the band's strength, how fast it pulls back, called θ (theta);
- the knocks, the noise, called σ (sigma).
The number to take away is the half-life: how long half of any gap takes to close. If a gap usually halves in six hours, you know how long to wait, and when a trade has gone stale.
Trading it: measure how unusual today's gap is, in "typical gaps". That number is the z-score. Buy when it is unusually low (say below −2), sell when it is unusually high, and get out near zero. Both are worked through near the end.
The catch: prices themselves rarely come back to a level. Bitcoin has no rubber band to a fixed price. What tends to come back are gaps between two things:
- the ETH/BTC ratio, when two linked coins drift apart;
- the basis, the gap between spot and the perpetual future;
- funding rates, where extremes fade;
- volatility, which spikes and then calms.
A grid bot is a mean-reversion strategy. It buys dips and sells bounces inside a range, betting that the price keeps coming back. It does well in a range and is hurt by a trend. That is why a model that could say "we are in a range now" would be worth so much to a grid. The hidden model above was our try at that, and it didn't beat random pausing.
Perpetual futures or options for mean reversion?
| perpetual futures | options | |
|---|---|---|
| payoff | straight line: up 1, gain 1 | curved: a buyer's loss is limited, and so is a seller's gain |
| suits | gaps that close in price: grids, pairs, basis | volatility that calms: selling options when it's high |
| running cost | funding, paid or received | time decay: buyers pay it, sellers earn it |
| the danger | liquidation in a trend | a plain seller can lose without limit in a crash, unless a spread caps it |
4. First passage: the chance a price touches a level
How likely is the price to touch a level (a rung, a take-profit, a liquidation) within a given time? The textbook formula underprices far levels several times over; the market's own curve gives honest odds. It has a page of its own: First passage.
5. Order flow: who is pushing the price
The idea: price moves because one side is more eager. Every trade has an aggressor, the side that crossed the spread: a market buy takes the asking price, a market sell takes the bid.
For example, with the best bid at 99.90 and the best ask at 100, a market buy of one coin fills at 100: the buyer is the aggressor, and the trade counts as buying.
- Trade flow imbalance: market buys minus market sells over a window. Its running total is called CVD (cumulative volume delta).
- Book imbalance: resting bids against resting asks near the price. It is easy to fake with orders that get pulled.
- Order flow imbalance (OFI) in the research sense (Cont, Kukanov and Stoikov, 2014) tracks changes in the best bid and ask queues. Over short spans, the price change is roughly OFI ÷ depth: thin books move more.
What we found (every trade on Bybit's public files: BTC over 30 days, ETH and SOL over 14 days, counted minute by minute):
- It explains the minute it happens in. The minute's imbalance lines up with the minute's move. It explains about a fifth of a minute's move on Bitcoin, 13% on Ether and 18% on Solana. This confirms the textbook result.
- It barely says anything about the next minutes, and what it says is backwards. On BTC and ETH, heavy buying was followed by a slightly lower price over the next 1–15 minutes, beyond every fake. It looks like a small overshoot that the market then takes back. The effect is tiny, and Solana showed nothing.
- No trading rule survived fees on unseen data. We chose the best of 96 rules on the first half and traded it on the second. Every coin lost, at both fee levels, and every result sat inside the range of random entries.
Absorption is heavy one-way selling that barely moves the price: resting buyers are soaking it up, like a floor. The idea is that when absorption fails, the floor gives way and a trend follows.
We tested that on two years of Binance hourly data (BTC, ETH, SOL), choosing the settings on the first year and judging them on the second.
- A failed floor did not warn of a trend. If anything it was the opposite. In the second year, a day that hurts a grid followed a failure less often than it followed an ordinary hour: BTC 0% against 10%, ETH 3% against 7%, SOL 3% against 6%.
- In the first year some settings looked strong (SOL 20–33% against 10%). None held a year later. That is what an overfit looks like.
- Overfitting is tuning a rule until it fits the past's noise rather than a real pattern, so it fails on new prices. For example, of 100 settings with no skill, the best on last year's prices will usually look good by luck, and do no better than the rest the year after.
What it means: at a minute or an hour, order flow describes the market; it isn't a signal we could trade. Any edge lives in seconds, where the fastest firms are.
Where market data comes from
Every trade, order book, funding payment, liquidation and open-interest figure comes from an exchange's matching engine. Crypto exchanges publish most of it free, because data brings traders.
- Aggregators mostly read the same public feeds across many exchanges. They sell years of recordings, cleanup across venues, convenience and models.
- A liquidation heatmap is an estimate, not data. It is built from changes in open interest plus assumed leverage.
- Even liquidation totals are partial. For example, Binance's public stream sends at most about one liquidation a second per coin.
- Candles, funding, every trade, and Binance's open-interest and long/short history can be downloaded free for years.
- Order books and live liquidations have to be recorded as they happen.
The maths, step by step
1. A transition table (the weather example above: sunny stays sunny 80%, rainy stays rainy 60%).
- Two days ahead: from a sunny day, tomorrow is sunny 80% of the time, then sunny again 80%; or rainy 20%, then back to sunny 40%. So 0.8 × 0.8 + 0.2 × 0.4 = 72%.
- The long-run share: in the long run the sunny share stays the same from day to day. Sunny days flow out at 20% and rainy days flow back in at 40%, so sunny days are 40 ÷ (20 + 40) = two thirds (67%) of all days.
- How long a spell lasts: a rainy day ends the spell 40% of the time, so a spell lasts 1 ÷ 0.4 = 2.5 days on average. That is 1 ÷ (1 − 0.6), with 0.6 the chance of staying.
2. Bayes' rule, one hour of the hidden model (with the fitted numbers from section 2):
- Before looking: say last hour was 90% calm. Calm stays calm 94.3% of the time (it turns wild 5.7%), and wild turns calm 16.4% (it stays wild 83.6%). So this hour starts at 0.9 × 0.943 + 0.1 × 0.164 = 86.5% calm.
- Then the hour moves 0.9%. Calm hours move about ±0.26% and wild ones about ±0.86%, each spread like a bell curve. A 0.9% move is 70 times more likely in a wild hour than in a calm one.
- Combine: 86.5% × 1 against 13.5% × 70, rescaled to add to 100%, gives 8% calm, 92% wild. One big move flips the belief.
- If the hour had moved 0.2% instead, the same sum gives 94% calm.
3. The standard deviation, also called σ (sigma): the typical size of a move or a gap away from its average. "±0.26% an hour" above is one standard deviation. Under a bell curve, about two moves in three fall within one standard deviation, and about 19 in 20 within two.
4. The z-score: how many standard deviations a value sits from its normal level.
- Example: the ETH/BTC ratio usually sits at 0.050, and its gaps are typically 0.001.
- Today it is 0.048: (0.048 − 0.050) ÷ 0.001 = z = −2.
- That is two typical gaps low, which happens about 1 time in 44 under a bell curve. So the rule says buy.
5. The half-life: with the band's strength θ, half of any gap closes in ln(2) ÷ θ hours. Here ln(2) is the natural log of 2, about 0.693.
- Example: θ = 0.1155 an hour gives 0.693 ÷ 0.1155 = 6 hours.
- A gap of 0.002 shrinks to 0.001 after 6 hours, and to 0.0005 after 12 hours.
- Each hour it closes about 11% of what is left.
The pattern across all of these
- Many things that look like patterns are in fake markets too. Sticky trend labels, "better fitting" models and the push of wild hours all were. Testing against a fake market is the cheapest way not to fool yourself.
- Volatility is the one thing that clearly has memory. Calm follows calm and wild follows wild. Mandelbrot (1963) and Engle (1982) found this long ago; we repeated it on crypto. That helps you size risk and set honest odds. It didn't give us a way to time trades.
- The far tails are fatter than the textbook says. Plan for liquidation and stop levels as if they are several times more likely to be touched than the formula claims.
Update, 16 October 2026: a clarification
Added after this page was published. The text above is left as it was.
- 93% and 94.3% come from two fits of the same model. The worked example uses one fit (94.3%), the findings another (93%). Across fits, a calm hour stayed calm 93% to 94% of the time.
Update, 21 October 2026: plain words
Added after this page was published. The text above is left as it was, except the explanations this lists.
- Aggressor now has a small example beside its explanation, and overfit a plain-words line and an example where it first appears.
Credits
- Andrey A. Markov, his 1906 paper on chains of dependent events: Markov models.
- Leonard E. Baum and Ted Petrie, "Statistical Inference for Probabilistic Functions of Finite State Markov Chains", Annals of Mathematical Statistics, 1966: the hidden Markov model.
- Lawrence R. Rabiner, "A Tutorial on Hidden Markov Models and Selected Applications in Speech Recognition", Proceedings of the IEEE, 1989: the standard account of the hourly update used here.
- James D. Hamilton, "A New Approach to the Economic Analysis of Nonstationary Time Series and the Business Cycle", Econometrica, 1989: regime models in economics and finance.
- Thomas Bayes, "An Essay towards Solving a Problem in the Doctrine of Chances", Philosophical Transactions of the Royal Society, 1763.
- J. Welles Wilder Jr., New Concepts in Technical Trading Systems, Trend Research, 1978: the ADX.
- G. E. Uhlenbeck and L. S. Ornstein, "On the Theory of the Brownian Motion", Physical Review, 1930.
- Evan Gatev, William N. Goetzmann and K. Geert Rouwenhorst, "Pairs Trading: Performance of a Relative-Value Arbitrage Rule", Review of Financial Studies, 2006: trading a gap between two linked prices.
- Benoit Mandelbrot, "The Variation of Certain Speculative Prices", Journal of Business, 1963; Robert F. Engle, "Autoregressive Conditional Heteroscedasticity with Estimates of the Variance of United Kingdom Inflation", Econometrica, 1982: fat tails and volatility that clusters.
- Rama Cont, Arseniy Kukanov and Sasha Stoikov, "The Price Impact of Order Book Events", Journal of Financial Econometrics, 2014: order flow imbalance.
- CVD, absorption and liquidation heatmaps are trader tools, with no known originator.
- The fake-market tests and every model's code are our own.
- Data: Binance's and Bybit's public prices, trades, funding and open interest.
- PerpGremlin and Claude, Models for reading a market, and what they showed on real prices, TerminalGremlin, 2026: the tests, the code and the words.
How far to trust a Sharpe ratio →
Educational research from public market data; any trading discussed is paper, never real. Nothing here is advice. The full notice.