A new version of the CLOSEPRC Expert for Metatrader 5 was posted today. This EA can automatically close all open orders when a certain deposit percentage is reached. There is also a button for manual closing of all current positions. This EA is made by Yuraz

Close All Expert for Metatrader 5

You have to allow the EA to autotrade to work. You can input the deposit percentage in the black box with red borders ( see screenshot).

The button text and error codes of this EA are written in Russian. If you want it in English, open MetaEditor 5 ( it is part of the Metatrader 5 Beta ) and replace some lines of code with the translated text:



Replace lines 64-83 with the following:

case TRADE_RETCODE_REQUOTE: sRetCode=(string)retcode+" REQUOTE"; break;// 10004
case TRADE_RETCODE_REJECT: sRetCode=(string)retcode+" REQUEST REJECTED"; break;
case TRADE_RETCODE_CANCEL: sRetCode = (string)retcode+" CANCELLED"; break;
case TRADE_RETCODE_PLACED: sRetCode = (string)retcode+" ORDER PLACED"; break;
case TRADE_RETCODE_DONE: sRetCode=(string)retcode+" DONE"; break;
case TRADE_RETCODE_DONE_PARTIAL: sRetCode=(string)retcode+" DONE PARTIALLY"; break;
case TRADE_RETCODE_ERROR: sRetCode=(string)retcode+" REQUEST ERROR"; break;
case TRADE_RETCODE_TIMEOUT: sRetCode = (string)retcode+" REQUEST REJECTED BY TIMEOUT"; break;
case TRADE_RETCODE_INVALID: sRetCode = (string)retcode+" INVALID REQUEST"; break;
case TRADE_RETCODE_INVALID_VOLUME: sRetCode=(string)retcode+" INVALID VOLUME"; break;
case TRADE_RETCODE_INVALID_PRICE: sRetCode = (string)retcode+" INVALID PRICE"; break;
case TRADE_RETCODE_INVALID_STOPS: sRetCode = (string)retcode+" INVALID STOPS"; break;
case TRADE_RETCODE_TRADE_DISABLED: sRetCode=(string)retcode+" TRADE DISABLED"; break;
case TRADE_RETCODE_MARKET_CLOSED: sRetCode =(string)retcode+" MARKET IS CLOSED"; break;
case TRADE_RETCODE_NO_MONEY: sRetCode=(string)retcode+" NO MONEY TO HANDLE REQUEST"; break;
case TRADE_RETCODE_PRICE_CHANGED: sRetCode=(string)retcode+" PRICE CHANGED"; break;
case TRADE_RETCODE_PRICE_OFF: sRetCode=(string)retcode+" NO QUOTES TO HANDLE REQUEST"; break;
case TRADE_RETCODE_INVALID_EXPIRATION: sRetCode=(string)retcode+" INVALID EXPIRATION DATE"; break;
case TRADE_RETCODE_ORDER_CHANGED: sRetCode=(string)retcode+" ORDER STATUS CHANGED"; break;
case TRADE_RETCODE_TOO_MANY_REQUESTS: sRetCode=(string)retcode+" TOO MANY REQUESTS"; break;


line 242: ObjectSetString(0,buttonID,OBJPROP_TEXT,"Close all orders with one click");
line 262: ObjectSetString(0,labelID1,OBJPROP_TEXT,"Close orders when deposit percent is");
line 347: message="Button is pressed";
line 353: message="Button is not pressed";


Download the EA
View the MQL5 source code

0 comments

Post a Comment