Exit condition before auto square off

I have created a strategy but the backtest is showing square off. I’m aware that it’s an MIS strategy and intraday trades should be exited before the market closes. But if the broker squares off my position I will be charged for the same.

So I want to give a code to the strategy to exit before the square-off time i.e. at around 3:10 pm.

My entry conditions are very simple. I’m doing 30min ORB with 1min candle closing confirmation. Please help me with the exit conditions so that I can analyze other things.

Hi @Hritik_Roshan

You can add the condition mentioned in the below image to your exit conditions. This condition will generate an exit trigger after the 15:09 1min candle closes i.e. at 15:10.

Refer to the following link to learn about the Candle time function - Indicators - Streak Help

Hope this helps.