Backtest trading strategies on NIFTY, SENSEX and gold, minute by minute

Data
One-minute candles from Dhan
Orders fill
At the next bar’s open
Markets
NSE, BSE and MCX

Veloce is an algo trading harness for Indian F&O. Your strategy plugs in; Veloce supplies the one-minute history, the contracts, fills at the next bar’s open, itemised charges and slippage, exits and risk limits, and a report of every trade. The P&L you see is the P&L your rules would have kept.

NIFTY iron condor

Net P&L

+₹20,971

+2.10% on ₹10,00,000 capital, after fees

Max drawdown
−₹11,832
1.15% of the peak
Win rate
71%
96 trades
Profit factor
1.48
Gross profit over gross loss
Peak at risk
₹10,465
Net P&L is 200% of it
Fees
₹18,902
Brokerage and taxes
Sharpe
1.62
Annualised
Equity over the backtestStart ₹10,00,000 End ₹10,20,971
Drawdown from the last high, deepest −₹11,832

September 2026

13 up, 4 down+4.8k

  1. 11 September: ₹0, expiry day22 September: +₹1,24033 September: +₹61044 September: −₹480+1.4k
  2. 77 September: +₹90588 September: ₹0, expiry day99 September: +₹1,3851010 September: +₹7201111 September: −₹1,960+1.1k
  3. 14Holiday1515 September: ₹0, expiry day1616 September: +₹1,1051717 September: +₹4551818 September: +₹830+2.4k
  4. 2121 September: −₹3,7202222 September: ₹0, expiry day2323 September: +₹1,2902424 September: +₹6402525 September: +₹980−810
  5. 2828 September: +₹3152929 September: −₹650, expiry day3030 September: +₹1,170+835
A backtest report in Veloce, covering NSE and BSE index options and MCX gold futures. The numbers are illustrative, not a real result.

Index options on NSE and BSE, gold futures on MCX

Four underlyings, each with its own expiry calendar, lot size, strike step and charges.
Compare markets
Underlyings Veloce backtests
UnderlyingExchangeExpiryLotStrike stepHistory
NIFTY 50NSE index optionsWeekly, TuesdayThursday until 28 August 20256550 pointsFrom June 2021
BANK NIFTYNSE index optionsMonthly, last TuesdayModelled from September 202530100 pointsFrom September 2025
SENSEXBSE index optionsWeekly, ThursdayModelled from September 202520100 pointsFrom September 2025
GOLD and GOLD MINIMCX futuresEach listed contract’s dateRead from Dhan’s scrip master1 kg (100 units) or 100 g (10 units)Tick ₹1 per 10 gContracts still trading

It never trades on a price it has already seen

A backtest that fills at the close of the candle that triggered the signal is quietly trading in the past. Veloce decides on a closed candle and fills on the next one.

GOLDM future, one-minute candles

DecisionFill price

When a backtest order fillsOne-minute candles from 10:08 to 10:18. The strategy sees the 10:14 candle only when it closes at 10:15:00, decides then, and its order fills at the open of the candle that starts at 10:15. Candles after the decision are still unknown to it.10:0810:0910:1010:1110:1210:1310:1410:1510:1610:1710:1810:15:00, the 10:14 candle closesStrategy decides on its close, ₹1,21,611Order fills at this open, ₹1,21,617then slippage and charges applyNot yet known to the strategy
  1. The candle closesA candle labelled 10:14 covers 10:14:00 to 10:15:00. Its close is known only at 10:15:00, so that is when the strategy sees it.
  2. Targets go through reviewExit rules and risk limits adjust the strategy’s targets against the account, and only the difference becomes an order.
  3. The next candle fills itThe simulated broker fills at the open of the contract’s next candle, the first price after the decision, before the strategy sees that candle.

Illustrative prices.

Your strategy decides. The harness does the rest, on every bar

A strategy only says what position it wants. The harness around it brings the bars, fills the orders, charges the costs, applies your exits and risk limits, and keeps the books, in the same order every time.

The same strategy code is meant to run against paper and live brokers too, with only the data and the order executor swapped. Paper and live trading are coming soon.

Read the details in how the backtesting engine works.

  1. 1

    Bars for one moment

    The engine takes every bar that starts at the same moment: the underlying and each contract the strategy has picked so far.

    BacktestEngine

  2. 2

    Broker fills first

    Options past expiry settle. Orders waiting on a contract fill at its bar’s open, with slippage and charges, and the portfolio updates.

    SimulatedBroker.on_bar

  3. 3

    Strategy decides

    Only then does the strategy see the closed bars. It returns target positions in signed lots, never orders.

    Strategy.on_bar

  4. 4

    Stages review

    Exit-by time, daily target and stop, skipped days, exit rules and risk limits each adjust the targets in turn.

    TargetStage

  5. 5

    Orders wait

    The difference between each target and what is already ordered becomes an order, which waits for the next bar.

    OrderExecutor.submit

