Register
Tutorial

Run a Strategy Backtest in QuantPower

This tutorial runs a backtest of a Nifty short straddle in QuantPower: choosing the period, setting costs and slippage, running the test, reading the report and comparing versions. It then runs a second, simpler backtest of an indicator rule on Nifty futures, so you know both kinds of backtest the app offers. It takes about 10 minutes once the strategy is built.

QuantPower Research · Updated 12 Nov 2026 · 17 min read

A backtest answers one question: if these exact rules had run on those past days, what would have happened, after costs? It is a test of the rules, not a forecast. Every figure in this tutorial is an example to show how the screens work; your report will show your own strategy's results.

Before you start

  • A saved strategy. For the straddle, an algo in Algos → Option bots, built from the Short Straddle template or your own legs. The tutorial on how to create a strategy shows the steps.
  • A connected broker. Backtests read past candles from your broker's own candle service when they run; QuantPower keeps no market history of its own. If the broker has no data for the period, the test says "Data is not available" and stops.
  • Tokens. Each backtest costs 2 tokens, and the first 10 each week (Monday to Sunday) are free. A run that fails costs nothing, and rerunning with only the slippage changed is free.
  • A question to answer. For example: "Does a 30% stop on each leg do better than 25% after costs?" A backtest is most useful when it tests one idea at a time.

Why backtest at all

A strategy you have not tested is an opinion. A backtest turns it into a record: on these days, with these rules, these trades would have happened, at these costs. That record is useful in three ways.

First, it catches mistakes in the rules before they cost money. A stop set on the wrong leg, an entry time after the exit time, a strike rule that picks the wrong expiry: each shows up at once in the trade list. Most first backtests find at least one rule that is not what the trader meant.

Second, it shows the shape of the results, not only the total. Two strategies with the same total can be very different to live with: one earns a little most weeks and loses a lot occasionally, the other loses a little often and earns a lot occasionally. The worst day, the drawdown and the losing streak tell you which you are looking at, and whether you could sit through it.

Third, it gives you a baseline to compare with. Once a strategy runs in Forward test and then live, its results can be compared with the backtest for the same days. A large gap is a signal to find out why before adding money.

What a backtest does not do is tell you what will happen next. Markets change, rules change, and a strategy that fitted the past well can fail on new data. Treat a good backtest as permission to test further, not as proof.

The two kinds of backtest

KindWhat it testsWhere you start it
Option strategy backtestA set of option legs, day by day and minute by minute from the entry time to the exit timeFrom an Option bot's card
Rule backtestAn entry and exit rule on one instrument, over up to 2,000 candles from 5-minute to dailyThe Backtest screen

Both deduct brokerage, STT, exchange charges, SEBI fees, stamp duty and GST from every trade, and both list every trade. The backtesting page explains the method in full.

Part 1: Backtest a Nifty short straddle

The strategy

Sell the at-the-money Nifty call and put at 9:20 am on expiry day, with a 30% stop-loss on each leg, and exit whatever is left at 3:10 pm. One lot each. In the algo:

SettingValue
LegsSell call, sell put; rule legs, "ATM", weekly expiry
EntryAt the time, 9:20
Exit time15:10
Stop-loss on each leg30% of its traded price
On a hitExit this leg only
DaysExpiry day only
ProductIntraday

Step 1: Open the backtest

  1. Open Algos → Option bots and find the straddle's card. The algo can be off; a backtest never switches it on.
  2. Choose Backtest on the card.

Step 2: Choose the period

Choose the dates the test should cover. Two things decide a good period.

Length. A weekly expiry-day strategy trades about 50 days a year. A year gives about 50 trades; two years about 100. Fewer than 60 trading days and the report warns that a short period can make a strategy look better or worse than it is.

What the period contains. Indian index options changed several times recently. From 20 November 2024, each exchange keeps one weekly expiry and index contracts got larger. From 1 September 2025, NSE expiries moved to Tuesday. From 1 April 2026, STT on futures and options went up. From 3 August 2026, NSE equity derivatives trade until 3:40 pm. A period that crosses these dates tests the strategy across slightly different markets; read the recent part of the result with more weight.

For this tutorial, choose the last two years. That period includes both the Thursday and the Tuesday expiry eras, quiet months and sharp moves, which is what a strategy meant to run every week should be tested against.

