Member-only story
Backtesting Buddha Time Compression Strategy: Index Inside Bar Strategy
Backtesting Index Inside Bar Intraday Strategy Using Python
Let’s start by importing index_ib.csv file which was shared in the earlier chapter. It contains all the dates when the NIFTY and BankNIFTY Index exhibited the Inside Bar Pattern from 2015 to today.
In case You have gone through the course on Coding Time Compression Scanners that shows how to scan the stocks for these bars from Stratch, Please save the database to the same format and if needed add a fake column entry to adjust with the following tutorial –
Initialize the Database
df = pd.read_csv("/root/apps/trident/index_ib.csv")
df
The output will be –
date symbol marketcapname sector
0 01-12-2015 NIFTYFINSERVICE Smallcap Indices
1 01-12-2015 BANKNIFTY Smallcap Indices
2 07-12-2015 NIFTYFINSERVICE Smallcap Indices
3 10-12-2015 NIFTY Smallcap Indices
4 10-12-2015 NIFTYFINSERVICE Smallcap Indices
... ... ... ... ...
558 31-07-2023 BANKNIFTY Smallcap Indices
559 04-08-2023 NIFTYFINSERVICE Smallcap Indices
560 07-08-2023 BANKNIFTY Smallcap Indices
561 10-08-2023 NIFTY Smallcap Indices
562 17-08-2023 NIFTY Smallcap Indices
563 rows × 4 columns
Note that the uploaded files are sometimes updated with new files with current data. So, You may see a slightly different format or more amount of data. Nothing to worry about.