6.1.8 · HinglishAlgorithmic & Quant Trading

Learn momentum quant strategies

2,635 words12 min readRead in English

6.1.8 · Stock-Market › Algorithmic & Quant Trading

Momentum exist kyun karta hai? Behavioral biases ki wajah se: investors initially nayi information par undereact karte hain (anchoring, conservatism bias), jis se price adjustment gradually hoti hai. Baad mein, herding aur overeaction prices ko aur aage push kar sakti hai, eventual reversal se pehle. Momentum strategies undereaction aur trend-following phases ke dauran profit karti hain.

What Are Momentum Strategies?

Core components:

  1. Lookback period (): Past performance measure karne ka time window (typically 3-12 months)
  2. Holding period (): Positions hold karne ki duration (typically 1-3 months)
  3. Ranking metric: Momentum score karne ka tarika (absolute return, risk-adjusted, relative)
  4. Portfolio construction: Equal-weight, momentum-weight, ya optimization

How to Build a Momentum Strategy (From Scratch)

Step 1: Calculate Momentum Signals

Simple Price Momentum:

Jahan:

  • = asset ka momentum score time par
  • = asset ki price time par
  • = lookback period
  • = se tak ka cumulative return

Yeh formula kyun? Hum chahte hain un assets ko identify karna jinki recent price appreciation sabse strong ho. Percentage change alag-alag price levels ke beech normalize karta hai — ek ₹10 wala stock jo ₹2 gain karta hai (20%) zyada momentum rakhta hai ek ₹1000 wale stock se jo ₹10 gain karta hai (1%).

Risk-Adjusted Momentum (Sharpe Ratio):

Jahan:

  • = lookback period par mean return
  • = returns ka standard deviation

Risk ke liye adjust kyun karein? Do stocks ke returns 20% ho sakte hain, lekin agar ek ne yeh smoothly achieve kiya aur doosre ne wild swings ke zariye, toh smooth wala zyada sustainable momentum rakhta hai (better risk-adjusted).

Phir top quantile mein long jao (jaise top 20%) aur bottom quantile mein short jao.

