How to backtest a strategy on Streak
Streak is a no-code algorithmic trading platform integrated with Zerodha that allows traders to build, backtest, and deploy rule-based strategies on equities and F&O contracts without writing a single line of code. This guide focuses on the backtesting workflow: how to define a strategy, run it against historical data, and critically evaluate the results.
For the deployment workflow once a backtest is satisfactory, see How to deploy a Streak strategy live. For the underlying brokerage platform see Streak platform overview and Kite, Zerodha’s trading platform.
What Streak backtesting does
Streak replays your strategy’s entry and exit conditions against historical OHLCV (open, high, low, close, volume) data. When the entry conditions are met on a historical candle, Streak simulates a trade entry at the open (or close, depending on the execution setting) of the next candle. When the exit conditions are met, it simulates the exit. The difference between entry and exit price, multiplied by quantity, is the simulated P&L for that trade.
Streak does not model order book depth or intraday tick-by-tick price paths within a candle. It uses candle-level OHLCV data. For strategies that rely on intraday levels within a candle (for example, intraday high-low breakouts), this introduces look-ahead bias or fill assumptions that diverge from real execution.
Streak supports backtesting on:
- Equity cash (NSE/BSE)
- Equity futures (NSE NFO)
- Equity options (NSE NFO), limited to available historical chain data
- Commodity futures (MCX)
- Currency futures (NSE CDS)
Step-by-step procedure
Open Streak and create a new strategy
Go to streak.tech or click Apps in Kite’s top navigation and select Streak. Log in with your Zerodha credentials. Click Create Strategy (labelled “New Strategy” in some interface versions) on the dashboard to open the strategy builder.
Give the strategy a descriptive name that captures the core logic, for example “Nifty 15-min EMA crossover” or “Bank Nifty short straddle Thursday”. This is important if you plan to maintain multiple strategies over time.
Define the instrument and timeframe
In the instrument configuration:
- Exchange: select NSE, BSE, or MCX.
- Instrument type: Equity, Futures, or Options. For F&O strategies, select Futures or Options.
- Symbol: type the underlying symbol. For futures, specify the contract (for example NIFTY-FUT or a specific month). For options, specify the underlying and then configure strike and expiry rules in the condition builder.
- Candle timeframe: choose the resolution of the OHLCV data. Common choices are:
- 1-minute or 5-minute for intraday scalping strategies.
- 15-minute or hourly for intraday swing strategies.
- Daily for positional or overnight strategies.
Note that shorter timeframes generate more data points and may take longer to backtest over long date ranges. For daily strategies, data typically goes back several years; for 1-minute strategies, the available history may be shorter.
Build entry conditions
The Entry Conditions section is where you define the rules that trigger a buy or sell signal. Streak’s condition builder works with a dropdown interface:
- Click Add Condition.
- Select Indicator 1 from the dropdown (for example, RSI with a 14-period setting on the close price).
- Select the operator (crosses above, crosses below, is greater than, is less than, is equal to).
- Select Indicator 2 or a constant value (for example, the value 30 for RSI oversold).
Multiple conditions within a single entry block are joined by AND logic (all must be true simultaneously). You can add multiple entry blocks joined by OR logic (any block being true triggers entry).
Common entry condition examples:
- EMA crossover: 9-period EMA crosses above 21-period EMA on the close.
- RSI oversold bounce: RSI(14) crosses above 30 from below.
- Bollinger Band breakout: Close price crosses above the upper Bollinger Band.
- Volume surge: Volume is greater than 1.5 times the 20-period average volume.
For F&O-specific strategies, you can also use conditions based on the futures price relative to spot, or options premium levels.
Build exit conditions
The Exit Conditions section defines when Streak closes the position. You have four approaches:
- Indicator-based exit: mirror of the entry logic (for example, EMA crosses back below, RSI crosses above 70 from below).
- Target profit: a percentage gain from the entry price (for example, 2 percent).
- Stop-loss: a percentage loss from the entry price (for example, 1 percent).
- Trailing stop-loss: a stop-loss that moves up as the trade moves in your favour, locking in profit while limiting downside.
You can combine multiple exit conditions; Streak exits on whichever condition triggers first. A common configuration is: target 2 percent, stop-loss 1 percent, with an indicator-based filter as a secondary exit.
For end-of-day MIS strategies, Streak can also be configured to exit at a fixed time (for example, 3:15 PM IST) regardless of other conditions.
Set position size and product type
In the Position section:
- Quantity: number of lots (for F&O) or shares. For F&O, this must align with the exchange lot size. Streak typically defaults to 1 lot and allows you to increase it. For backtesting purposes, 1 lot is sufficient to evaluate the strategy’s logic; multiply P&L figures accordingly when sizing up.
- Product type: NRML for overnight positions, MIS for intraday (must be squared off before 3:25 PM).
- Long/Short/Both: configure whether the strategy generates only buy signals, only sell signals, or both.
Run the backtest
Click Backtest (or the Run icon). A date-range selector appears. Choose:
- Start date: how far back you want the test to run. Longer periods provide more statistical significance but may include market regimes that are no longer relevant.
- End date: typically today or a recent date.
Click Run Backtest. Streak processes the historical data and generates the report. Processing time depends on timeframe and date range; a 5-minute strategy backtested over one year typically takes 15–60 seconds.
Interpret the backtest report
The backtest report contains several key metrics:
| Metric | What it measures |
|---|---|
| Total P&L | Aggregate simulated profit or loss over the test period |
| Number of trades | Total entry-exit pairs executed |
| Win rate | Percentage of trades that were profitable |
| Average profit per trade | Mean P&L of winning trades |
| Average loss per trade | Mean P&L of losing trades (should be smaller than average profit for a positive expectancy) |
| Profit factor | Total gross profit divided by total gross loss; above 1.0 is profitable |
| Maximum drawdown | Largest peak-to-trough decline in the equity curve |
| Sharpe ratio | Risk-adjusted return (P&L relative to volatility of returns) |
The equity curve chart shows cumulative P&L over time. A smooth, steadily rising curve is preferable to a strategy that earns most profit in a short burst and then stagnates or declines.
The trade log lists each simulated trade with its entry date, entry price, exit date, exit price, and individual P&L. Review this log carefully:
- Are the entry and exit prices plausible given the candle’s OHLCV data?
- Are there any anomalously large wins that skew the average (suggesting an overfitted rule)?
- Are trades clustered in a specific market regime (for example, only trending markets)?
Critical evaluation of backtest results
A positive backtest does not confirm a strategy is viable in live trading. Common pitfalls include:
Overfitting (curve fitting): If you tested dozens of indicator parameter combinations and selected the best-performing one, the result is statistically biased. Use a simple rule of thumb: test a strategy on one time period (in-sample), then verify performance on a separate time period (out-of-sample) that was not used during development.
Survivorship bias: If you backtested a stock that is currently popular but was less liquid years ago, the results from earlier periods may be unrealistic. Index futures and Nifty options are relatively immune to this because they have consistent liquidity histories.
Fill assumption: Streak fills at the open of the candle following the signal candle by default. In a fast-moving market, actual fills may be significantly worse. For intraday strategies, add a slippage buffer of 0.1–0.3 percent to each trade when evaluating viability.
Lot-size and contract changes: After SEBI’s October 2024 rationalisation, Nifty lot size changed to 75 units. Backtests using older data reflect the earlier lot size. Streak typically handles this internally, but verify that the margin and P&L figures account for the current lot size.
What can go wrong
- Too few trades in the backtest. A strategy with 12 trades over two years has insufficient statistical significance. Aim for at least 50–100 trades to draw any conclusions.
- High win rate but negative overall P&L. If average loss is much larger than average profit, a 70 percent win rate can still produce a net loss. Check profit factor, not just win rate.
- Backtest works only in trending markets. An EMA-crossover strategy will show excellent results in a strongly trending year and terrible results in a sideways year. Test across multiple market regimes.
- Options backtest data limitations. Historical options chain data can be sparse for far OTM strikes. Streak may not have full chain data for all symbols and all historical periods; verify the data quality note in the backtest report.
- No consideration of taxes and transaction costs. Streak P&L is pre-tax and typically excludes STT, brokerage, exchange fees, and GST. For F&O, STT on short options exercise and brokerage per order are material costs; deduct them from the reported P&L to get realistic net returns.
Related guides
- How to deploy a Streak strategy live
- How to trade futures on Kite (first time)
- How to trade options on Kite (first time)
- How to calculate margin using the Zerodha SPAN calculator
- Streak platform overview
- F&O segment on Zerodha
- Kite, Zerodha’s trading platform
References
- Streak help centre, “How to create and backtest a strategy”, streak.tech/help.
- SEBI Circular SEBI/HO/MRD/MRD-PoD-3/P/CIR/2024/120 dated October 2024, Rationalisation of weekly index derivatives contracts.
- SEBI Circular SEBI/HO/MIRSD/MIRSD-PoD-1/P/CIR/2021/577 dated 19 August 2021, Guidelines for algo trading by retail investors.
- NSE F&O lot size table, nseindia.com.
- Zerodha Varsity, Technical Analysis module, zerodha.com/varsity.
- Pardo, R. (2008). The Evaluation and Optimization of Trading Strategies (2nd ed.). Wiley Trading.