All about Backtests in Tradetron

What is Backtesting

Backtesting is a process by which trading strategies are tested on historical data. Due to the sheer amount of data and computation need, backtesting is a very resource-intensive process. Using historical data, we can get an idea of whether the trading idea/strategy is performing as expected or not. Backtesting is done as a preliminary step before deploying the strategy in a live market. It is to be noted that backtesting and live trading may produce diverse results due to slippage. The time duration required to complete a backtest depends on the complexity of the strategy, the timeframe/candle frequency used and the period/range of backtesting.

Tradetron Backtest Engine

Tradetron Backtest Engine works on a queue basis- First In, First Out. Backtesting in Tradetron is an automated process that conducts backtests one after another using Backtest IDs without human intervention. Even though in Beta mode, Tradetron Backtesting Engine is one of the most powerful backtesting service available in the market. Tradetron Backtesting Engine is designed to handle complex strategies involving many sets and a lot of positions.

Time for backtest to start depends on the number of backtests pending and the position of your backtest in the queue.

Tradetron backtesting universe includes all NSE cash stocks, futures and Index FnO

Backtesting Engine does not yet support Stock options, MCX, CDS and NASDAQ

Backtesting Engine does not distinguish between order types MIS, NRML &CNC.

Backtesting Engine does not recognize the following variables/keywords

  • India VIX
  • All OI related keywords
  • Bid price, Ask price
  • Bid Ask Difference 
  • Sec

 

Backtesting Engine also does not consider SLL, SLM orders, advanced price execution settings, tranching, rollovers and overnight protection positions.

Note: All trades are executed with trade price as open/close price of the current candle as per selection in the parameters shown below

Backtest Parameters

To conduct any backtest in Tradetron there are certain parameters that users have to enter for successful backtesting of strategies.

Figure 1
Figure 1. Backtest Parameters

                                                                                                                                         

  • Date Range – Tradetron has historical data available since 1st Jan 2020 to conduct backtests. At a time, max 6 months of data can be backtested. This is done to reduce the load on the backtest engine and so that many users can conduct backtests successively. You can also backtest the same strategy multiple times for different time period simultaneously.

    For example, if you want results quickly, you can run 4 backtests of a 3-month period each of the same strategy to get result for 1 full year.

  • Candle frequency -  Users have an option to select their choice of candle frequency from 1min, 5min, 10min, 15min, 30min, 1hr and full-day(1D). If you are backtesting a strategy that uses a daily timeframe, it would be advisable to select candle frequency as Full day or lower than Full day. Similarly, if you are backtesting a strategy which uses multiple time frame like 15min and 1hr, select candle frequency less than or equal to the lowest time frame in the strategy, in this case, it would 15min. The smaller the candle frequency, the more computation needed which increases the time to complete the backtest.  

    Note: If your strategy uses time conditions for entry/exit or uses the LTP keyword anywhere in the strategy, a 1min candle frequency would give more accurate results.

  • Trade Price – Unlike other backtesting services, Tradetron gives the users the power to select the trade price of execution. There are two options either Open or Close. Trade price essentially means the price at which the trade is executed. If you are backtesting a strategy that relies on entry after crossovers or any technical indicators, Open Price would be well suited for the purpose. If you are backtesting any strategy that relies on entry on a close price basis, select Close in Trade Price.

 

Interpreting Backtest Report

As soon as the backtest is completed, a comprehensive backtest report is sent to the user’s email address. This report consists of key performance metrics for the strategy. Other than that, in the backtest page, next to strategy name, if you click on the 3 dots, a menu will appear where you can download an excel file that contains data of all the trades taken by the strategy. It makes it very convenient for the user to do their own analysis based on the trades taken by the backtest engine.

 Backtest report which is sent via email consists of the following

  • Equity Curve - An equity curve is a graphical representation of the change in the value of a trading account over a period of time.
  • Capital - The total starting capital deployed for strategy.
  • PNL - The total profit/loss generated during the backtest period.
  • Drawdown - A drawdown expressed in % terms refers to the degree to which the PNL curve drops from the peak (highest point) to a trough (lowest point) before recovering and forming a new peak. Lower is better.  
  • Standard Deviation -  Standard deviation is the statistical measure of volatility. It is also expressed in % terms. The lower the Std. dev, the more reliable the strategy.
  • Sharpe Ratio -  Sharpe ratio is a measure for calculating risk-adjusted return. Strategies with higher market excess returns and lower volatility will show higher Sharpe Ratios. So naturally, higher is better.
  • Month wise PNL - This shows the month-wise distribution of Profit/Loss over the duration of backtest.
  • Position Details – All the positions taken by the strategy during the backtesting period is displayed under this. Additional useful information like condition, price, quantity is mentioned in the report.

 

Figure 2
Figure 2. A sample backtest report

 

Checklist before backtesting

  1. Please ensure your strategy does not use the restricted keywords mentioned above.
  2. Please paper trade the strategy beforehand to check if it takes entry/exits according to your conditions.
  3. Please ensure that your strategy only includes NSE cash stocks/ Futures or Index FnO.
  1. Please check if your set exit/Universal exit conditions are proper before backtesting.
  2. If your strategy is based on a list, it’s best to keep the number of stocks in the list below 10 for optimal execution of backtests.

    Note: Higher number of stocks in the list with lower candle frequency may stall the execution of backtests due to an increase in the number of operations/computations needed.

  1. Keep in mind that backtesting does not follow rollovers, advanced price execution settings, SLM orders, tranching & overnight protection.
  2. Backtesting takes time to begin depending on your position in the queue, so please wait for at least a day before contacting the support team.
  3. Refrain from editing the strategy while the backtest is in progress.

 

How to check if Backtest is started

  • If your current candle shows any date, then the backtest has started, so please let it run. A backtest can take between few hours or a full day depending on the complexity of the strategy being backtested. If the current candle reaches the last date of the backtest range, then the backtest is complete.
Figure 3
Figure 3. Backtest Started
  • If your current candle on backtest page shows “–” that means the backtest has not yet started and is still in the queue. So please wait patiently for the backtest to begin.
Figure 4
Figure 4. Backtest not yet started, still in the queue

 

How to find Backtest ID

Go to the Backtest Page, hover your mouse over the strategy name, a number should appear. That number is your Backtest ID. This is the ID that you can give to support team for further assistance.

Figure 5
Figure 5. Backtest ID