if i use BeforeMarketClose and liqudate all the securities,what is the probability that all the order will be squared off.

as of now i am doing hard codding by setting execution time at 3:59 pm.

Logic for the algoriithm is making a give a buy call based on first 2 baR of the starting of the day having consolidation of 30 min each and sell at the end of the day at marketprice if order was placed in the morning(10:30).