Beginners Guide: How to use Zerodha Pi backtest

The Zerodha Pi backtest engine is a tool that helps you test the profitability of your tradescript code strategy.

Your tradescript code can be backtested and plotted on charts before you start using it live on your Pi scanner to generate trade signals for daytrading.

The backtest engine simulates a virtual trading with your code on historical data of the stock you have selected.

After the backtest has been completed, the backtest engine outputs the results for the number of trades it has identified, how often a trade signal is generated and the profitability of the tradescript code you have used.

How to start using the Zerodha Pi Backtest tool:

On your Zerodha Pi trading terminal, you can access the backtest tool from the ALERTS menu on your toolbar.

Once you click the BACK TEST menu, a new window opens up on the Pi software.

SELECT SYMBOL >> to select your preferred stock backtesting.

PERIODICITY = Minutes ( The time frame you want to test your strategy on )

BAR INTERVAL = 1 ( The time frame of each candle)

DAYS = 5 ( The number of days historical data you are testing your strategy)

select BUY SCRIPT TAB= ( Paste your Trade entry tradescript code)

select EXIT LONG SCRIPT TAB = ( Paste your Trade exit tradescript code)

select BACKTEST button to start backtesting.

After the backtest has been done, the results are displayed on the right side of the same screen.

Optional Settings:

tick BACKTEST CHART = Plots your backtest signals and results on a chart.

PROFILE NAME = Type in a name to save your backtesting settings for later use.

PLEASE NOTE:

  1. Only long side trade strategies work on the Zerodha Pi backtest tool. The 2 TAB’s for testing short strategies do not work due to a bug.
  2. Remember to use codes on both tbe BUY SCRIPT TAB & EXIT LONG SCRIPT TAB when backtesting long strategies, else it will output an error message.