I had an EA which worked fine. As I needed to avoid to open position on calendar events, I've added some more code into my EA. In order to test it, It simply opens a long position if EURUSD market rate is above 1.1300 and opens a short position if the EURUSD market rate is below 1.1300. It close the position if Bid > OrderOpenPrice (Ask < OrderOpenPrice for short trades). So whenever a position is closed a new one should be open (just for test purposes). When I compile the code, it opens a position and closes when Bid is greater than Order Open Price. But it never opens a new position. What can be wrong? You can find the code in the attachment.