Skip to content



Backtest is the process that run the algo on relevant historical market data to validate your trading strategy before you risk any actual capital in the market.

Streak has the most powerful backtesting engine in the world that generates performance metrics for multiple stocks in a single click.

The backtest results include pnl curve, maximum gains/losses, avg gain per winning trade, avg loss per losing trade, maximum drawdown and much more. These metrics give you a comprehensive idea of your algo’s performance before you deploy in the market.

After you create an algo and click on run backtest, the algos starts checking for all the signals that got generated during the time period selected for that indicator and scrips selected while creating this algo.

Backtest Parameters

Backtest params

  • Initial capital represents the hypothetical maximum capital allocated for the backtest of each equity/futures contract. This capital does not represent any capital held by the user and is for backtest purposes only. Initial capital acts as the maximum capital that will be used by the algo during a backtest to perform hypothetical trades.
  • Quantity represents the trading quantity to be used by the algo. Quantity is a positive integer with defined absolute position size of an order, using which the algo performs hypothetical trades during the backtest. After the backtest is run with a quantity, the same quantity value is used when the algo is deployed.
  • Stop loss percentage is the value used to calculate the stop loss price once the hypothetical entry position has been taken. An exit trigger is generated if the price hits/crosses the calculated stop loss price and the positions will be hypothetically exited at the close price of the subsequent candle.
  • Target profit percentage is the value used by algo to calculate the target profit price once the hypothetical entry position has been taken. An exit trigger is generated if the price hits/crosses the calculated target profit price and the positions will be hypothetically exited at the close price of the subsequent candle.
  • Order type can be MIS or CNC/NRML and represents the order type used to place hypothetical orders in a backtest. MIS is used for intraday margin trading, where the order will get squared off during the market close. CNC/NRML is used for overnight trading, where the stock/contract is held after the market closes and can be carried forward to the next day. If CNC/NRML has been selected as the order type, CNC will be used as the order type for equities and NRML for futures contracts based on the tick symbol and instrument segment.
  • Candle Interval is defined as the time frame of each candle interval. All backtest calculations are made using the close price of the selected candle interval.
  • Backtest period is the lookback period to perform a backtest and is defined by selecting the start and stop date for the backtest. Backtest period can be modified to re-run backtests; however there are some backtest period ranges that are limited based on the candle period such as:
  • For a min candle interval, the maximum backtest period is 1 month and the lookback date cannot be older than 30 days prior to the current date, i.e., user cannot select a start/stop date older than 30 days.
  • For an hour candle interval, the maximum backtest period is one year and the lookback date cannot be older than one year prior to the current date, i.e., user cannot select a start/stop date older than one year.
  • For a day candle interval, the maximum backtest period is five years and the lookback date cannot be older than five years prior to the current date, i.e., user cannot select a start/stop date older than five years.
  • These limits are subject to change based on the availability of data. The backtest period and the data fetched is also subjected to technical limitations such as bandwidth, data availability, server load and various or technical implications.
  • Equities/Future contracts can be added/removed on the backtest page. Backtests are run individually for every equity/contract that has been added and therefore the backtest counter is updated to reflect this.

For example: If 5 equities have been added and backtest is run, the counter will be updated as 5 backtests run. If no new equities/contracts have been added and backtest is run, the backtests are re-run on all the equities/contracts irrespective of its previous status. Everytime you change a parameter mentioned above and run backtest, the backtest count reduces

Trigger Type:

  • EN - Entry
  • SL - Stop Loss
  • TP - Target Profit
  • SO - Square off
  • EX - Exit condition

Brokerage Toggle

We account for all the deductions as per brokerage calculator on Zerodha website.


Backtest edit parameters

Edit params

Algo details

Clicking on the algo name on backtest page displays a small popup with the algo summary.

Algo details

Edit Algo

Algos can be modified from backtest page also by clicking on algo name then clicking pencil icon.

Edit algo

Backtest error messages

During a backtest, if any error occurs/proper results are not be generated, we try to show an appropriate message to help the user adjust the input parameters and run the backtest again. These error messages are explained below:

  1. No trades happened - This means that no hypothetical entry signals were generated for the algo and no hypothetical trades were performed for the backtest period selected by the user. This could mean that the algo conditions were never met in the specified backtest period or that the conditions were syntactically/logically incorrect or were not expressed properly with the right indicator parameters. No trades
  2. No trades happened because initial capital is low - This means that the algo conditions were met and trading signals were generated but due to insufficient hypothetical initial capital, hypothetical trades were not generated. It can be resolved by increasing the hypothetical initial capital or by decreasing the quantity and running the backtest again. Initial capital too low
  3. Limit Exceeded - This means while running backtest you have reached your daily maximum allowed backtest limit. This limit may vary depending on your subscription plan. Limit exceeded
  4. Error while fetching data - This means that an internal error occured while fetching historical data. It can be resolved by waiting for a few minutes and running the backtest again. If the backtest counter gets decreased, you can write to us and we will allow few additional backtests.
  5. Server timed out - This means that the user's browser is not able to connect to Streak servers due to internet connection error. It can be resolved by checking the internet connection and running the backtest again.


