I built a Hidden Markov Model, regime detection, 2.5x leverage with a proper train test split, real Binance transaction costs, and zero parameter peeking on test data. I spent a significant amount of time building and testing this properly.
This video includes a full technical walkthrough of the entire model — every design decision, why the methodology matters, and where most implementations get it wrong. And then the result. Which speaks for itself.
If you want to think in distributions instead of emotions, this is where it starts.
📚 I don’t sell trading signals. I teach how to think quantitatively about markets.
Interested in more? https://www.pythonforfinance.info
Support my work and get access to the full Hidden Markov Model notebook with proper out-of-sample testing and over 50 notebooks with high quality code via Membership:
👉 https://www.youtube.com/channel/UC87aeHqMrlR6ED0w2SVi5nw/join
00: 00 – 01: 24 Intro
01: 24 – 02: 35 Constants/Parameters/Data
02: 35 – 04: 01 Train/Test split and Feature Engineering
04: 01 – 05: 54 Scaler and HMM Training (most important for understanding)
05: 54 – 07: 26 Labeling Bull/Bear states
07: 26 – 08: 41 Technical indicators for confirmation counts
08: 41 – 10: 10 Backtesting function in a nutshell
10: 10 – 11: 35 Grid Search Optimization
11: 35 – 12: 37 Applying to Testdata
12: 37 – 18: 10 Final results (+some yapping)
#claudecode #quantfinance #algorithmictrading #hiddenmarkovmodel #btctrading #AItrading #pythonforfinance