not AFAIK simple to do this
1) for () // loop all the orders 2) OrderSelect() // select_tham_one_by_one 3) if () // find if it's the order u loocking for by OrderType (& or whatever) 4) OrderDelete() // this order 5) OrderSend() // a new one at market price 6) mission accomplished 7) It was so hard ??
qjol:
not AFAIK simple to do this
Hard? No, of course not, if you are an experienced coder in this language and are current. My coding days were over many years ago and they spanned from Fortran through VB. My beard is very grey and we won't speak of the hair that used to be elsewhere; so I do not have the interest to learn new things.
But thanks for this. I will try to make use of it.
SR
seattlerust, please try the following untested code:
double dPP, dSL, dTP; for (int i=OrdersTotal()-1; i>=0; i--) { if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) { if (OrderType() >= OP_BUYLIMIT && OrderType() <= OP_SELLSTOP) { if (OrderType()%2 == OP_BUY) dPP = MarketInfo(OrderSymbol(),MODE_ASK); else dPP = MarketInfo(OrderSymbol(),MODE_BID); dSL = OrderStopLoss(); dTP = OrderTakeProfit(); if (dSL!=0) dSL=dPP-(OrderOpenPrice()-dSL); if (dTP!=0) dTP=dPP+(dTP-OrderOpendPrice()); if (OrderSend(OrderSymbol(),OrderType()%2,OrderLots(),dPP,5,dSL,dTP,OrderComment(),OrderMagicNumber()) == false) { Print("OrderTicket ",OrderTicket()," modify error ",GetLastError()); return; } if (OrderDelete(OrderTicket()) == false) { Print("OrderTicket ",OrderTicket()," delete error ",GetLastError()); return; } } } }
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
I occasionally have a number of limit buy or sell orders in place (multiple lots so I can scale out) that bog down just before reaching execution level and I would like to execute all of them at one time at market. Is there an EA available that does this?
Thanks,
SR