Backtesting on Tradetron
Before we begin, here is a sample of how a backtest report looks like on Tradetron. This page covers a strategy build and an analysis of the the backtest report for the same. If you already have a strategy you can jump to backtest.
The life cycle of an average trader oscillates between profit, panic, portfolio drawdown and prayer during the initial stages of curation of a strategy. Why? It’s a fairly difficult task to create a strategy from the initial hypothesis to the final product which in our case is a fancy software no-code on Tradetron.
With the new gold of data your process of converting your hypothesis into a full fledged strategy becomes very fast and fairly pain free. Don't take our word for it, let's try building a strategy on Tradetron and deploy it on the backtest engine. The edge we are trying to explore is as follows:
- We enter into a short straddle at 920
- We capture a directional move by maintaining a 20% stoploss on each leg
- Along with the 20% SL we will also trail the profit
- Once we have 500 rupees in profit we lock the same and then begin trailing on a strategy level
The strategy rests on the fact that there will be a directional movement of the market in a day. If the market makes a directional move the same will not reverse back.
Now let's check how to achieve the same by building the same strategy on Tradetron’s no code condition builder. Lets achieve all the above steps one by one.
Enter into a short straddle at 920
Once you sign in to the website click on “create”:
After the creation of the strategy, give a suitable name to the same. This name can always be modified. Most regular backtest users will name the strategy based on the conditions they use.
Example: Nifty 920 strategy 20% SL
This helps you quickly identify the backtest and make suitable changes to the same as needed. You can also add tags to the same to remember your original goal while building the same strategy.
We will now proceed to add the entry conditions, which as per our logic is to have the time be more than 920 and add our entry condition here. Using the No code condition builder we add the same entry logic. We use a condition as Time >= 920 to take an entry at 920 everyday.
Using the position builder we add the position of the Call and Put leg. Here is how the same will look like.
Now here is how the entry condition and position builder will look like:
We capture a directional move by maintaining a 20% stoploss on each leg
This part of the logic can be achieved by using a keyword called set exit. We will use this keyword to achieve a 20% stoploss and trailing stoploss. Do make sure you use it as an OR condition type. The below mentioned logic will help us take a 20% stoploss and trail our profit once we have a 20% move in our favor.
Using paste exit we will add the squareoff leg for both the instruments.
Similarly we add another repair once to square to square off the Put position taken in entry. Here is how the final result will look like for all our trailing needs.
Once we have 500 rupees in profit we lock the same and then begin trailing on a strategy level
We now complete the build by adding the universal exit condition to lock profits to make sure the strategy makes at least 500 in profit. We also add a condition to square off everything if there is an open position at 3 15PM.
A final check of the advanced settings to make sure we reactivate every 6 hours and check conditions continuously. We also update the capital required and start and end time to check conditions and finally “update” or “create” the strategy.
With our strategy ready we now proceed to backtest it. Since we dont live in a perfect world and we as humans are bound to make mistakes, it would be a wise decision to paper trade this strategy for at least 1 week to make sure we have not made any syntax based mistakes or logical errors.
Dont want to build a strategy?
You can duplicate this template from here. You can also learn to build your custom logic by checking out our free and paid courses on TT Uni. We also offer custom strategy creation services. You can fill the form to learn more about it from here.
Backtesting and inputs
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 very resource-intensive process. Using historical data, we can get an idea whether the trading idea/strategy is performing as expected or not. Backtesting is done as a preliminary step before deploying the strategy in 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 backtest.
The backtest modal allows us several inputs. Since we know our strategy best we will input the date range that we want to backtest our strategy for. Our suggestion would be to use a 6 month timeframe initially and then work your way up to longer timeframes.
Candle frequency is somewhat like the number of times the conditions will be checked. This needs to be input based on the conditions used in your strategy.
Example: If your logic uses a crossover on 15 min candles it would be wasteful to check your conditions every 1 minute. Similarly checking for conditions once per hour may not give you the best results. A thumb rule would be to have the candle frequency lower than the one your technical indicators are using. And keeping it at 1 min for time based option strategies should work too.
The Trade Price of execution has two options either Open or Close. This is the price at which the trade is executed. If we are backtesting a strategy that relies on entry after crossovers or any technical indicators, Open Price would be well suited for the purpose. If we backtest any strategy that relies on entry on close price basis, select Close in Trade Price.
Input the type of strategy you are backtesting, Intraday or Positional. Select the appropriate option depending on your strategy.
Upon selecting Positional, it will further provide 3 Options. Select the one that best fits your strategy
- None - Select this, if you are trading stocks which do not have an expiry
- Weekly - Select this, if you are trading Weekly Options
- Monthly - Select this, if you are trading monthly Options or futures
Given the fact that the backtest is very resource intensive the same is charged based on credits. One credit can be purchased from here. You use one credit when you backtest for 6 months of data for any one instrument.
Coming back, Once we fire the backtest we will see a confirmation like the one below.
Lets select Go to Backtest and check the progress of the same.
The status of your backtest will gradually proceed from “In Queue” to “% Completed”. Once the processing is done, it will gather all the data and “Generate a report” and then move to the “completed” section.
The backtest will give us access to two different reports. The stats PDF will be a birds eye view of the progress of the strategy at a holistic level. It will give you details of the following statistics.
- PNL Curve – A PNL curve is a graphical representation of the change in the value of a Profit/loss over a period of time
- Capital Required - The total starting capital for the strategy
- Total PNL - The total profit/loss generated during the entire backtest period
- Drawdown - Drawdown expressed in % terms refers to the degree to which the PNL curve drops from the peak (Highest point) to a trough (Lowest point)
- 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. For Annualized Sharpe Ratio, the Risk-free rate is considered as 0
- Total Trading Days - Total no. of trading sessions in the selected backtest period
- Win Days - This parameter tells you the no. of profitable days
- Loss Days - This parameter tells you the no. of loss days
- Win Rate – Simply put, this parameter tells the trading system’s win ratio. The bigger, the better. It is calculated using the formula - < Total profit days / Total trading sessions in Backtest period>
- Avg Monthly Profit – Average profit generated per month
- Avg Monthly ROI – Average ROI generated per month, Capital is considered as the base of all returns. It is calculated using the formula - < Total PNL/ (Total trading days * 21)>
- Total ROI – Total ROI generated for the duration of the backtest.
- Max Profit in a Day — Maximum Profit generated in a trading day
- Max Loss in a Day – Maximum Loss generated in a trading day
- Avg PL Daily – Total PNL/total trading days in the selected backtest period
- Avg Profit on Profit Days – Average Profit generated on Profitable days
- Avg Loss on Loss Days – Average Loss generated on Loss days
- Avg no. of trades (Buy + Sell) per day – Average no. of trades in a day(Only sessions on which strategy took trades are considered)
- Month-wise PNL -This shows the month-wise distribution of Profit/Loss over the duration of backtest.
- Position CSV – All the positions taken by the strategy during the backtesting period are displayed under this. Additional useful information like condition, price and quantity is mentioned in the report.
The positions CSV gives the log of all the trades taken by the same backtest.
A quick summary of the same will be visible on the backtest page too. Here you see the date, run counter and PNL of the same strategy.
Through this we get a realistic expectation of the performance of the strategy. When your expectations of the profits, drawdowns and win rate are set right, you get the confidence to give your strategy the independence to allow it to run live, on auto pilot on Tradetron.
And since you have made it this far here is a link to download a sample copy of the backtest report here.
Go to the Backtest Page, Click on the BID button and a number should appear. That number is your Backtest ID.How to find Backtest ID?
If you have purchased a backtest and due to some reason would like a refund of the remaining unused backtest credits, you can email [email protected] and the team will refund the amount based on unused credits.
Backtest's duration depends on two things. The first is the queue of the backtests deployed. The second is the duration and complexity of the strategy. Strategies with many sets and repairs etc should take 3-4 hours. While simple strategies should take nearly 20 minutes.
No, you will need to make a fresh deployment of the backtest in order to consider the updated changes.
This could be caused in a particular run counter during a freak trades which caused the target or SL to get overshot. Liquidity could also cause the same issue.
No, currently the backtest feature is only available for NSE stocks NFO index futures and options.
Jan 2020 is the start date for the same historical data.