| New signals service! | |
|
|||||||
| 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 | Thread Tools | Display Modes |
|
|||
|
need help with this function closealltrades
I notice broker sometimes requote the price causing the EA not to close
the order. How can I prevent the EA to continue until all of orders according to its magic number is closed, maybe put a sleep function for 5 second and a while loop to check and close the orders before continue. Below is the closealltrades function. Appreciate the help and thanks in advance. void CloseAllTrades() { int rc; int cnt; for(cnt=OrdersTotal()-1;cnt>=0;cnt--) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); if (OrderMagicNumber()==GetMagicNumber()) { rc= OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), MarketInfo(OrderSymbol(), MODE_SPREAD), Yellow); if(!rc) Log("Close error="+GetLastError()); } } } |
|
|||
|
Quote:
PHP Code:
Last edited by Michel; 03-14-2008 at 07:44 AM. |
|
|||
|
This line while(!IsAllClosed) {CloseAllTrades(); return;}
in the main start will close all open positions if MT goes down and I start it back up. Is there a way to put this line in the closealltrades function so it won't close all open positions after MT4 restart? thanks. |
|
|||
|
Quote:
PHP Code:
PHP Code:
Last edited by Michel; 03-14-2008 at 04:23 PM. |
|
|||
|
help needed with my semi profetable first EA
Hi All...
i made an EA by the great expert advisor bulder web site and i test it and found it profitble for the last year but i think that can be enhanced ... so if any one can help to improve that EA ? detaled about EA.. the EA pased on two indecators one of them is mine and the other is can found on bublic fourms " zero lag macd " now the expert is working all the time enter buy then close and reverse to sell and so on ... i need to make it work only in spesfic times, add a money managemint and the last thing i need to delay the excute of buy or sell with the next "1 minute" candel but the EA work on the 1H candel in fact ... so hope to find how can help in that Thank you All best regards Tamer |
|
|||
|
how to refer to the filename I'm running?
Hi,
I want to know how can I refer to a filename that I am running. For example if I run a script called supertrader.mq4 and I want to open a logfile called supertrader_logfile from the script supertrader. Is there a variable that holds the name of the file I am running? Thanks. |
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to code this? | iscuba11 | Metatrader 4 mql 4 - Development course | 1 | 08-03-2007 04:22 PM |