MA-Cross on HSTECH · regime-aware trend following
A disciplined 5/20 moving-average crossover on Hang Seng TECH, filtered by realised volatility. Designed to teach when trend-following works and when it quietly bleeds.
Moving average crossovers are the first strategy most quants implement. Most of them also implement it wrong. This template shows the minimum set of guards you need to turn a textbook exercise into something that survives a real HK trading week.
5/20 crossover with volatility filter on Hang Seng TECH
Why this works
Trend-following extracts the autocorrelation in price that shows up when a regime persists — post-policy-shift HK tech rallies are the textbook case. The volatility filter is what makes this teachable: it keeps the crossover from firing during choppy consolidation, which is where naive MA-cross strategies quietly bleed. Sector caps prevent the basket from collapsing into two or three names during a concentrated rally.
Common pitfalls
- Forgetting HK-specific fees (~10 bp round-trip) — they erase most of the edge at daily frequency. Move to weekly rebalance first, then optimise.
- Using a fixed 20-day volatility threshold. 35% works in 2020–2024; 2015 pre-crisis needs a lower cutoff. Calibrate per regime.
- Backtest survivorship bias on HSTECH — the index constituents changed twice. Use point-in-time membership, not today roster.
Try it yourself
Fork the template into your workspace. The entire configuration — code, parameters, backtest window, cost model — lands in a new private session. Tweak it, break it, and see how robust the edge actually is.
Backtest result
Equity curve
Signal: long when MA(5) > MA(20) and 20-day realised vol < 35%. Exit on the reverse cross or 3-ATR trailing stop. Position size = inverse vol weighted with 6% single-name cap. Rebalanced daily on close.
Related tutorials
Momentum: the only factor that keeps working
From Fama–French critique to A-share rotation — a working primer on the most robust anomaly in finance.
50ETF Momentum Rotation · the most robust factor
Monthly cross-sectional momentum on CN blue chips with an Amihud illiquidity penalty. The simplest viable production momentum strategy.
Fork it into your workspace.
The whole template — code, parameters, backtest config — lands in a new private session. Tweak it, run it, break it, learn.