Step 3: Set the costs

  1. Brokerage per order. Enter your broker's rate; ₹20 an executed order is common at discount brokers. Statutory charges are added by the engine, using the same rates as the site's brokerage calculator: STT of 0.15% on the sell premium of options since 1 April 2026, NSE transaction charges, the SEBI fee, stamp duty on the buy side, and GST on brokerage and exchange charges.
  2. Slippage. The gap between the price the test assumes and the price a live order would get. The test applies it to every fill: a buy fills a little higher, a sell a little lower. For at-the-money Nifty options, start with a small percentage and test a larger one later.

Step 4: Set the capital (optional)

Enter the capital you would trade the strategy with. The report then also shows the return and the maximum drawdown as a percentage of that capital, which makes two strategies of different sizes comparable.

Step 5: Run the test

Choose Run. A run over two years of expiry days takes a short while; the report opens when it finishes. The engine works day by day through the period:

  1. On each expiry day, at 9:20, it picks the at-the-money strike from the index price at that minute.
  2. It fills each leg at its option price, adjusted for slippage.
  3. Every minute after that, it checks each leg against its 30% stop and the strategy against any overall stop or target in rupees.
  4. At 15:10, it closes whatever is still open.
  5. It works out the charges for each leg and deducts them.

Days the strategy is not set to trade are skipped. The run is charged only when it gives a result.

What happens inside a run

It helps to know what the engine assumes, so you can judge the result fairly.

The at-the-money strike is picked from the index price at the entry minute and rounded to the nearest strike, so on a day the index sits halfway between two strikes the choice can flip with a few points of movement. Each leg is filled at its option price for that minute, moved against you by the slippage you set. From then on, prices are checked once a minute, so a stop that would have been touched and recovered within the same minute may not fire in the test, while one that is crossed at the minute's price will. The exit at 15:10 uses that minute's price. Charges are worked out leg by leg at the current statutory rates, so trades from earlier years carry today's taxes, which is the cautious choice.

None of this is hidden: the report lists its assumptions with the result, including the slippage, the brokerage per order and the charges applied.

Step 6: Read the report

Read it in this order, not top to bottom.

1. The trade list. Open a few days from good weeks and bad weeks. Check that the entry was at 9:20, the strikes were at the money, the stops fired where you expect, and both legs closed by 15:10. If one day looks wrong, the rule is not what you meant, and every other number is wrong with it.

2. The exit reasons. How many legs closed on their stop, and how many lasted to 15:10? A straddle where one leg is stopped on most days is a different strategy from one where both usually reach the exit time.

3. The worst days and the maximum drawdown. The report shows the worst day and the largest fall from a peak, each with dates, and the longest losing streak. Ask yourself whether you would have kept trading through them.

4. The unseen-days verdict. The report treats the first 70% of the period as the days the strategy was built on and the last 30% as unseen, and compares the average result per day. "Held up on unseen days" is what you hope for. "Weaker", "fell apart" or "lost money even in the period it was built on" are warnings.

5. Net, gross and charges. Look at net P&L first. If the charges line is a large share of the gross, the report says so; a strategy that earns a few rupees a trade before costs rarely survives them.

6. Months and weekdays. If most of the result comes from two or three months, the strategy depends on those conditions returning.

7. The notes. Every report ends with plain warnings the engine writes from the numbers: a short period, many small wins and a few large losses, a worst day that took more than half the total profit, weaker unseen days, or heavy charges. Read them.

What each measure means

Win rate is the share of days, or trades, that made money after costs. A high win rate sounds safe but says nothing about the size of the losses; short option strategies often win on most days and lose heavily on a few.

Average winning day and average losing day show how the result is made. If the average loss is two and a half times the average win or more while the win rate is 70% or higher, the report adds a note: one bad day can take back many good ones.

Expectancy is what the strategy made on an average trade after costs: the win rate times the average win, minus the loss rate times the average loss. A small positive expectancy can disappear with slightly worse fills, which is why the slippage test matters.

Maximum drawdown is the largest fall from a peak in the running total, with the dates it started and ended. It is the loss you would have had to sit through without switching the strategy off. Compare it with the capital you would trade: a drawdown that is a large share of your capital is hard to live with, whatever the total.

Longest losing streak is the most losing days, or trades, in a row. Strategies are often abandoned in their worst streak, just before they recover or just before they fail completely; knowing the past streak helps you judge the next one.

Results by month and by weekday show whether the result is spread out or concentrated. A weekly strategy that made most of its money in two months depends on those conditions; one that made it evenly is less fragile.

The equity curve is the running total, day by day. A steady rise with shallow dips reads very differently from a line that is flat for months and then jumps.

Step 7: Compare versions

Change one thing at a time and run again.

