I want to automate my strategy and back test it to test in NIFTY, BANKNIFTY and SENSEX expiry

OPTION buying strategy and backtest it

Entry criteria- Only on Expiry day of Bank Nifty, NIFTY and SENSEX around 2.55-3.00pm when ATM premium of CE and PE side premium values is same.

Mark the ITM premium price of the higher value at entry time and deduct premium value of the higher ITM premium minus 5

Exit criteria-When CE or PE option premium is equal to ITM higher option premium at entry minus 5 premium value or before 3.29pm