Backtesting on Streak: Backtesting on Streak allows users to measure the hypothetical performance or returns of an algo. All backtest results are a hypothetical representation of the performance and returns on an algo, based on certain underlying assumptions. These results do not provide any guarantee of future performance or returns, and all algos are subjected to market risks. The backtest page allows users to adjust and modify various input parameters which are used to run a backtest.


Deploy allows users to take their algos live in the stock market(NSE) and get actionable alerts based on the entry and exit conditions in their algo.

The deploy button is greyed out when no algos are selected on backtest or algos page. Once you select any algo by clicking on the check box the deploy button turns Blue. This means you have selected one or more scrips and you are ready to deploy.

On clicking the "Deploy" button on either Backtest or Algos page, a popup is rendered with a summary of the user's algo with the entry condition, exit condition and candle interval. The user should also select the field "Algo cycle", which determines the period for which the algo will be live ( Algo cycle defines the loop of the algo : Entry followed by respective exit ) and our systems will track market movements. If "Intraday" is selected, the order type will be MIS and the algo will be live for that single day if the user selects "Overnight", the order type will be CNC for equities and NRML for future contracts and the algo will be live for the next 30 days (or until the algo is stopped by the user or terminated due to some reason such as order rejection or user subscription expires).

Deploy backtest

Backtest assumptions

During a backtest, hypothetical trades are generated with the following high level assumptions:

  1. During a backtest, irrespective of the order type, no margins as assumed for any instrument. The user must enter the desired initial capital value such that it is higher than the product of quantity and the instruments close price (initial capital >= (quantity x close price)).
  2. During a backtest, any hypothetical signal to buy or sell is executed on the open price of the next candle irrespective of the actual volumes traded for that candle in the historical data.
  3. During a backtest, no form of averaging is done i.e., the algo does not take multiple consecutive entry positions before exiting the current position (entry position is taken only after the previous position has been exited i.e., when quantity at hand is zero).
  4. During a backtest, the algo only exists when either the target profit price or stop loss price is hit.
  5. During a backtest, there is no context nor is any consideration given to corporate actions such as stock splits, rights issues etc. and no adjustments are made to stock/contract prices. The values OHLCV (Open , High, Low, Close and Volume) are taken directly as present in the historical candle data.
  6. During a backtest, a hypothetical buy signal is generated only if the condition is false in the previous candle and is true in the current candle.
  7. During a backtest, the usage of Open, High, Low, Close is very specific to the candle OHLCV actually going higher lower or than the comparison value.
  8. During a backtest, the profit/loss and the PNL chart values are calculated on the Close price of every candle when a position is held.
  9. During a backtest, if the order type is MIS, all open positions are hypothetically squared off at the open price of the 3:15 pm candle. This is done to simulate a square offs done by the brokers for MIS orders.
  10. Chart data is subjected to minor variations from market time to post market times due to standard data adjustments.


Backtesting is the process of testing a trading strategy on relevant historical data to ensure its viability before the trader risks any actual capital. A trader can simulate the strategy and analyze the results.

On clicking the "Run Backtest" button, a fresh backtest is run for each equity/contract by first fetching all the appropriate historical market data for the respective stock/contract and initializing all the user defined parameters. The historical market data is then processed to generate hypothetical trade signals and hypothetical trades are performed using the hypothetical initial capital.

Based on these hypothetical trades, certain performance metrics such as hypothetical profit/loss, winning streak, losing streak etc. are generated in an effort to provide a generalised and simplified understanding of the algo’s hypothetical returns and risk. All the hypothetical trades generated are shown in the transactions table along with profit/loss and portfolio values during every trade.

The results of all the backtest are hypothetical and do not guarantee or portray in any form or manner any future performance or returns. The backtest results are a hypothetical representation of algos performance and do not provide any guarantee to accuracy in data and are subject to limitations like rounding off, memory buffer limits, user's browser, system limitation, data availablity, accurate data etc