rule_backtest: Test a trading rule on history

Test your own rule on daily prices: trades, win rate, return against holding and the Nifty 50, drawdown, by year. Past only; costs not modelled.

What it returns

The trades, win rate, average return, total return against holding and against the Nifty 50, the worst drawdown and a year-by-year split, all on past prices.

Inputs

InputRequiredNote
symbolsnoNSE tickers or BSE codes; delisted names work. Give exactly one of symbols, index, sector
indexnoan index by name ('NIFTY 50', 'Bank Nifty'): its largest members by market cap; up to 60 characters
sectornoa sector or industry by name ('banks', 'pharma'): its largest members by market cap; up to 60 characters
topnofor index or sector: how many of the largest members (default all of them, at most 50); 1..50
entryyesobject
exityesobject
yearsnolook-back in years (default 5, at most 10) when from is not given; ..10
fromnoYYYY-MM-DD, the first day of the window
tonoYYYY-MM-DD, the last day (default the last settled close)

Example questions

Related tools

Data freshness

Prices and indicators are end of day, as of the last close. Company figures are as filed, each with its date. There are no live prices.

More