Free lesson · Quant strategy development
04 / Momentum and trend: information that persists
Open interactive lessonPractice calculationsExplore labs
Start with the idea
Momentum measures persistence in past price changes. The lookback defines what “trend” means; the holding and execution horizons determine whether that information can be used economically.
Symbols, units & horizon
- mᵢ,ₜ: sum of historical log returns for instrument i
- rᵢ,ₜ₋ⱼ: log return j periods before t
- k: most recent included lag, skipping newer returns if k>0
- L: oldest included lag
- L−k+1: number of included returns
- σ̂: per-period volatility estimated from history
- sᵢ,ₜ: bounded score between −1 and 1
- tanh: hyperbolic tangent, (e²ˣ−1)/(e²ˣ+1)
When and why to use this
Use simple momentum as a transparent baseline against which to test complex pattern recognition. Volatility scaling and a bounded score can help compare signals across instruments.
Build and bound a momentum score
- Add the lagged log returns from k through L, giving n=L−k+1 observations. Under an IID equal-variance approximation, their sum has SD .
- Divide cumulative momentum by that scale to get x. The bounded transformation is , which approaches ±1. Its inverse is for |s|<1.
Cumulative log return=.04, per-period vol=.02, n=4: x=1 and score=tanh1≈.761594. This bounded value is not a 76% win probability.
A lagged cumulative log return measures trend from k periods ago through L periods ago. Skipping the most recent observations can test whether very short-horizon reversal contaminates a slower trend. The bounded score is an example normalisation, not an optimal universal rule. Both lookbacks and volatility estimates must be fixed through a documented training process.
Time-series momentum asks whether an instrument’s own direction persists. Cross-sectional momentum ranks instruments against peers and typically combines long winners with short losers. The latter can acquire sector, market, size or liquidity exposures unless the portfolio construction controls them.
| Variable | Potential role | Trade-off |
|---|---|---|
| Lookback L and skip k | Choose the information horizon | Shorter windows react faster but often trade more |
| Volatility estimate | Compare signal strength and set exposure | Slow estimates miss shocks; fast estimates can cause churn |
| Rebalance interval | Translate signal updates into trades | Less trading can reduce costs and delay response |
| Trend breadth / market regime | Test whether broad participation matters | A regime filter adds another model-selection problem |
| Liquidity and carry | Determine executable size and holding cost | A strong price signal can still have negative net carry |
Python implementation
Self-contained teaching example. Python 3.10+; dependencies and input conventions are shown in the code and notation. Run in your own Python environment.
from math import tanh, sqrt
def momentum_score(returns_oldest_first, oldest_lag, newest_lag, per_period_sd):
"""Last supplied return is lag 0, already observable at decision time."""
if not 0 <= newest_lag <= oldest_lag < len(returns_oldest_first) or per_period_sd <= 0:
raise ValueError("Invalid lag window or volatility")
recent = list(reversed(returns_oldest_first))
momentum = sum(recent[newest_lag:oldest_lag+1])
scale = per_period_sd*sqrt(oldest_lag-newest_lag+1)
return momentum, tanh(momentum/scale)
print(momentum_score([.01,.02,-.01], 2, 0, .02))Continue learning
Quant Strategy Development — all lessons- 01 / Start with a source of return
- 02 / The variables that actually enter the decision
- 03 / Test predictive information before a complex model
- 04 / Momentum and trend: information that persists
- 05 / Mean reversion and relative value
- 06 / Carry, events, and liquidity provision
- 07 / Convert a forecast into a trade decision
- 08 / Build a bot that preserves the experiment
- 09 / Decide whether the edge is real enough to continue
Quantitative finance and development glossary · Python resources and libraries · Research sources and limitations