How to build/backtest a strategy 🧵?
1) Idea/Hypothesis
2) Specify entry,exit, SL & position size
3) Generate trade log & Backtest Report
4) Test in diff. market condn.
5)Optimise the strategy
6) Evalute the robustness & stress testing
7) Track Real Time performance
8) Deploy
1) Idea( Eg. Theta Eating Strategy)
Options decay with passage of time.
I look at the theta decay curve & wonder that some decay is intraday and some is overnight.
Can I capture the intraday theta decay by creating delta neutral positions ?
#idea #theta
2) Entry, Exit, SL & position size
Can we create intraday straddle to capture theta decay ?
Initial Logic :
Entry : Create straddle at 9:20 am
Exit : Close the straddle at 3:15 pm
SL : 10% of combined option premium
Position Size : 1 lot (CE & PE) per 2 lakh
3)Generate trade log & basic backtest report
The trade log contains all trades as per your trading logic.
Also plot the equity curve(cumulative P&L ) & certain backtesting metrics to see if the results are decent.
If yes then proceed further else discard the strategy.
4) Generate a detailed backtest report & test across different market conditions.
Look for metrics such as-
Outlier adjusted performance
Max drawdown & Time drawdowm
Profit factor
Model efficiency etc to decide whether the systems fits your psychology.
5) Optimise :
If the basic results look good, dig deeper.
-What if we exit at pre-defined profit instead of 3:15 pm ?
- Days suitable for the strategy ?
-Days when you should avoid the strategy ?
- High vix or low vix ?
Basically generate more insights.
6) Robustness & Stress Test
Check performance on black swan days
Check performance by removing outliers & max
Are trades evenly distributed ?
Consistent performance qtr by qtr, year by year,
Even dist. Of PnL ?
Also do walk forward testing.(Advanced topic so will explain later)
7) Track Real Time Performance
Start live execution with small qty before actualy deployment to get feel of the strategy.
Try to incorporate the feedback from live execution to further improve the strategy.
8) Deploy :
if the strategy passes all above steps then it’s fit for live deployment.
Deploy the strategty and monitor the real time performance.
The live performance should be similar to the backtest results.
9) Other important points
Make sure you avoid the following backtesting pitfalls and clean the data before backtesting.
-survivor ship bias
-look ahead bias
-in sample bias
Also include slippages,brokerage for true picture of the strategy
10) As a rule if you backtest for n months , you can trade for n/3 months.
And you need to assess your strategy from time to time bcz as market conditions keep changing your strategy may stop working.
How do you know your strategy has stopped working ? Think over it.
11) Resources :
Trading Systems by Emillo Tomasini is a good book to get started & learn how to build a trading system
Also one can start learning basic python for data analysis & backtesting
udemy.com/course/python-…
12) I hope you found the thread insighful.
I truly believe that small data insights can bring significant improvement in your trading
Start learning basic coding & data analysis online.
It’s not difficult, trust me. Just get started💯
End
Share this Scrolly Tale with your friends.
A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.