@chupdkasjgd I had been running it on a VPS, I figured the issue out finally after blaming thousands of things.
It was due to stop levels of the broker. I used buy/sell stops at the high/low of the candle, so when the candle closes at high/low it was causing the ea to crash, now after adjusting for stop levels it works smoothly.
But still I have a question, the stop levels are a lot i.e 1 pip, cause the strategy is on M1, is there any way to solve this.?? I wanna be able to the buy stop order at high/low of the candle but i wouldn't be able to do it if the close is within the 1 pip range of high/low.