Skip to main content
Back to Tutorial
IntermediateHKMomentum8 min readUpdated 2026-03-18

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.

Fork the template to follow along:
TemplateHKMomentum
MA-Cross on HSTECH

5/20 crossover with volatility filter on Hang Seng TECH

Sharpe
1.81
Return
+24.8%
Max DD
−12.3%
Forks
124

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

  1. Forgetting HK-specific fees (~10 bp round-trip) — they erase most of the edge at daily frequency. Move to weekly rebalance first, then optimise.
  2. Using a fixed 20-day volatility threshold. 35% works in 2020–2024; 2015 pre-crisis needs a lower cutoff. Calibrate per regime.
  3. 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

Sharpe
1.81
Return
+24.8%
Max drawdown
−12.3%
Win rate
+62.4%
Trades
184
Days
540

Equity curve

Strategy
Benchmark

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.

Ready to learn?

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.