Market Regime Detection for Algo Trading | Python Analysis
2.1× channel medianLong-form34:58People & BlogsPublished Nov 10, 2026, 8:00 AM · 3w ago
Views
28,613
+5 views/hour
Views / hour now
5
measured 3h ago
Peak views / hour
330
2w ago
First 24 hours
3.9K
views at 24 h
Engagement
2.5%
likes + comments / views
Likes
661
2.3% of views
Comments
49
0.17% of views
Est. ad revenue
$343–$824
lifetime, $12–28.8 RPM
Checked every 12 h while the video is this age · last check 3h ago · next in 512 min. YouTube itself updates public counts with a short delay.
Avg views / day
1.3K
since upload
vs channel median
2.1×
this video's views ÷ the channel's usual
Rank in channel
#1
of 11 tracked
Views over time
53 readings
Total views Views gained per hour
Description
Consulting calls and strategy reviews: https://sharpe-edge.netlify.app
Educational content, not financial advice (full disclaimer below)
Every strategy has good and bad periods: trend followers bleed in choppy markets, mean reversion systems suffer in strong trends. Can we detect the current market regime and only trade when conditions favor our strategy? In this video I classify market regimes by directionality and volatility, analyze how strategy performance changes with the indicators at entry, and validate the regime filter out of sample, with walk-forward and against 1000 random filters, to check whether it adds a real edge or just reduces exposure.
In this video:
- What a market regime is, and why every strategy is implicitly a bet on one
- The two dimensions: directionality and volatility, and the 2x2 regime matrix
- Why volatility is predictable (volatility clustering) while direction is much less so
- Volatility indicators: ATR, realized volatility, GARCH, rolling percentile thresholds
- Directionality indicators: ADX, Kaufman's Efficiency Ratio, Hurst exponent, variance ratio, regression slope and R²
- Rule-based vs statistical classification: thresholds vs Hidden Markov Models
- Look-ahead bias in regime classification: full-sample thresholds, HMM smoothed vs filtered probabilities, unclosed bars
- Regime persistence: transition matrix, average duration, and indicator lag
- Whipsaw at regime boundaries: hysteresis and minimum duration
- Four ways to use regimes: binary filter, position sizing, parameter adaptation, portfolio allocation
- Trade-level analysis: R-multiples, why correlation alone is not enough, binned analysis with bootstrap confidence intervals, 2D heatmaps, MAE and MFE
- Data snooping: why testing many indicators and thresholds produces false positives
- Validation: in-sample / out-of-sample, anchored walk-forward on the filter only, threshold stability, holdout
- The random filter benchmark: does the filter beat random filters with the same exposure?
Resources:
Jupyter notebook: https://github.com/pietrobelli26/sharpe_edge_code
References:
- Hamilton (1989), A New Approach to the Economic Analysis of Nonstationary Time Series and the Business Cycle
- Lo, MacKinlay (1988), Stock Market Prices Do Not Follow Random Walks: Evidence from a Simple Specification Test
- Kaufman, Trading Systems and Methods
- Bailey, Borwein, López de Prado, Zhu (2014), The Probability of Backtest Overfitting
Do you use a regime filter on your strategies? Which indicator works best for you, and have you ever tested it against a random filter with the same exposure? Let me know in the comments.
🔔 Subscribe for algorithmic trading, quant research, and Python strategy development.
📌 Previous video - How to manage a portfolio of strategies: https://youtu.be/XDnnBQqvQlE
Disclaimer: This video is for educational purposes only and is not financial advice. Trading involves risk, and past performance (backtested or otherwise) does not guarantee future results.
Timestamps:
00:00 Intro
00:42 What is a market regime
01:08 Directionality and volatility
01:30 Volatility vs direction predictability
02:03 Volatility indicators
02:32 Directionality indicators
03:13 Rule-based vs statistical classification
03:41 Look-ahead bias
04:32 Regime persistence and transitions
05:01 Whipsaw and hysteresis
05:31 How to use regimes
06:02 Trade-level analysis
07:00 Binned analysis and heatmaps
07:41 MAE and MFE
07:56 Data snooping
08:24 In-sample / out-of-sample
08:53 Walk-forward on regime filters
09:41 Random filter benchmark
10:42 Python code
34:21 Recap
#AlgorithmicTrading #Python #QuantitativeTrading #MarketRegimes #TradingStrategy #Backtesting #Volatility
Details
- Published
- Nov 10, 2026, 8:00 AM
- Length
- 34:58 (2,098 s)
- Format
- Long-form
- Category
- People & Blogs
- Audio language
- EN
- Quality
- HD
- Captions
- No
- Made for kids
- No
- Licensed content
- No
- Video ID
- dzGEf3QWmXU
More from SharpeEdge
Pairs Trading in Python: Cointegration Tests & Dynamic Hedge Ratio Estimation7.9K views · 1w ago · +3/h
How to Manage a Portfolio of Trading Strategies (Without Overfitting) | Python Analysis18.2K views · 5w ago · +1/h
Is the Kalman Filter Just a Fancy Moving Average? Python Analysis + Backtest24.6K views · 7w ago · +1/h
Does Machine Learning Actually Improve a Trading Strategy? A Walk-Forward Stress Test25K views · 2mo ago · +1/h
When to Stop a Trading Strategy | Alpha Decay Detection in Python7.4K views · 2mo ago
How to Evaluate Prop Firm Challenges Using Monte Carlo Simulation | Python Analysis3.4K views · 3mo ago
How to Use Logistic Regression for Trading | Python Data Analysis & Backtest14.9K views · 3mo ago
How to Code a Trading Bot in MetaTrader 5 (Full Tutorial) | Expert Advisor from Scratch1.4K views · 4mo ago
Statistics from the YouTube Data API, tracked by FameX. Views per hour, revenue and comparisons are FameX estimates.