VersionChangeWhat to look for
A30% stop on each leg (the original)The baseline
B25% stopMore stops hit; is the worst day smaller?
C35% stopFewer stops; is the worst day larger?
DOriginal, slippage doubledFree to rerun; how much does the result depend on fills?
EOriginal, entry at 9:30Does the result depend on one minute?

If moving the stop from 30% to 35% turns a profit into a loss, the 30% figure is fragile, and the backtest is telling you about noise rather than a lasting pattern. A result that holds across nearby settings, the unseen days and higher slippage is worth taking to a Forward test.

Choosing slippage sensibly

Slippage is the cost most first backtests leave out, and it matters most for strategies that trade often or in thin strikes.

Think about what a live order meets. A market order to sell an at-the-money Nifty option at 9:20 on expiry day fills at the bid, which is below the last traded price by the spread, and the spread widens in the first minutes after the open and in fast moves. A stop-loss that fires during a sharp move fills worse still. A backtest that fills every order at the candle's price assumes none of this.

A practical way to choose is to start with a small slippage per side for liquid at-the-money index options, run the test, then double it and run again; the second run is free. If the strategy's result falls sharply when slippage doubles, its edge depends on fills you may not get. For far out-of-the-money strikes, stock options or strategies that trade many times a day, start higher.

Keep a test log

Every version you run is a data point. Write down, for each run, the date, the period, the one setting you changed, and the three numbers you care about most, such as net P&L after costs, the worst day and the unseen-days verdict. After ten runs, the log shows which settings the strategy is sensitive to far more clearly than memory does. It also protects against the most common trap: running many versions and remembering only the best.

Part 2: Backtest an indicator rule

The rule

Buy Nifty futures when the 20-period EMA crosses above the 50-period EMA on 15-minute candles. Stop-loss 0.5%, target 1%, and exit when the averages cross back.

Step 1: Open the Backtest screen

Open Backtest. The Backtest tab tests on past candles; the Forward test tab runs the same rule on live bars with no real money.

Step 2: Set the instrument and candles

  1. Instrument: search for the Nifty futures contract.
  2. Timeframe: 15 minutes.
  3. Bars: how many past candles to read, up to 2,000. At 15 minutes, 2,000 candles cover about 80 trading days.
  4. Side: long.

A futures contract expires every month, so the candles your broker holds for one contract reach back only over that contract's own life. For a longer view of the same idea, run the rule on the current contract and then on the next month's, and compare; or test it on a liquid stock, whose history is continuous, to see whether the signal holds beyond one market. The actual orders would always go to the contract you trade, so the current contract's result is the one to read most closely.

Step 3: Write the entry and exit rules

  1. Entry rule: add the condition "EMA 20 crosses above EMA 50". The rule builder accepts up to 20 conditions in All and Any groups, on any chart indicator, candle pattern or chart formation, and your own Arth Script indicators.
  2. Exit on a rule too: turn it on and add "EMA 20 crosses below EMA 50".
  3. Stop-loss %: 0.5. Target %: 1.

The test acts only on closed candles, so it never uses a price that was not yet known.

Step 4: Set slippage and run

Set Slippage per side in points or per cent, then choose Run backtest. The test holds one position at a time: it opens a position at the candle that meets the entry rule, checks the stop, the target and the exit rule on every candle after, and repeats.

Step 5: Read the report

Choose a Report view. The report shows net P&L after charges, the win and loss rates, the average win and loss, the maximum drawdown, ratios such as expectancy, the longest winning and losing streaks, the equity curve, P&L by month and year and by day, and the trade list, which you can download as CSV.

Then test the same rule on hourly candles: 2,000 hourly candles cover more than a year. If the rule only works on one candle size, it is probably fitting noise.

The 2,000-candle limit is a reason to think about the candle size, not a barrier. On 5-minute candles, 2,000 candles cover about four weeks of trading, enough to check that an intraday rule behaves as written but not to judge it. On daily candles they cover about eight years. Many traders test the logic on short candles over the recent weeks, then test a version of the same idea on longer candles over years, and trust the rule only if both agree. You can also run the same rule on several instruments, such as Nifty and Bank Nifty futures, to see whether it holds beyond one market.

Traps to avoid

Look-ahead. A rule that uses information not known at the time looks perfect on paper and cannot be traded. Entering "at the day's low", or acting on a candle's close before the candle has closed, are the usual forms. QuantPower's rule backtests act only on closed candles, and option strategy backtests act at the minute the rule names, but a rule you write can still assume something it could not have known; read the trade list with that in mind.

Overfitting. Testing many versions of a rule and keeping the best finds patterns in noise. The more settings you tune, the more likely the best result owes something to luck. The unseen-days check is a first guard; a fuller one is walk-forward testing, which repeats the build-and-test step across many windows. Prefer rules with few settings, and settings that make sense on their own.

A convenient period. A short-selling strategy tested only on a falling market, or an option-selling strategy tested only on a quiet year, will look good. Make sure the period includes rising, falling and quiet markets, and event weeks.

Ignoring rule changes. Lot sizes, expiry days and taxes changed in 2024 to 2026. A result from 2023 is evidence about a slightly different market.

Trusting the total. A large total can hide a single huge loss or a result that comes from a few weeks. The worst day, the drawdown and the monthly table say more.

From backtest to Forward test: what to compare

Once the straddle has a result you understand, switch it on in forward test for three or four expiries. Forward test runs the same engine on live prices with test money, so the trades are directly comparable with the backtest for the same days.

Compare four things:

  1. Entry prices. Did the live entries fill near the prices the backtest assumed at 9:20? A consistent gap is your real slippage.
  2. Stops. Did stops fire at the same moments? A stop that fires live but not in the backtest usually means a fast move inside a minute.
  3. Exit times. Did both legs close by 15:10?
  4. The day's result. Is the Forward-test result for each day close to the backtest's for the same day?

If they match, the backtest is a fair picture of how the rules behave. If they do not, find out why before switching anything on Live.

Backtesting with Quanty or your own AI app

You can also start a backtest by asking for it. Describe the strategy to Quanty in words, by text or voice; Quanty builds it with every rule written out, asks about anything missing, and can backtest it and run a risk check that flags missing stops or sold options without a hedge. It saves the algo switched off, and only you can switch it on. A connected AI app, such as Claude or ChatGPT through Connect AI, can backtest your rules in the same engine with your permission. A backtest started either way costs the same as one you start yourself and uses the same free runs.

A second option strategy to try

Once the straddle is clear, try the same steps on an iron condor: sell a call and a put 400 points from the price, buy wings 200 points beyond them, enter on Thursday at 10:00 and exit at 15:10 on expiry day, as an overnight position. Compare its report with the straddle's. The condor collects less premium but its wings cap the loss, so its worst day and drawdown should be smaller; whether its net result after costs is better or worse is exactly what the backtest is for. The four legs place eight orders a week instead of four, so read the charges line closely.

Before you trust a backtest

  • The trade list matches the rules you meant on a few days you checked by hand.
  • The period covers at least a year and includes volatile weeks.
  • Costs and a realistic slippage are included, and the result survives double slippage.
  • The unseen-days verdict is "held up".
  • Nearby settings give similar results.
  • The worst day, the drawdown and the losing streak are ones you could live with.
  • You have a Forward-test plan to compare against.

Common problems

ProblemLikely causeFix
"Data is not available"The broker has no candles for that instrument and periodChoose another period or instrument; nothing is filled in
No trades in the periodEntry conditions never met, wrong days, or entry time after exit timeCheck the days, the entry and the exit times
A stop and a target in the same candleThe candle cannot show which came firstRead such trades as stopped out; use smaller candles
Results swing with small changesThe rule is fragileSimplify the rule or test across more data
The result looks too goodLook-ahead, overfitting or no costsCheck the trade list, the unseen days and the charges line

What a backtest cannot tell you

A backtest cannot see the future, your own behaviour in a losing month, whether a large order would have moved a thin strike, or exchange and broker outages. It fills at candle prices plus slippage; live orders meet the real spread. That is why the next step is always a Forward test on live prices before real money.

Next steps

  • Run the straddle in Forward test for three or four expiries and compare with the backtest for the same days.
  • Read the guide on how to read backtest results for each measure in more depth.
  • Set a daily loss limit and Smart Exit before switching anything on Live.

Start with 500 free tokens

Connect your broker, build a strategy and test it on paper before a single live order goes out.

Frequently asked questions

How long should the backtest period be?

Long enough to include quiet and volatile markets: for a weekly strategy, at least a year, and two if the data is there. Shorter periods are useful for checking that a rule behaves as written, not for judging it.

Does the backtest include costs?

Yes. Brokerage at the rate you set, STT, exchange charges, SEBI fees, stamp duty and GST are deducted from every trade, and slippage is applied to every fill. The report shows net, gross and charges separately.

Can I backtest a TradingView or Arth.live strategy?

Rebuild its rule in QuantPower's rule builder, with the same indicators and conditions, and run a rule backtest. Indicators you wrote yourself with Arth Script can be used in the rule.

Backtest results are simulated on past data and do not guarantee future results. This tutorial shows how to use the software and gives no advice on what to trade. Trading involves substantial risk.