int start() { int total = OrdersTotal(); for(int i=total-1;i>=0;i--) { OrderSelect(i, SELECT_BY_POS); int type = OrderType(); bool result = false; switch(type) { //Close opened long positions case OP_BUY : result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 5, Red ); break; //Close opened short positions case OP_SELL : result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 5, Red ); break; //Close pending orders case OP_BUYLIMIT : case OP_BUYSTOP : case OP_SELLLIMIT : case OP_SELLSTOP : result = OrderDelete( OrderTicket() ); } if(result == false) { Alert("Order " , OrderTicket() , " failed to close. Error:" , GetLastError() ); Sleep(3000); } } return(0); }
Add this as SCRIPT to your mt4 and call it whenever you need it. Be carefully it closes really all orders does not matter pending or active.
./Indicators | 100ma_qual.mq4 | 4344 bytes |
./Indicators | 100ma_qual.mq4 | 4344 bytes |
./Indicators | 100_pips.mq4 | 4442 bytes |
./Experts | 100_pips_a_day.mq4 | 4442 bytes |
./Experts | 100_pips_ea.mq4 | 4444 bytes |
./Experts | 100_pips_v2_inverso.mq4 | 4590 bytes |
./Experts | 100_pips_v3.1.mq4 | 5285 bytes |
./Experts | 100_pips_v3.mq4 | 4468 bytes |
./Experts | 100_pips_v3_1_.1.mq4 | 4579 bytes |
./Indicators | 5383_lbr_1000_pips_one_week_ki_signals1_h1_low_3_10_18_optimized.mq4 | 4467 bytes |
./Experts | eurusd_usdchf_atr_100.mq4 | 22369 bytes |
./Experts | makegrid_50_100_200_30pips_stop70.mq4 | 11783 bytes |
./Experts | makegrid_with_100_and_200_ema.mq4 | 11683 bytes |
./Experts | makegrid_with_100_and_200_ema.mq4 | 11683 bytes |
./Indicators | newmacd__50_100_200.mq4 | 3263 bytes |
./Indicators | test_last_100.mq4 | 2349 bytes |
./Indicators | test_last_100.mq4 | 2349 bytes |
./Experts | truesort_1001.mq4 | 6222 bytes |
./Experts | truesort_1100.mq4 | 5901 bytes |
./Scripts | zz_timewinter_1_1000.mq4 | 2120 bytes |
./Indicators | zz_yz_mdac_elder_1_1000.mq4 | 6427 bytes |
There seems to be different version of that EA. check http://www.fx1.net/codelibrary.php for others.
fx1.net:
Add this as SCRIPT to your mt4 and call it whenever you need it. Be carefully it closes really all orders does not matter pending or active.
Add this as SCRIPT to your mt4 and call it whenever you need it. Be carefully it closes really all orders does not matter pending or active.
Thank you!! Thart saves a lot af time. And thnx for the array of EA's. Which one is your favorite?
Mario123:
Thank you!! Thart saves a lot af time. And thnx for the array of EA's. Which one is your favorite?
Thank you!! Thart saves a lot af time. And thnx for the array of EA's. Which one is your favorite?
I just installed one of the EA's you sent me. Backtesting revealed that that EA performed bad on the 15 min bar but did very well on the 5 min bar. Can one install the EA just for one bar-chart?
Mario i dont have any experience with that EA, so i cannot help you with that. You can install same EA to unlimited charts
fx1.net:
Mario i dont have any experience with that EA, so i cannot help you with that. You can install same EA to unlimited charts
Mario i dont have any experience with that EA, so i cannot help you with that. You can install same EA to unlimited charts
It's just to understand how MT4 works. When i install any EA, it runs on all charts. This particular EA operates best at the M5 chart so i want to install it just for that chart. Do you know if that is possible in MT4 or is it something you have to enclose in the EA?
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Hello,
I'm a novice with MT4 and have a question. Last night i installed an EA (100pips). This EA started very enthousiastic and opened about 160!! trades which were closed during the night. It resulted in a los of about 40 pips. Overnight it opened about 140 trades. Current loss is - 100 pips (not closed yet). Question: can i close all the trades in one time (it seems undoable to close them piece by piece)?
Kind regards Mario