Ranking kyun? Market-wide trends ko remove karta hai. Bull market mein, sabhi stocks ke positive returns ho sakte hain, lekin hum relative winners chahte hain. Ranking strategy ko market-neutral banati hai.

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}$$ Jahan $N_L$ = longs ki sankhya, $N_S$ = shorts ki sankhya. **Momentum-Weighted:** $$w_i = \frac{M_i}{\sum_{j \in \text{Winners}} M_j}$$ **Alag weighting kyun?** Equal-weight simpler aur zyada diversified hai. Momentum-weight strongest signals mein concentrate karta hai lekin concentration risk badhata hai. ### Step 3: Rebalancing Har $H$ months mein rebalance karo. Typical: $L=12$ months, $H=1$ month. **Daily kyun nahi?** Transaction costs profits kha jaate. Monthly rebalancing signal decay aur costs ke beech balance karta hai. > [!example] Worked Example 1: 5-Stock Universe > **Setup:** $L = 6$ months, $H = 1$ month, top 2 long, bottom 2 short. | Stock | Price 6 mahine pehle | Price Ab | 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: Momentum calculate karo** - Stock B: $(65-50)/50 = 0.30$ (30%) - Stock A: $(120-100)/100 = 0.20$ (20%) - Etc. **Step 2: Rank karo** (pehle se dikhaya hua) **Step 3: Position sizing** - B aur A long karo: 50% each - D aur E short karo: -50% each **Yeh positions kyun?** B aur A ka upward momentum sabse strong hai (ranks 1-2). D aur E ka downward momentum sabse strong hai (ranks 4-5). Hum bet kar rahe hain ki trends continue honge. **Step 4: Agla mahina** Agar B 5% badhta hai aur E 3% girta hai, tumhara P&L: $$\text{P\&L} = 0.5(5\%) + 0.5(0\%) + (-0.5)(-3\%) + (-0.5)(0\%)$$ $$= 2.5\% + 0\% + 1.5\% + 0\% = 4\%$$ **Yeh P&L kyun?** Long positions tab gain karti hain jab prices badhti hain, shorts tab gain karti hain jab prices girte hain (tum saste mein wapas khareed lete ho). > [!example] Worked Example 2: Skip-Month Effect > **Problem:** Standard momentum sabhi 12 months use karta hai. Research dikhati hai ki sabse recent mahina (0-1 month) aksar ==reversal== dikhata hai, continuation nahi. **Solution:** Recent month skip karo. $t-12$ se $t-1$ months ke returns use karo. $$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: 12 mahine pehle = ₹100, 1 mahina pehle = ₹140, aaj = ₹135 - Standard: $(135-100)/100 = 35\%$ - Skip-month: $(140-100)/100 = 40\%$ **Skip kyun karein?** Recent drop (₹140→₹135) temporary profit-taking ho sakta hai, trend reversal nahi. 11 mahino mein 40% gain asli momentum signal hai. Last month include karne se ==microstructure noise== add hoti hai (bid-ask bounce, short-term reversals). **Data dikhata hai:** Skip-month momentum (12-1) standard (12-0) momentum se **zyada Sharpe ratios** rakhta hai. ## Advanced: Risk Management & Enhancements ### Position Sizing with Volatility Targeting **Kyun?** High-volatility stocks equal weights ke saath bhi risk dominate kar sakte hain. **Inverse-volatility weighting:** $$w_i = \frac{M_i / \sigma_i}{\sum_{j \in \text{Winners}} M_j / \sigma_j}$$ **Derivation:** - Goal: Har position equal risk contribute kare - Asset $i$ ka risk contribution: $w_i \cdot \sigma_i$ - Set $w_i \cdot \sigma_i = C$ (constant) → $w_i \propto 1/\sigma_i$ - Momentum signal ke saath combine karo: $w_i \propto M_i/\sigma_i$ > [!example] Worked Example 3: Vol-Adjusted Weighting > Do 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\%$$ **Yeh kyun samajh aata hai?** Y ka momentum weak hai lekin woh kam volatile hai. Vol-adjusted Y ko zyada weight deta hai, **portfolio volatility reduce karta hai** jabki momentum exposure maintain rehta hai. ### Combining Momentum with Value **Momentum-Value Strategy:** $$\text{Score}_i = \alpha \cdot \text{Rank}_{M,i} + (1-\alpha) \cdot \text{Rank}_{V,i}$$ Jahan $\text{Rank}_{V,i}$ = value rank (jaise P/E, P/B). **Combine kyun karein?** Momentum aur value ki **low correlation** hoti hai aur kabhi kabhi negative bhi. Jab momentum crash karta hai (2009), value aksar perform karta hai. Combined strategies mein **higher Sharpe aur lower drawdowns** hote hain. ## Common Mistakes & How to Avoid Them > [!mistake] Mistake 1: Transaction Costs Ko Ignore Karna > **Galat soch:** "Yeh backtest 25% annual returns dikha raha hai!" > **Kyun sahi lagta hai:** Gross returns simulation mein amazing lagte hain. > **Steel-man:** Paper trading slippage, commissions, market impact ignore karta hai. High-turnover momentum mein 200%+ annual turnover ho sakta hai. > **The fix:** > - Realistic costs model karo: $\text{Cost} = \text{commission} + \text{slippage} + \text{market impact}$ > - Small caps ke liye: $\text{market impact} \approx 0.1\% \times \sqrt{\frac{\text{Trade Size}}{\text{ADV}}}$ > - Turnover kam karo: longer holding periods, buffer zones (tab tak trade mat karo jab tak rank >10% change na ho) > [!mistake] Mistake 2: Data Snooping / Overfitting > **Galat soch:** "12-month lookback with 1.2-month holding aur skip 3 weeks optimize hoke 32% Sharpe deta hai!" > **Kyun sahi lagta hai:** Bahut saare parameter combinations backtest karne par "optimal" settings milti hain. > **Steel-man:** Tum noise ko fit kar rahe ho. Out-of-sample mein overfit parameters crash ho jaate hain. > **The fix:** > - ==Walk-forward analysis== use karo: training period par optimize karo, agle period par test karo, aage roll karo > - Sirf un parameter ranges se chipke raho jinke paas **economic rationale** ho (3-12 month lookback behavioral sense rakhta hai) > - ==Occam's razor==: simpler strategies (fewer parameters) better generalize karti hain > [!mistake] Mistake 3: Momentum Crashes Ko Ignore Karna > **Galat soch:** "Momentum hamesha kaam karta hai agar main kaafi der tak hold karun." > **Kyun sahi lagta hai:** Long-run average returns positive hote hain. > **Steel-man:** Momentum mein **severe tail risk** hota hai. 2009: crisis reversal ke dauran kuch hi haftton mein momentum 50%+ lose ho gaya. > **The fix:** > - **Trend filter**: Sirf tab momentum deploy karo jab market index (Nifty) 10-month moving average se upar ho > - **Volatility scaling**: VIX spike karne par exposure kam karo > - **Stop-loss**: Agar portfolio ek mahine mein >10% lose kare toh saari positions exit karo ## Performance Metrics > [!formula] Sharpe Ratio for Momentum > $$\text{Sharpe} = \frac{E[R_p] - R_f}{\sigma_p}$$ Jahan: - $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 aur filters) **Maximum Drawdown:** $$\text{MDD} = \max_{t \in [0,T]} \left[ \max_{\tau \in [0,t]} V(\tau) - V(t) \right]$$ Jahan $V(t)$ = time $t$ par portfolio value. **Typical momentum MDD:** 20-40% (crashes mein 50%+ bhi ho sakta hai) ## Implementation Checklist 1. **Data:** Clean adjusted prices (splits, dividends), survivorship-bias-free 2. **Universe:** Liquid large-caps se shuru karo (jaise Nifty 200), penny stocks se bacho 3. **Lookback:** 6-12 months (most recent month skip karo) 4. **Holding:** 1-3 months 5. **Portfolio:** Top/bottom 20% long/short, ya long-only top 30% 6. **Rebalance:** Monthly (consistent din chuno, jaise month-end) 7. **Risk:** Vol-target 10-15%, max position size 5%, stop-loss at -10% monthly 8. **Costs:** Liquidity ke hisaab se 0.1-0.5% per trade model karo > [!recall]- 12-Saal Ke Bacche Ko Samjhao > Socho tum toy cars ki race dekh rahe ho. Kuch cars pehle se tezi se aage ja rahi hain, aur kuch keechad mein phans ke peechhe ja rahi hain. Momentum ek simple idea hai: jo cars pehle se tezi se chal rahi hain, woh thodi der aur tezi se chalti rahengi, aur phasi hui cars phasi rehti hain. So tum kya karte ho? Tezi wali cars par bet karo (unhe buy karo) aur dheemi cars ke khilaf bet karo (unhe short karo — basically tum ek dheemi car udhar lete ho, abhi bech dete ho, aur baad mein wapas karne ka waada karte ho jab woh aur sasti ho jaati hai). Yeh kaam kyun karta hai? Kyunki logon ko achhi khabar notice karne mein time lagta hai. Jab ek company achha kaam karti hai, toh investors dheere dheere realize karte hain "oh, yeh actually achha hai!" aur khareedna jaari rakhte hain, price ko gradually upar push karte hain. Bilkul jab tumhara dost bolta hai ek game amazing hai, lekin tum tab tak believe nahi karte jab tak sab log use khelthe nahi dekhte, phir finally tum bhi try karte ho. Lekin yahan trick hai: tum sirf pichhle hafte ke winners use nahi kar sakte — kabhi kabhi woh bahut zyada bounce karte hain. Tum pichle saal dekhte ho (lekin last month skip karo kyunki woh sirf random noise hai), real champions dhundho, aur us wave par tab tak ride karo jab tak woh ruk na jaye. > [!mnemonic] Momentum ke liye RHC > - **R**ank the universe (relative winners/losers dhundho) > - **R**isk-adjust (Sharpe use karo, sirf raw returns nahi) > - **H**old for medium term (1-3 months, daily churn nahi) > - **C**ost-aware (transaction costs high-frequency momentum ko khatam kar dete hain) ## Connections - [[Time-Series Momentum]] - ek single asset ke andar momentum uski apni history ke muqable - [[Cross-Sectional Momentum]] - doosre assets ke relative momentum (yeh note) - [[Mean Reversion Strategies]] - ulta phenomenon; momentum eventually revert karta hai - [[Factor Investing]] - momentum core factors mein se ek hai (baaki: value, quality, size) - [[Risk Parity]] - vol-weighting technique jo momentum portfolios par apply hoti hai - [[Behavioral Finance]] - momentum kyun exist karta hai (undereaction, herding, overconfidence) - [[Portfolio Optimization]] - momentum portfolios ke liye mean-variance optimization - [[Backtesting Best Practices]] - momentum parameters ka overfitting kaise bachein --- #flashcards/stock-market Quantitative trading mein momentum kya hai? :: Un assets ki tendency jo strong recent performance dikhate hain, near future mein bhi achha (ya bura) perform karte rehte hain, jo behavioral biases jaise undereaction aur herding se driven hoti hai. Lookback period L ke liye simple price momentum ka formula kya hai? ::: $M_i(t) = \frac{P_i(t) - P_i(t-L)}{P_i(t-L)}$, jo t-L se t tak ka percentage return hai. Raw returns ki jagah risk-adjusted momentum kyun use karein? ::: Do smooth trends (sustainable momentum) aur volatile swings (noise) ke beech distinguish karne ke liye. Formula: $M^{SR} = \mu/\sigma$ (Sharpe ratio). Momentum mein "skip-month" effect kya hai? ::: Sabse recent mahina (0-1 month) aksar continuation nahi balki reversal dikhata hai. Microstructure noise se bachne ke liye last month skip karke t-12 se t-1 months ke returns use karna behtar hai. Cross-sectional momentum kya hai? ::: Assets ko momentum score se rank karna aur top quantile mein long aur bottom quantile mein short jaana, jisse strategy market-neutral ban jaati hai aur relative performance par focus rehta hai. Momentum ke liye typical lookback aur holding periods kya hain? ::: Lookback L = 6-12 months, Holding H = 1-3 months. Signal strength ko transaction costs aur mean reversion ke against balance karta hai. Inverse-volatility weighting momentum portfolios ko kaise improve karta hai? ::: Positions ko $w_i \propto M_i/\sigma_i$ ke roop mein weight karta hai, taaki har position equal risk contribute kare. Momentum exposure maintain karte hue portfolio volatility reduce hoti hai. Momentum crash kya hota hai? ::: Severe drawdown jab trends achanak reverse ho jaate hain (jaise 2009 crisis jab momentum 50%+ lose ho gaya). Panic ke dauran crowded momentum positions ke coordinated unwinding ki wajah se hota hai. Momentum crash risk ko kaise mitigate kar sakte hain? ::: Trend filters use karo (sirf tab trade karo jab market 10-month MA se upar ho), volatility scaling (VIX spike par exposure kam karo), ya stop-losses (agar portfolio monthly >10% girta hai toh exit karo). Momentum aur value factors ko combine kyun karein? ::: Momentum aur value ki low/negative correlation hoti hai. Combined strategies mein higher Sharpe ratios aur lower drawdowns hote hain — jab momentum crash karta hai, value aksar perform karta hai. Momentum strategies ke liye typical Sharpe ratio kya hai? ::: Vanilla momentum: 0.4-0.8. Enhanced (vol-targeting, filters ke saath): 0.8-1.2. Market Sharpe ~0.3-0.5 se compare karo. Momentum backtesting mein sabse badi galti kya hai? ::: Transaction costs ignore karna. High turnover (200%+) aur slippage 5-10% annual return khatam kar sakte hain. Hamesha realistic costs aur market impact model karo. ## 🖼️ 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] ```