← Ask AI & AI backtesting

Stock and sector rotation backtests via AI

Most momentum backtests you see online quietly use today's index members across history, which deletes every company that failed. The ranking backtester an AI assistant can call on FNOTrader rebuilds the universe at every rebalance and trades the next open.

What a ranking backtest tests

A rotation strategy is a rule: at each rebalance, score every candidate, hold the top few, repeat.

The tool stk_rank_backtest runs that rule on Indian stocks or sector indices with daily history from 2004 and reports the result against NIFTY 50. You set four things: the universe, how to score, how often to rebalance, and how to hold. The general idea of sector rotation is covered in sector rotation in India; this is how to test it.

The Stock and sector backtesting card from the MCP features page: universe, factors, regime filter and comparisons.
The Stock and sector backtesting card from the MCP features page: universe, factors, regime filter and comparisons.

Universes without survivorship bias

UniverseMeaning
sectors17 NSE sector and size indices, for sector rotation.
liquid100 / 250 / 500 / 1000The N most-traded stocks as of each rebalance date.

The liquid universes are rebuilt at every rebalance from trailing turnover. A company that was liquid in 2012 and delisted in 2016 is in the 2012 universe and absent from the 2016 one, as it was in reality. Signals are computed on the decision day's close and filled at the next session's open, so the backtest never trades a close it could not have traded.

Scoring and holding settings

SettingChoices
Factors1-, 3-, 6- and 12-month price change; relative strength vs NIFTY 50; low volatility; risk-adjusted momentum; nearness to the 52-week high; distance above the 200-day average. Weighted as you like — each is ranked within the universe, so weights need not sum to 1.
Presetsclassic momentum, long momentum, relative strength, risk-adjusted, quality trend, balanced.
RebalanceWeekly, monthly (default) or quarterly.
HoldTop N, 1–50 (default 3).
WeightingEqual (default), by score, or inverse volatility.
Regime filterOn by default: sit in cash at a rebalance when market breadth is risk-off.
Require uptrendOnly buy names above their 200-DMA.
CostPer side, in basis points; default 20 (0.20%).

Reading the result

The answer is insight, not a price dump: CAGR against NIFTY 50, maximum drawdown, Sharpe, the share of years it beat the index, how much cost consumed each year, the names it held most, and an ablation — the same strategy with the regime filter off, which shows whether the filter earned its place.

stk_compare_backtests runs 2 to 4 variants over the same window, for questions like "monthly or quarterly?" or "top 3 or top 10?". stk_stock_profile describes one stock over N years — CAGR vs the index, volatility, worst drawdown, distance from highs, 200-DMA position and per-year returns.

A worked example

You ask: "Hold the top 15 of the 500 most liquid stocks by 6-month momentum, quarterly, only above the 200-DMA." The assistant runs liquid500, a single 6-month-change factor, top 15, quarterly, require uptrend on.

Cost arithmetic to check its numbers against, with hypothetical turnover: if each quarter replaces 6 of 15 names, 40% of the portfolio is sold and 40% bought. At 20 bps a side that is 0.40 × 0.20% × 2 = 0.16% a quarter, about 0.64% a year. Switch to weekly and the same churn per rebalance costs thirteen times as much.

Example stock and sector backtesting requests from the MCP features page.
Example stock and sector backtesting requests from the MCP features page.

What it does not model

Where to find it

  1. Connect your assistant (see connecting your AI).
  2. Ask it to list the universes and factors, then describe the rule.
  3. Ask for a comparison to settle one choice at a time. The Stocks Scanner shows today's members of a screen.

Common questions

Is the stock backtest free of survivorship bias?

Yes. The liquid universes are rebuilt at every rebalance from that date's turnover, so delisted companies are included while they traded.

Does it trade at the close it ranks on?

No. Signals use the decision day's close and fills happen at the next session's open.

What does the regime filter do?

When market breadth is risk-off at a rebalance, the portfolio moves to cash. Every run also reports the result with the filter off.

Can I compare monthly and quarterly rebalancing directly?

Yes. Ask for a comparison: it runs 2 to 4 variants over the same window and returns CAGR, excess return, drawdown and Sharpe for each, with a verdict.

Can I get the full price series from the AI?

No. The tools return results and insights, not OHLC data. Use the chart in the Stocks Scanner to see bars.

More on Ask AI & AI backtesting

More in Ask AI & AI backtesting · App: AI backtesting · Definitions: glossary · All: every article