Most algo traders build strategies as if they’re going to work across all market conditions. Some do well in trends. Some do well in sideways markets. A few manage to work in both. But almost none are specifically designed with the understanding that the market has distinct states – up, down, sideways – and that different types of algorithms have fundamentally different performance characteristics in each state.
Richard, a logic design engineer turned quantitative trader who has been developing systematic strategies since 2011, built his QuantSys.net framework around exactly this insight. State-Based Market Design (SBMD) is a methodology for identifying which market state you’re in, deliberately building algorithms that excel in each state, and combining them in a portfolio where each algo takes the lead when its state is active. The result is more consistent equity growth than any single algorithm can produce.
This episode is technical and specific – Richard goes deep on how he defines the three states, how he matches algorithms to states, and the practical challenges of managing state-transitions in live trading.
Watch the full episode below, then read on for the complete breakdown.
The Core Problem: Algos Are State-Dependent
Richard’s starting observation is simple: a momentum algorithm designed to catch sustained trends will dramatically underperform during sideways, choppy conditions. A mean reversion algorithm designed to profit from oscillating markets will be destroyed during strong trends. Neither algorithm is “broken” – they’re each excellent at capturing what they were designed for, but their performance is entirely dependent on which market state is currently active.
The traditional response to this is to run a single “all-weather” algorithm and accept that it will have some periods of underperformance. Richard’s response is different: build specialised algorithms, identify the market state, and deploy the right algorithm for the current state.
He traces this back to his engineering background. As a logic design engineer, he spent as much time verifying code as writing it – trying to find every way the code could fail before deployment. He applies the same rigour to algorithm development: his primary job when building a new algo is to find reasons it will fail in live markets, not to celebrate its backtest performance.
Defining the Three States
Richard works primarily with S&P 500 index futures and 10-year Treasury note futures. He defines three market states for the S&P on a monthly timeframe:
- Strong Up: A month where the S&P has a clearly positive close (Richard uses thresholds – roughly above +30 points for the month in the period he studied).
- Sideways: A month where the S&P closes between approximately -4 and +30 points. Even a positive close of 10 points for the month is “sideways” in this framework, because the market hasn’t shown enough directional commitment to favour a momentum strategy.
- Strong Down: A month where the S&P closes below roughly -4 points.
When he analysed 20+ years of S&P data, he found the distribution across the three states was roughly: Strong Up approximately 40-45% of months, Sideways approximately 30-35%, and Strong Down approximately 20-25%.
The specific thresholds matter because they’re what makes a particular algorithm type the “hero” rather than the “villain” for that state. The goal is not to find precise mathematical boundary conditions but to define states in a way that creates maximum behavioural differentiation between algorithm types.
Hero and Villain Algorithms by State
For each state, one type of algorithm is the natural “hero” and another is the natural “villain”:
- Strong Up state: Hero is a long momentum algorithm. Villain is a mean reversion algorithm (shorting at perceived highs in a market that keeps making new highs destroys equity).
- Strong Down state: Hero is a short momentum algorithm. Villain is any long-biased algorithm (it doesn’t matter how good your entry model is if you’re long in a market that falls 10-15% in a month).
- Sideways state: Hero is a mean reversion algorithm. Villain is a trend/momentum algorithm (breakouts reverse, trends fail, the algorithm constantly enters late and gets stopped out on reversals).
Richard also has experimented with iron condors as a sideways-state strategy, given that limited-range markets are the natural environment for options premium collection strategies.
The State Prediction Problem
The obvious challenge: you can only know which state just occurred after the month is over. You can’t perfectly predict which state the next month will be in. Richard is honest about this – state prediction is difficult, and the framework doesn’t claim to solve it precisely.
His approach is probabilistic rather than deterministic. He doesn’t try to predict with certainty whether next month will be up, down, or sideways. Instead, he runs multiple algorithms simultaneously across all three state categories but with different weightings based on current market conditions, and he reduces the allocation to villain-state algorithms when conditions look unfavourable for them.
For example, if the market has been in a strong uptrend for several consecutive months, he’ll reduce the allocation to mean reversion algorithms because the state has been persistently unfriendly to them. If volatility is elevated and the market has been making large directional moves, he’ll reduce the sideways-state algorithm allocation.
Building the Three-State Portfolio
The ideal portfolio in Richard’s framework has at least one algorithm for each of the three states. In practice, he runs more than three – multiple algorithms per state, built with different entry logic, stop approaches, and timeframes, to reduce correlation within each state group.
The mathematical benefit of the approach is significant: if you have algorithms that are genuinely uncorrelated across states – the up-state algorithm underperforms in sideways and down conditions, but the sideways-state algorithm compensates – the combined portfolio has dramatically lower drawdowns and more consistent returns than any individual component.
He uses a software tool called QuantSys (quantsys.net) that he built to facilitate the design and monitoring of state-based algorithm portfolios. The tool allows him to define state boundaries, assign algorithms to states, and track performance attribution by state over time.
Practical Considerations and Limitations
Richard is candid about the challenges:
- State transitions are messy in practice: Real markets don’t flip cleanly between states on the last trading day of the month. There are transition periods where the market is ambiguous, and algorithms built for one state can hurt performance in the transition before the new state is established.
- Curve-fitting risk: The state boundaries themselves can be over-fitted to historical data. Richard’s mitigation: use walk-forward testing on the state definition parameters, not just the algorithm parameters.
- The “10-state” extension: He describes extending the framework beyond three states to ten or more, capturing finer-grained market conditions. While potentially more powerful, this introduces higher combinatorial complexity and proportionally higher curve-fitting risk.
His engineering background drives his validation approach: after building any new state-state algo combination, he applies the same relentless “how does this fail?” interrogation that he brings to all his algorithmic work.
Why State-Based Design Is Different from Regime Filtering
It’s worth distinguishing Richard’s approach from conventional regime filtering. In traditional regime filtering, you build a single strategy and add a filter that turns it on or off based on detected market conditions. The strategy is fixed; the filter gates it.
In state-based design, the strategy itself is built specifically for its state. The momentum algorithm is not a generic algorithm with a trend filter applied – it’s an algorithm whose parameters, entry logic, and stop placement are all optimised for strong-trending conditions. The mean reversion algorithm is similarly purpose-built for sideways markets. This specificity makes each algorithm better at what it does in its assigned state, rather than being a compromised all-weather strategy that performs adequately but not excellently in any condition.
The practical implication is that state-based portfolios tend to have better performance in each individual state than regime-filtered single-strategy portfolios. The trade-off is complexity: you’re managing multiple distinct algorithms, monitoring state transitions, and making allocation decisions. Richard’s QuantSys platform is specifically built to manage this complexity. For traders willing to invest in this level of systematic rigour, the performance consistency reward is meaningful.
Related episodes
- Surviving Uncertain Markets with Richard Brennan
- How to Build Mean Reversion Trading Strategies with Stefan Friedrichowski
- Building Mean Reversion Trading Strategies with Cesar Alvarez – Part 1
Want more on combining trading algorithms and portfolio construction? Subscribe to the Better System Trader podcast for weekly interviews with the world’s top systematic traders and quantitative researchers.

