Basics in Strategy Backtesting
Backtesting is the process of testing a strategy on historical data set to estimate its profitability in live trading. This article explains the intricacies in backtesting regardless of which software you are using for backtesting.
Contents
Step1: Collating the Historical Data
The most important step in backtesting is having a properly normalized data for backtesting. For stocks, you need to check whether the data has been adjusted for bonus, splits or extraordinary dividends. For Futures, you should check if you continuous data reflects only the current scrip.
Step2: Testing the Strategy Code for Real-time simulation
The strategy which is being backtested should be good enough so that it mimic real-time execution. As an example, a strategy which triggers signal’s on day close can only be executed the next opening day. If the backtesting strategy generates signal on same day, it cannot be deployed in real-time.
Step3: Testing the Execution Settings
This step requires careful proper trade execution settings for backtesting. Example: IF the strategy generates signal on the opening of a candle, the trade price should also be the opening price of candle. However, if the strategy generates signal at the Opening of a Day, the execution price may be chosen after 5 minutes of day open. This is because you are very unlikely to trade at the opening price of day in actual practice.
Step4: Including Appropriate Costs- Slippage, Transaction Charges
We will elaborate more on these topics shortly. Amibroker useres should refer: Amibroker Backtest Tutorial in 5-Minute
Nifty
How do you backtest contract wise data,is there a way to stitch the data or is there anything else that can be done,please advice.
AlgoPro
@Nifty,
It requires a little smart AFL coding; there cannot be any generalized AFL for this because the tickers differ from one data source to another.
We have now made it part of Session-12 in APSAT https://algoji.com/pro-algo-trading-course/
Mithoon
Thank you very much….