Learn momentum quant strategies
Why does momentum exist? Behavioral biases: investors undereact to new information initially (anchoring, conservatism bias), causing gradual price adjustment. Later, herding and overeaction can push prices further before eventual reversal. Momentum strategies profit during the undereaction and trend-following phases.
What Are Momentum Strategies?
Core components:
- Lookback period (): Time window to measure past performance (typically 3-12 months)
- Holding period (): Duration to hold positions (typically 1-3 months)
- Ranking metric: How to score momentum (absolute return, risk-adjusted, relative)
- Portfolio construction: Equal-weight, momentum-weight, or optimization
How to Build a Momentum Strategy (From Scratch)
Step 1: Calculate Momentum Signals
Simple Price Momentum:
Where:
- = momentum score for asset at time
- = price of asset at time
- = lookback period
- = cumulative return from to
WHY this formula? We want to identify assets with strongest recent price appreciation. The percentage change normalizes across different price levels—a ₹10 stock gaining₹2 (20%) has more momentum than a ₹1000 stock gaining ₹10 (1%).
Risk-Adjusted Momentum (Sharpe Ratio):
Where:
- = mean return over lookback
- = standard deviation of returns
WHY adjust for risk? Two stocks may have 20% returns, but if one achieved it smoothly and the other through wild swings, the smooth one has more sustainable momentum (better risk-adjusted).
Then go long top quantile (e.g., top 20%) and short bottom quantile.
WHY ranking? Removes market-wide trends. In a bull market, all stocks may have positive returns, but we want relative winners. Ranking makes the strategy market-neutral.
Step 2: Portfolio Construction
Equal-Weight Winners:
\frac{1}{N_L} & \text{if } \text{Rank}_i \geq 0.8 \\ -\frac{1}{N_S} & \text{if } \text{Rank}_i \leq 0.2 \\ 0 & \text{otherwise} \end{cases}$$ Where $N_L$ = number of longs, $N_S$ = number of shorts. **Momentum-Weighted:** $$w_i = \frac{M_i}{\sum_{j \in \text{Winners}} M_j}$$ **WHY different weighting?** Equal-weight is simpler and more diversified. Momentum-weight concentrates in strongest signals but increases concentration risk. ### Step 3: Rebalancing Rebalance every $H$ months. Typical: $L=12$ months, $H=1$ month. **WHY not daily?** Transaction costs would eat profits. Monthly rebalancing balances signal decay against costs. > [!example] Worked Example 1: 5-Stock Universe > **Setup:** $L = 6$ months, $H = 1$ month, long top 2, short bottom 2. | Stock | Price6mo ago | Price Now | Return | Rank | |-------|--------------|-----|---| | A | ₹100 | ₹120 | 20% | 2 | | B | ₹50 | ₹65 | 30% | 1 | | C | ₹200 | ₹210 | 5% | 3 | | D | ₹150 | ₹135 | -10% | 4 | | E | ₹80 | ₹64 | -20% | 5 | **Step 1: Calculate momentum** - Stock B: $(65-50)/50 = 0.30$ (30%) - Stock A: $(120-100)/100 = 0.20$ (20%) - Etc. **Step 2: Rank** (already shown) **Step 3: Position sizing** - Long B and A: 50% each - Short D and E: -50% each **WHY these positions?** B and A have strongest upward momentum (ranks 1-2). D and E have strongest downward momentum (ranks 4-5). We bet the trends continue. **Step 4: Next month** If B rises 5% and E falls 3%, your P&L: $$\text{P\&L} = 0.5(5\%) + 0.5(0\%) + (-0.5)(-3\%) + (-0.5)(0\%)$$ $$= 2.5\% + 0\% + 1.5\% + 0\% = 4\%$$ **WHY this P&L?** Long positions gain when prices rise, shorts gain when prices fall (you buy back cheaper). > [!example] Worked Example 2: Skip-Month Effect > **Problem:** Standard momentum uses all12 months. Research shows the most recent month (0-1 month) often shows ==reversal==, not continuation. **Solution:** Skip the recent month. Use returns from $t-12$ to $t-1$ months. $$M_i^{\text{skip}}(t) = R_i(t-12, t-1) = \frac{P_i(t-1) - P_i(t-12)}{P_i(t-12)}$$ **Example:** - Stock F: 12mo ago = ₹100, 1mo ago = ₹140, today = ₹135 - Standard: $(135-100)/100 = 35\%$ - Skip-month: $(140-100)/100 = 40\%$ **WHY skip?** The recent drop (₹140→₹135) might be temporary profit-taking, not trend reversal. The 40% gain over 11 months is the true momentum signal. Including the last month adds ==microstructure noise== (bid-ask bounce, short-term reversals). **Data shows:** Skip-month momentum (12-1) has **higher Sharpe ratios** than standard (12-0) momentum. ## Advanced: Risk Management & Enhancements ### Position Sizing with Volatility Targeting **Why?** High-volatility stocks can dominate risk even with equal weights. **Inverse-volatility weighting:** $$w_i = \frac{M_i / \sigma_i}{\sum_{j \in \text{Winners}} M_j / \sigma_j}$$ **Derivation:** - Goal: Each position contributes equal risk - Risk contribution of asset $i$: $w_i \cdot \sigma_i$ - Set $w_i \cdot \sigma_i = C$ (constant) → $w_i \propto 1/\sigma_i$ - Combine with momentum signal: $w_i \propto M_i/\sigma_i$ > [!example] Worked Example 3: Vol-Adjusted Weighting > Two winners: > - Stock X: $M_X = 40\%$, $\sigma_X = 30\%$ (annualized) > - Stock Y: $M_Y = 30\%$, $\sigma_Y = 15\%$ **Equal weight:** 50% each → Portfolio vol≈ 23% **Momentum weight:** $w_X = 40/(40+30) = 57\%$, $w_Y = 43\%$ **Vol-adjusted:** $$w_X = \frac{40/30}{40/30 + 30/15} = \frac{1.33}{1.33 + 2} = 40\%$$ $$w_Y = 60\%$$ **WHY this makes sense?** Y has weaker momentum but is less volatile. Vol-adjusted gives Y more weight, **reducing portfolio volatility** while maintaining momentum exposure. ### Combining Momentum with Value **Momentum-Value Strategy:** $$\text{Score}_i = \alpha \cdot \text{Rank}_{M,i} + (1-\alpha) \cdot \text{Rank}_{V,i}$$ Where $\text{Rank}_{V,i}$ = value rank (e.g., P/E, P/B). **WHY combine?** Momentum and value have **low correlation** and sometimes negative. When momentum crashes (2009), value often performs. Combined strategies have **higher Sharpe and lower drawdowns**. ## Common Mistakes & How to Avoid Them > [!mistake] Mistake 1: Ignoring Transaction Costs > **Wrong idea:** "This backtest shows 25% annual returns!" > **Why it feels right:** Gross returns look amazing in simulation. > **Steel-man:** Paper trading ignores slippage, commissions, market impact. High-turnover momentum can have 200%+ annual turnover. > **The fix:** > - Model realistic costs: $\text{Cost} = \text{commission} + \text{slippage} + \text{market impact}$ > - For small caps: $\text{market impact} \approx 0.1\% \times \sqrt{\frac{\text{Trade Size}}{\text{ADV}}}$ > - Reduce turnover: longer holding periods, buffer zones (don't trade unless rank changes by >10%) > [!mistake] Mistake 2: Data Snooping / Overfitting > **Wrong idea:** "12-month lookback with 1.2-month holding and skip3 weeks optimizes to 32% Sharpe!" > **Why it feels right:** Backtesting many parameter combinations finds "optimal" settings. > **Steel-man:** You're fitting to noise. Out-of-sample, overfit parameters crash. > **The fix:** > - Use ==walk-forward analysis==: optimize on training period, test on next period, roll forward > - Stick to parameter ranges with **economic rationale** (3-12 month lookback makes behavioral sense) > - ==Occam's razor==: simpler strategies (fewer parameters) generalize better > [!mistake] Mistake 3: Ignoring Momentum Crashes > **Wrong idea:** "Momentum always works if I hold long enough." > **Why it feels right:** Long-run average returns are positive. > **Steel-man:** Momentum has **severe tail risk**. 2009: momentum lost 50%+ in weeks during crisis reversal. > **The fix:** > - **Trend filter**: Only deploy momentum when market index (Nifty) is above 10-month moving average > - **Volatility scaling**: Reduce exposure when VIX spikes > - **Stop-loss**: Exit all positions if portfolio loses >10% in a month ## Performance Metrics > [!formula] Sharpe Ratio for Momentum > $$\text{Sharpe} = \frac{E[R_p] - R_f}{\sigma_p}$$ Where: - $E[R_p]$ = expected portfolio return - $R_f$ = risk-free rate - $\sigma_p$ = portfolio volatility **Typical momentum Sharpe:** 0.4-0.8 (vanilla), 0.8-1.2 (enhanced with vol-targeting and filters) **Maximum Drawdown:** $$\text{MDD} = \max_{t \in [0,T]} \left[ \max_{\tau \in [0,t]} V(\tau) - V(t) \right]$$ Where $V(t)$ = portfolio value at time $t$. **Typical momentum MDD:** 20-40% (can be 50%+ in crashes) ## Implementation Checklist 1. **Data:** Clean adjusted prices (splits, dividends), survivorship-bias-free 2. **Universe:** Start with liquid large-caps (e.g., Nifty 200), avoid penny stocks 3. **Lookback:** 6-12 months (skip most recent month) 4. **Holding:** 1-3 months 5. **Portfolio:** Long/short topbottom 20%, or long-only top 30% 6. **Rebalance:** Monthly (pick consistent day, e.g., month-end) 7. **Risk:** Vol-target 10-15%, max position size 5%, stop-loss at -10% monthly 8. **Costs:** Model 0.1-0.5% per trade depending on liquidity > [!recall]- Explain to a 12-Year-Old > Imagine you're racing toy cars. Some cars are zoming ahead fast, and some are stuck in the mud going backwards. Momentum is a simple idea: the cars that are already going fast will probably keep going fast for a little while longer, and the stuck cars will stay stuck. So what do you do? You bet on the fast cars (buy them) and bet against the slow cars (short them—basically, you borrow a slow car, sell it now, and promise to give it back later when's even cheaper). Why does this work? Because people take time to notice good news. When a company does well, investors slowly realize "oh, this is actually good!" and keep buying, pushing the price up gradually. It's like when your friend tells you a game is awesome, but you don't believe it until you see everyone playing it, then you finally try it too. But here's the trick: you can't just use last week's winners—sometimes they bounce around too much. You look at the past year (but skip the last month because that's just random noise), find the real champions, and ride that wave until it stops. > [!mnemonic] RHC for Momentum > - **R**ank the universe (find relative winners/losers) > - **R**isk-adjust (use Sharpe, not just raw returns) > - **H**old for medium term (1-3 months, not daily churn) > - **C**ost-aware (transaction costs kill high-frequency momentum) ## Connections - [[Time-Series Momentum]] - momentum within a single asset vs. its own history - [[Cross-Sectional Momentum]] - momentum relative to other assets (this note) - [[Mean Reversion Strategies]] - the opposite phenomenon; momentum eventually reverts - [[Factor Investing]] - momentum is one of the core factors (others: value, quality, size) - [[Risk Parity]] - vol-weighting technique applicable to momentum portfolios - [[Behavioral Finance]] - why momentum exists (undereaction, herding, overconfidence) - [[Portfolio Optimization]] - mean-variance optimization for momentum portfolios - [[Backtesting Best Practices]] - how to avoid overfitting momentum parameters --- #flashcards/stock-market What is momentum in quantitative trading? :: The tendency of assets with strong recent performance to continue performing well (or poorly) in the near future, driven by behavioral biases like undereaction and herding. What is the formula for simple price momentum over lookback period L? ::: $M_i(t) = \frac{P_i(t) - P_i(t-L)}{P_i(t-L)}$, the percentage return from t-L to t. Why use risk-adjusted momentum instead of raw returns? ::: To distinguish between smooth trends (sustainable momentum) and volatile swings (noise). Formula: $M^{SR} = \mu/\sigma$ (Sharpe ratio). What is the "skip-month" effect in momentum? ::: The most recent month (0-1 month) often shows reversal, not continuation. Better to use returns from t-12 to t-1 months, skipping the last month to avoid microstructure noise. What is cross-sectional momentum? ::: Ranking assets by momentum score and going long the top quantile and short the bottom quantile, making the strategy market-neutral and focused on relative performance. What are typical lookback and holding periods for momentum? ::: Lookback L = 6-12 months, Holding H = 1-3 months. Balances signal strength against transaction costs and mean reversion. How does inverse-volatility weighting improve momentum portfolios? ::: Weights positions as $w_i \propto M_i/\sigma_i$, so each position contributes equal risk. Reduces portfolio volatility while maintaining momentum exposure. What is a momentum crash? ::: Severe drawdown when trends reverse suddenly (e.g., 2009 crisis when momentum lost 50%+). Caused by coordinated unwinding of crowded momentum positions during panic. How can you mitigate momentum crash risk? ::: Use trend filters (only trade when market is above 10-month MA), volatility scaling (reduce exposure when VIX spikes), or stop-losses (exit if portfolio drops >10% monthly). Why combine momentum with value factors? ::: Momentum and value have low/negative correlation. Combined strategies have higher Sharpe ratios and lower drawdowns—when momentum crashes, value often performs. What is a typical Sharpe ratio for momentum strategies? ::: Vanilla momentum: 0.4-0.8. Enhanced (with vol-targeting, filters): 0.8-1.2. Compare to market Sharpe ~0.3-0.5. What is the biggest mistake in momentum backtesting? ::: Ignoring transaction costs. High turnover (200%+) and slippage can eliminate 5-10% annual return. Always model realistic costs and market impact. ## 🖼️ Concept Map ```mermaid flowchart TD B[Behavioral biases] -->|cause| M[Momentum effect] B -->|underreaction and herding| AC[Return autocorrelation] AC -->|basis for| MS[Momentum strategy] M -->|persists until| MR[Mean reversion] MS -->|buys| W[Recent winners] MS -->|shorts| Lo[Recent losers] MS -->|uses| LB[Lookback period L] MS -->|uses| HP[Holding period H] LB -->|computes| PM[Price momentum score] PM -->|risk-adjusted by| SR[Sharpe momentum] PM -->|ranked into| CS[Cross-sectional rank] CS -->|makes strategy| MN[Market-neutral] CS -->|drives| PC[Portfolio weights] ``` ## 🔊 Hinglish (regional understanding) > [!intuition]- Hinglish mein samjho > Momentum strategy ka basic idea bahut simple hai: jo stocks recently acha perform kar rahe hain, wo age bhi thoda time tak achha perform karenge. Aur jo bure perform kar rahe hain, wo bure hi rahenge. Yeh pattern kyon hota hai? Kyunki investors ko naya information samajhne mein time lagta hai. Jab kisi company ke bare mein good news ati hai, log turant nahi react karte—slowly slowly realize karte hain ki "haan, yeh stock achha hai" aur gradually buying pressure badhta rahta hai. Yeh "undereaction" aur phir "herding" (sabhi logek sath follow karte hain) momentum create karta hai. > > Quant momentum strategy mein hum yeh pattern systematically exploit karte hain. Pehle hum pichle 6-12 months ka data dekhte hain (lekin last month ko skip karte hain kyunki usme zyada noise hota hai), stocks ko rank karte hain, aur top20% winners ko buy karte hain aur bottom 20% losers ko short sell karte hain. Iska matlab market ke against bet nahi kar rahe—hum relative winners aur losers dhondh rahe hain. Phir 1-3 months hold karte hain aur positions ko rebalance karte hain. Important baat yeh hai ki transaction costs ko dhyan mein rakhna padta hai—agar har din trading karoge toh brokerage aur slippage sara profit kha jayega. Aur momentum crashes bhi hote hain (2009 mein 50% loss ho gaya tha), isliye risk management zaroori hai: volatility dekh ke exposure adjust karo, trend filters use karo, aur stop-losses lagao. Smart implementation se momentum strategies long-term mein solid returns de sakti hain. ![[audio/6.1.08-Learn-momentum-quant-strategies.mp3]]