Member-only story

Backtesting Buddha Time Compression Strategy: Index Inside Bar Strategy

Amit Kumar Ghosh
15 min readSep 20, 2023

--

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.

--

--

Amit Kumar Ghosh
Amit Kumar Ghosh

Written by Amit Kumar Ghosh

Aloha, I’m Amit Ghosh, a web entrepreneur and avid blogger. Bitten by entrepreneurial bug, I got kicked out from college and ended up being millionaire!

No responses yet