|
|||||||
| Register in Forex TSD! | |
|
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time). Click here to register and get more information |
|
![]() |
|
|
LinkBack (8) | Thread Tools | Display Modes |
|
|||
|
Quote:
Thanks for help in advance... |
|
|||
|
Quote:
You mean that you tried to use it with real account? Should work as well. |
|
|||
|
Quote:
Quite confuse but thanks for your help anyway... |
|
|||
|
Close all opened orders
I have a question about how to close all opened trades. That include trades wich were opened manually.
Here is the code: if(BalanceEquityProtectionLevel > 0 && AccountEquity() <= AccountBalance ()* BalanceEquityProtectionLevel) { AllowTrading = false; Print("Min. Equity Level Reached - Trading Halted For ",Symbol()); // Alert("Min. Equity Level Reached - Trading Halted For ",Symbol()); for(cnt=OrdersTotal();cnt>=0;cnt--) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); mode=OrderType(); if (mode==OP_BUY) { OrderClose(OrderTicket(),OrderLots(),OrderClosePri ce(),slippage,Blue); } if (mode==OP_SELL) { OrderClose(OrderTicket(),OrderLots(),OrderClosePri ce(),slippage,Red); } // } } } The problem is that, If I have opened a few pairs it's not always true that all trades will be closed too. Further more, it happend that EA continue to open another trade despite the parameter allowtrading == false. I was debugging this thing and noticed that for some reason this code block was not executed for all pairs. Why, I don't know. Does somebody know answer to that? This block should close all opened orders and prevent further trading.Maybe I could resolve this issue with writting parameter false to a file or something? The problem in this situation is also with pairs that have no opened orders. Thanks.. Dejan Last edited by SloForeX : 12-12-2006 at 11:18 AM. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
LinkBacks (?)
LinkBack to this Thread: http://www.forex-tsd.com/tools-utilities/174-close-all-open-tools.html
|
|||
| Posted By | For | Type | Date |
| Close all trades with a push of a button? | This thread | Refback | 07-21-2008 03:38 PM |
| Close all trades with a push of a button? | This thread | Refback | 07-21-2008 03:28 PM |
| Close all trades !!! | This thread | Refback | 06-24-2008 03:13 AM |
| Close all trades !!! | This thread | Refback | 06-19-2008 10:53 AM |
| Close all trades !!! | This thread | Refback | 06-19-2008 09:33 AM |
| Antara EA yang telah diLIVE test oleh MyMEFx Grup - Page 50 - Nogold.com | This thread | Refback | 12-05-2007 03:58 PM |
| skrypty close i modify | This thread | Refback | 08-07-2007 04:11 AM |
| Ind close sume post with one click? - Nogold.com | This thread | Refback | 06-30-2007 03:02 PM |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Open/close trade on same bar's close? | WNW | Expert Advisors - Metatrader 4 | 2 | 03-29-2007 05:37 AM |
| close all open trades ea | G-Riper | General Discussion | 2 | 08-02-2006 09:41 PM |
| Close all open positions | jonjonau | Expert Advisors - Metatrader 4 | 6 | 07-12-2006 05:01 AM |
| Close All Open Positions? | lonespruce | Metatrader 4 | 9 | 06-22-2006 07:20 AM |