'the alerts fires to close trade without closing it in trade list

if anyone could help me with my problem ,,, why my alerts fires to close the trade while the trade still open in trade list of strategy!? i am using condition to close the trade with this code strategy.close_all(when =window() and ta.crossover(EMA,close),alert_message = "Cond Exit" , comment = message_long_exit) and i am using f_secureSecurity(_symbol, _res, _src) => request.security(_symbol, _res, _src[1], lookahead = barmerge.lookahead_on) to avoid repainting



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source