Error 130 on this EA sometimes - page 2

 

Today I didn't recompile while running the EA and those errors didn't really crop up. The only one I got once was the "Pending Hedge long failed:130|1.3187|stop:1.3147|Take:1.3217" which is linked to error code 130. I'm not sure why I'm still getting this since I now create my orders with a stoploss and takeprofit of 0 and modify them immediately afterwards.

Also, can someone tell me how to account for the spread correctly in this code? It seems that when a level is reached, the opposing hedge wont be created until the price has moved about 1 pip further which is highest spread I currently have on the GBPJPY where I noticed this happening.

Reason: