sorry to post this but I can't seem to figure out what is wrong with my code.
I noticed that sometimes my ordersend isn't executed due to a timeout or "no connection" (amazon windows server) therefore i integrated this force open order function but it doesn't work.
Please have a look, I appreciate your help...
if(errorHandling==1) Print("tp=",tp," sl=",sl);
comment=coment+" Nº "+IntegerToString(totaltrades)+","+IntegerToString(numberofactivetrades);
if(opentradehandling==1) Print("Opend a sell Trade, sellticket nrº ",sellticket);
if(opentradehandling) Print("Order Send failed, error # ",GetLastError());
I've googled for cerification of open orders and edited what I found to suit my needs but it seems I'm missing out on something important.
When I set DontUseForceOpenWhenTesting to false the EA crashes MT4, oops :)
Tks again for your help
When you get no result, you don't know if an order was opened or not. Your code may try to open open another and another...
I simply log the error and return from OnTick. On the next tick, you have a connection, verify you don't already have an open order, and that conditions are still value and retry.