One pass of the replay loop. Orders sent in step 5 fill in step 2 of the next moment, at that bar’s open.

Every fill pays what a real one would

Indian F&O charges are small per order and large per year. Veloce itemises them on each fill, from the ₹20 brokerage to STT on sells and stamp duty on buys, and adds the slippage you set in ticks.
Gross on one NIFTY call
₹1,943.50
Charges, both fills
−₹69.33
Net
₹1,874.17

One lot of 65 bought at ₹120.05 and sold at ₹149.95, both one tick worse than the open. The two ticks of slippage cost another ₹6.50 against the opens. Illustrative prices; the charges follow the rates in Veloce’s NSE options schedule.

NIFTY 24200 CE, 1 lot of 65
Per fill, in rupeesBuySell
Next candle’s open₹120.00₹150.00
One tick of slippage+₹0.05−₹0.05
Fill price₹120.05₹149.95
BrokeragePer order₹20.00₹20.00
Exchange charge0.03503%₹2.73₹3.41
SEBI fee0.0001%₹0.01₹0.01
STT0.15%—₹14.62
Stamp duty0.003%₹0.23—
GST18% of the first three₹4.09₹4.22
Charges on the fill₹27.07₹42.26
Illustrative prices, at the rates in Veloce’s NSE options schedule.

Start from a shipped strategy, or describe your own

Eleven strategies ship today. Every setting can be changed, the rule builder turns indicator series into entry conditions, and a whole strategy can be written down as a spec: data, not code.
All strategies
The strategies Veloce ships, with the shape of each position's profit and loss at expiry. Shapes are illustrative.
StrategyAt expiryCandleEntry rule
Index options
Iron condorSells premium1 minuteOnce per expiry, at the entry time, sells a put and a call a set number of strikes either side of the at-the-money strike and buys wings further out.
Hedged straddleSells premium1 minuteEach morning sells the at-the-money call and put and buys a call and a put a set number of strikes away, then closes everything at the square-off time.
MACD credit spreadSells premium5 minutesOn a MACD and 200-period trend signal, sells a put spread when bullish or a call spread when bearish, and flips the spread when the signal reverses.
Moving average crossoverBuys options3 minutesBuys a call when the fast simple moving average crosses above the slow one and a put when it crosses below, holding one contract at a time.
EMA crossoverBuys options5 minutesThe same as the moving average crossover, on exponential moving averages.
MACD with a 200 trend filterBuys options3 minutesBuys calls when the MACD histogram turns positive above a 200-period average, and puts when it turns negative below it.
Supertrend flipBuys options5 minutesBuys a call when the Supertrend turns up and a put when it turns down.
RSI reversalBuys options5 minutesBuys a call when RSI climbs back above the oversold level and a put when it falls back below the overbought level.
Opening range breakoutBuys options5 minutesMarks the high and low of the first minutes of the session, then buys a call on a close above the range or a put on a close below it.
Options on your own rulesBuys options5 minutesBuys calls when your bullish conditions all hold and puts when your bearish conditions all hold, from indicators you define.
MCX futures
Gold futures on your own rulesLong and short5 minutesGoes long a gold or gold mini future when your bullish conditions hold and short when your bearish ones do, reversing in one order when the signal flips.

Solid line: the position as entered. Dotted line: the opposite signal, for strategies that take both sides. Shapes are drawn from each strategy's legs with illustrative premiums.

The iron condor, written as data

A spec names four legs by how many strikes they sit from the at-the-money strike, and groups the exits by expiry. It is checked against the schema before a run starts, and a bad field is reported by its path, like legs.0.strike.steps.

Today a spec runs in a backtest. Strategies are written so the same code will run against a live broker.

iron-condor.jsonStrategy spec
{
  "name": "iron-condor",
  "description": "sell weekly iron condors",
  "candle_minutes": 1,
  "entry": {
    "first_entry": "10:00",
    "min_days_to_expiry": 5,
    "reenter": "each_expiry"
  },
  "legs": [
    {
      "kind": "option",
      "option_type": "put",
      "side": "buy",
      "strike": {
        "kind": "atm_offset",
        "steps": 8
      }
    },
    {
      "kind": "option",
      "option_type": "call",
      "side": "buy",
      "strike": {
        "kind": "atm_offset",
        "steps": 8
      }
    },
    {
      "kind": "option",
      "option_type": "put",
      "side": "sell",
      "strike": {
        "kind": "atm_offset",
        "steps": 4
      }
    },
    {
      "kind": "option",
      "option_type": "call",
      "side": "sell",
      "strike": {
        "kind": "atm_offset",
        "steps": 4
      }
    }
  ],
  "exits": {
    "group_by": "expiry",
    "rules": [
      {
        "kind": "take_profit",
        "amount": {
          "kind": "share_of_credit",
          "fraction": "0.5"
        }
      },
      {
        "kind": "stop_loss",
        "amount": {
          "kind": "share_of_credit",
          "fraction": "2"
        }
      },
      {
        "kind": "before_expiry",
        "days": 1
      }
    ]
  }
}

Limits that act on the position, bar by bar

Exit rules close positions. Risk rules cut new ones down to size. Both run on every bar, in order, before an order exists.
Risk and exits
  1. Stop loss

    Exit rule, closes positions

    In rupees, or as a share of the premium paid or the credit received.

    stop_loss · share_of_credit 2
  2. Take profit

    Exit rule, closes positions

    Close once the position has made a set amount, in the same units.

    take_profit · share_of_credit 0.5
  3. Trailing stop

    Exit rule, closes positions

    Exit after giving back a set amount from the best profit, armed from entry or after a profit.

    trailing_stop · distance, after
  4. Before expiry

    Exit rule, closes positions

    Close a position a set number of days before its contract expires.

    before_expiry · days 1
  5. Daily target and stop

    Exit rule, closes positions

    Close everything and stop for the day at a profit or a loss, in rupees or a share of equity.

    day_rupees · share_of_equity
  6. Loss cap at expiry

    Risk rule, sizes new orders

    Cut each new option position so its worst loss at expiry stays within a share of equity.

    max_loss_at_expiry
  7. Cash and margin

    Risk rule, sizes new orders

    Keep option buys within cash, and futures within margin at a rate you set.

    cash · futures_margin

Tune on one period, check on the next

A sweep backtests every combination of the settings you vary and ranks them by net P&L. Then it reruns the best few on a later period they never saw.

In this illustrative sweep the top setting on August and September loses money in October, and the third-ranked one is the only one of the three that holds up. That gap is what the check period is for. Read how sweeps work.

Slow 8Slow 13Slow 21Fast 3
−₹2,915
+₹15,975check −₹5,410
+₹2,350
Fast 5
+₹11,240check +₹1,385
+₹18,420check −₹2,160
+₹4,175
Fast 9
−₹6,120
−₹4,480
+₹6,830
Net P&L on August and September for each pair of moving-average lengths. The outlined cell ranks first; the three best pairs also show their result on the check period. Illustrative figures.

The three best, on the period they were tuned on and on the next one

  • Rank 1: fast 5, slow 13
    Tuning+₹18,420
    Check−₹2,160
  • Rank 2: fast 3, slow 13
    Tuning+₹15,975
    Check−₹5,410
  • Rank 3: fast 5, slow 8
    Tuning+₹11,240
    Check+₹1,385

See where the P&L came from

Every run is kept in your own run history, with each signal, fill and fee behind the totals.
What a report shows
NIFTY EMA crossover
EMA 9EMA 21Buy callBuy put5-minute candles
09:1510:1511:1512:1513:1514:15
Entries appear on the candle after the cross, where they fill. Illustrative prices.
Price chart
Every signal drawn on the candle it was acted on, not the one that caused it.
P&L calendar
Net result for each trading day, so one lucky session stands out from a steady month.
Equity and drawdown
The path of the account, with the deepest fall from each peak.
Trades
Every fill with its brokerage, taxes and slippage itemised.

What Veloce does not do yet

A backtest is only useful if you know its edges. These are Veloce’s today.
AreaStatusDetail
Paper and live tradingComing soonPaper trading on live data, live trading through Zerodha, an option chain with greeks and IV, alerts, and a strategy marketplace. Strategies are written so the same code will run against a live broker; today Veloce runs backtests.
Tick dataNot supportedThe finest data is the one-minute candle, so Veloce is not a tool for tick-level or high-frequency strategies.
Other marketsNot supportedNo equities, currencies, crypto or US markets. Gold options wait for a verified MCX expiry calendar.
HistoryLimitedMarket data comes from Dhan. Expired MCX futures have no intraday history there, and BANK NIFTY and SENSEX start in September 2025.

Know how a backtest can mislead you

Articles and definitions written against the rules Veloce runs, with the numbers worked through.
Read the blog

Run your first backtest

Create an account with a verified email and phone number, pick a strategy and a market, and see every fill, fee and day of P&L.

Create account
esc
↑↓Move↵Open