Exit on false Signal in Amibroker

#1
Hi All,
I built moving average cross-over strategy which is running on 15 min time frame. I am getting some false signal during the cross-over period.
As per my current code its placing order when first time cross-over occurs. Now my challenge is if the signal turns out to be false at the end of the closure of that candle ; amibroker wont generate any counter order. I want to immediately exit position if signal was false. Few post suggested to use static variable to store the order details but I dont have any reference code to work upon. Any reference or code would be helpful.

Thanks,
Dnyanesh