- Since you're not selecting history, OrderCloseTime will ALWAYS be zero
- Either you must remember the ticket number (persistent storage) for checking next tick, or
for(pos = OrdersTotal()-1; pos >= 0 ; pos--) if ( OrderSelect(pos, SELECT_BY_POS) // Only my orders w/ && OrderMagicNumber() == magic.number // my magic number && OrderSymbol() == Symbol() ){ // and my pair. if (OrderType()==OP_SELLSTOP && Ask>OrderStopLoss()){ if(!OrderDelete(OrderTicket())) Alert("OrderDelete(",OrderTicket(),") failed:", GetLastError()); } }
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
Hi guys,
I want delete my pending order if price reach StopLoss which is defined in order. I need to check this conditions in every price change, but now it checks only once after ordersend. Can you give me advice with this.