4109 Bug in reverse script

 

I just coded a little script to use with a single position per pair; it should just kill what's there and open a new one in the other direction, but I get this "Trade not allowed" - anyone know what causes that? ( Code attached )

Files:
Reverse.mq4  3 kb
 

Alright I don't much about coding but how exactly is the first position open?

 

On the Interbank FX platform I open a chart and take a small position. Then I drop the script on it, and I get a 4108. I appreciate you're looking at it.

 

Oops - 4109 (magic fingers)

Reason: