Why usFeaturesTemplatesBlogGlossary

Trend-Gated Momentum (Risk Off Below 200-DMA)

The Momentum 30 screen with one addition: the whole book only reconstitutes while the Nifty 50 is above its own 200-day moving average. When the index closes below it, the strategy exits to cash and waits. Adds a portfolio circuit breaker at 25% drawdown.

Why this is expected to work

A cross-sectional momentum screen always holds the best-ranked 30 names, even when all 500 are falling — "best of a bad universe" is still a full equity exposure into a bear market. Faber (2007) showed a simple 200-day moving-average rule applied at the index level cut maximum drawdown roughly in half across asset classes over 100+ years, with returns broadly intact, because it sidesteps the left tail where losses compound hardest. The cost is real and should be understood before deploying: the rule whipsaws in choppy sideways markets and will exit near lows and re-enter higher several times a decade. It is a drawdown trade, not a return trade. The circuit breaker is a second, independent stop that fires on the portfolio's own equity curve rather than the index.

trend-followingregimerisk-managementtiming
Universe
NSE Stocks XNSE
Rebalance
Monthly Equal weighted

How the pipeline works

Gate

Nifty above its 200-day average

Only runs while XNSE:NIFTY satisfies close > nifty_sma_200

Filter

NIFTY500 constituent

Keeps rows where nifty500_member == 1

nifty500_member == 1
Filter

Liquid: traded > Rs 5 cr/day

Keeps rows where turnover > 50000000

turnover > 50000000
Calculate

Price 1 month ago

Computes price_1m_ago = @shift(close, 21)

@shift(close, 21)
Calculate

Price 12 months ago

Computes price_12m_ago = @shift(close, 252)

@shift(close, 252)
Calculate

12-1 momentum

Computes momentum_12_1 = price_1m_ago / price_12m_ago

price_1m_ago / price_12m_ago
Rank

Top 25 by momentum

Selects the top 25 by momentum_12_1

What this template teaches

  • TickerFilterRule — gate the whole strategy on one instrument
  • exit_portfolio_when_fail (go to cash, not "hold anyway")
  • risk_controls — portfolio circuit breaker
  • Combining a market-timing overlay with a stock-selection screen
Read the full write-up

The 200-Day Moving Average: A Drawdown Trade, Not a Return Trade

One of the simplest market-timing rules ever tested roughly halved maximum drawdown across a century of data without giving up much return. It also whipsaws, and you should know that before deploying it.