Really a Great!!
Very short in Programe~~!!!
And will very fast!
I don't understan about EA.
I try it, and it work so fast.
but for multiple order (more than 10 positions)
it work too slow.
How is it..?!
Thanks :)
Hi Matus,
After a Google search, I've found your CloseAllTrades EA and studied it's code. As expected, your EA closes all positions based on the ticket id's from their entries.
However, in your ManagerChampion EA I noticed it was able to close multiple entries in 1 exit order.
AFAIK, it's impossible to merge trade tickets and opening a position in the opposite direction isn't allowed, so I was wondering, how did you perform this trick?
Best regards,
Jim
hello...why i cannot download it?
They have deleted the files on server, i had 10 files but now I only can upload 9 files. I pack it in an zip file now, you can download scripts also from my page http://www.mtexperts.net/en/Free/Scripts
int start() { double total; int cnt; while(OrdersTotal()>0) { // close opened orders first total = OrdersTotal(); for (cnt = total ; cnt >=0 ; cnt--) { if(OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES)) { switch(OrderType()) { case OP_BUY : RefreshRates(); OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_BID),3,Violet);break; case OP_SELL : RefreshRates(); OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_ASK),3,Violet); break; } } }
BUG 1: The first for loop needs to start at OrdersTotal() -1 since arrays start at position [0].
BUG 2: Not really a bug, as such, but for speed critical code you should not be calling RefreshRates() at all since you are using the MarketInfo function. The RefreshRates() function only applies to Bid/Ask on this chart symbol.
int start() { double total; int cnt; while(OrdersTotal()>0) { // close opened orders first total = OrdersTotal(); for (cnt = total ; cnt >=0 ; cnt--) { if(OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES)) { switch(OrderType()) { case OP_BUY : RefreshRates(); OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_BID),3,Violet);break; case OP_SELL : RefreshRates(); OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_ASK),3,Violet); break; } } }
BUG 1: The first for loop needs to start at OrdersTotal() -1 since arrays start at position [0].
BUG 2: Not really a bug, as such, but for speed critical code you should not be calling RefreshRates() at all since you are using the MarketInfo function. The RefreshRates() function only applies to Bid/Ask on this chart symbol.
it is not big issue, it still will close all trades, but you are right, I will correct it,
because when I execute on a chart nothing happens.
This is a great script and very fast in action. Amazing tool, Thanks!
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
CloseAllTrades:
Author: Matus German