This was previously reported, I didn't believe it then.
It's possible that there is now a delay in transferring open orders and a new tick comes in first.
Adding a 5 second delay after opening, before returning, should be sufficient to insure the update occurs before the next tick.
I don't know if this is a good idea or not as it involves a possible endless loop
total=OrdersTotal(); if(total<1) { ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-StopLoss,Ask+TakeProfit,"",0,0,Green); } if(ticket>0) while ( total <1 ) { total=OrdersTotal(); }
total=OrdersTotal(); if(total<1) { if(hB - lB <= 0.0035 && (tH >= 17 || tH <= 3)) { if (Ask <= lB + 0.0002) { ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-StopLoss,Ask+TakeProfit,"",0,0,Green); Sleep (10000); } else if (Bid >= hB - 0.0002) { ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+StopLoss,Bid-TakeProfit,"",0,0,Red); Sleep (10000); } } }
never mind i think i see the issue
jshumaker:
never mind i think i see the issue
Please share what you have fond as this is potentially a very serious issue . . .
never mind i think i see the issue
I believe the total variable was getting reset. I believe that this fixes the issue. Although I did not have my EA running in demo mode since I made the change. So I cannot say for certain if that fixes it, but I believe I got the double orders after a code change. Therefore I really felt that it had to be something with my code
//total=OrdersTotal(); // if(total<1) // replaced with this if(OrdersTotal()==0)
datetime order_time=TimeCurrent(); OnTick() { if ( order_time != TimeCurrent() ) { Order Send... order_time=TimeCurrent(); } }

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
While testing my EA on a demo account, I noticed that I got an order executed twice in the same second. Although I have a check before using OrderSend to make sure that I do not currently have an order open. What would you suggest I do to prevent this?