A strategy came across my desk a while back with a Sharpe near two and a curve that looked like a staircase, and the first thing I did was ignore the top-line number. Not because I doubted it, but because a single aggregate figure tells you almost nothing about where the money actually came from. When I split the same trades into buckets by market condition, the picture fell apart. Basically all the profit came from one long trending stretch of maybe six months, and outside of that window the thing was flat to slightly negative. The aggregate hid a strategy that only knew how to do one thing.
This happens constantly, and the reason it is so easy to miss is that markets spend uneven amounts of time in each state. If a backtest window happens to contain one big clean trend, a trend-follower will look brilliant over the whole span even if it gets chopped to pieces the other eighty percent of the time. The average smears the good and the bad together and hands you a number that describes the sample, not the strategy.
What a regime actually is, for backtesting purposes
You do not need a fancy hidden-Markov model to get most of the value here. A regime is just a label you attach to each historical bar or window describing what kind of market it was. Three buckets cover the vast majority of what you care about, and they are cheap to compute from data you already have.
- Trending. Price is making directional progress relative to its own noise. A simple proxy is the ratio of net move over a window to the sum of absolute bar-to-bar moves, sometimes called an efficiency ratio. High means clean travel, low means it went nowhere in a hurry.
- Mean-reverting or ranging. Price keeps returning toward a center. Low efficiency ratio, and often a negative short-horizon autocorrelation, where an up bar tends to be followed by a down bar.
- High-volatility. Realized volatility is elevated versus its own recent history. This one overlaps the other two on purpose, because a market can be both trending and violent, and your strategy might survive one but not the combination.
The exact thresholds matter less than picking them once and freezing them. I usually rank each window against its own rolling history, so a bar is trending if its efficiency ratio sits in, roughly, the top third of the trailing distribution, and high-vol if realized vol is in the top quartile of its trailing distribution. Percentile-based labels travel across assets and time periods far better than hard-coded absolute cutoffs, which quietly break the moment you move from one instrument to another.
The segmentation workflow
Here is the loop I run, and none of it requires re-running the strategy. You compute the labels once, then you slice the trade log you already produced.
- Label every historical bar with a regime tag using a lookback window that is decided before you look at any results. Lock the window and the thresholds. Changing them after you see performance is just curve-fitting with extra steps.
- Tag each closed trade by the regime that was in effect when it opened. Entry-time labeling is the honest choice, because that is the only information you had when you committed capital. Labeling by the regime the trade happened to end in leaks the future.
- Group the trades by tag and report each bucket on its own. Net return, hit rate, average win versus average loss, max drawdown inside that bucket, and, the part people skip, the trade count.
- Compare the buckets against each other and against how much calendar time each regime actually occupied. A bucket that produced great numbers on twelve trades is a rumor, not a result.
The trade count is the guardrail for the whole exercise. It is very common to slice a backtest into regimes and find that your strategy looks fantastic in high-volatility conditions, then notice it only took nine trades there across ten years of data. That is not an edge you can lean on, it is a handful of coin flips that happened to land your way. I want to see enough trades per bucket that the numbers would survive dropping the single best trade. If removing one winner flips the bucket from green to red, the bucket was never really green.
What the split tends to reveal
Once you do this a few times you start to recognize the shapes. A trend-follower that earns almost everything in the trending bucket and gives a chunk back in the ranging bucket is behaving exactly as designed, and the honest question becomes whether you can tolerate the ranging periods long enough to be present for the trends. A mean-reversion strategy usually shows the mirror image, quietly compounding in the ranging bucket and getting run over when a real trend shows up. Neither of those is a problem by itself. The problem is not knowing which one you own.
The genuinely dangerous case is the strategy that looks decent everywhere in aggregate but, once split, turns out to make all its money in the high-volatility bucket while bleeding slowly the rest of the time. Those strategies feel great during a chaotic stretch and then die a thousand paper cuts in the calm that follows, and the aggregate number papers over the whole thing because the volatile wins were large enough to carry the average. Splitting by regime is how you catch that before it catches you.
A concrete failure mode worth naming, because I have walked into it myself. You optimize parameters on a window that happens to be mostly trending, the optimizer naturally hands you settings tuned for trends, and your out-of-sample test also lands in a trending stretch because trends cluster. Everything validates. Then the market goes sideways for a year and the strategy you deployed has genuinely never been tested in the conditions it is now living in. Regime buckets make that gap visible on day one, because you can look straight at the ranging bucket, see it holds only a thin scatter of trades, and know you are flying blind there regardless of how clean the overall equity curve looks.
A few rules of thumb
Report every bucket even when one is ugly. The instinct is to lead with the regime where the strategy shines, but the losing bucket is usually the more informative one, because it tells you what environment will hurt you and roughly how much. Size a strategy for the regime it survives, not the one it thrives in.
Weight the buckets by how much time each regime actually occupies in a long history, not by how many appear in your particular test window. A strategy that only earns in a regime the market visits rarely needs a much bigger edge per trade to be worth running, because you will spend most of your life waiting for conditions that rarely come.
When you compare two strategies, compare them bucket by bucket rather than on the single aggregate figure. Two curves with identical top-line returns can have completely different regime profiles, and the one that is at least flat across all three buckets is almost always the one you want, because it needs fewer things to go right to keep working.
None of this replaces walk-forward testing or the usual out-of-sample discipline, it sits alongside them and answers a different question. Walk-forward asks whether your edge persists through time. Regime segmentation asks which conditions your edge depends on, which is the thing that actually determines whether you can hold the position when the market stops cooperating. If you run backtests inside Blockcircle, tagging the trade log by regime and reading each bucket separately is a small amount of extra work that has saved me from deploying more good-looking strategies than I would like to admit. The number you can trust is the worst bucket, not the average.