1 Click Button To Close All Open Positions Expert Advisor For MT4
WE IMPROVED THIS EXPERT ADVISOR FOR YOU!!!
PLEASE NOTE: This expert advisor was publicly available for free usage on other websites and is not programmed by us. We explain the functionality and possible improvements of the EA. Furthermore, we are convinced that fully automatic Expert Advisors will fail in the long run. On the other hand, our semi-automatic approach with detecting the best setups and then activating our Expert Advisors (e.g. V-Power EA, EdgeZone EA) produced many successful traders and some of them even got prop traders at prop trading firms. Therefore, we added a similar semi-automatic trading feature (to allow only buy or only sell trades) to the free Expert Advisors. You can download the modified version here and enjoy!
Table Of Contents:
- 1 Click Button To Close All Open Positions Expert Advisor For MT4
- The 1 Click Button To Close All Open Positions Expert Advisor For MT4 – Entry Criteria
- The 1 Click Button To Close All Open Positions Expert Advisor For MT4 – Exit Criteria
- The 1 Click Button To Close All Open Positions Expert Advisor For MT4 – Room for Improvement
The 1 Click Button to Close All Open Positions Expert Advisor is a simple utility for managing trades in the MetaTrader4 platform. In fact, it serves only one purpose, that is, to close all open trades in the trading account where it is running. While this sounds to be a cool function, it actually carries a huge risk if the user is not aware of it or is not careful.
The moment the expert advisor is dropped on any chart, it shows a big red button on the upper-left portion of the chart window containing the text “CLOSE ALL”. The text is in upper-case letters and the button is in red to warn users that clicking the button means closing all trades in the account regardless if the trade is profitable or losing, whether it is manually opened by the trader or not, and even if it is initiated by another expert advisor.
The user does not need to put multiple instances of this program in different charts. Only one program is enough to close trades executed in various symbols. The expert advisor does not actually look at the symbol of the currently selected order. Once the robot identifies the order as either a buy or a sell, it will close the trade immediately if the button is pressed. This is the major risk posed by this utility. The user might accidentally close trades that he does not intend to close, resulting in losses of varying degrees.
The 1 Click Button To Close All Open Positions Expert Advisor For MT4 – Entry Criteria
The 1 Click Button to Close All Open Positions Expert Advisor creates an object on the main chart the moment it is dropped on the chart. This object is a button whose properties are defined by the creator in the code. The user has no ability to change the look and feel of this button, and he cannot move it around on the chart.
This expert advisor does not run on every tick, at regular intervals or when a new candle has formed. Once the button is created, it waits for a certain event to take place before the robot performs its function. The only trade operation handled by this program is trade closure. However, it can only close market orders (i.e., buy or sell). It cannot close pending orders such as stop and limit orders.
There is only one parameter available to the user to adjust in Inputs. That is, the maximum slippage. The default value is five, which is actually five points, not five pips. The maximum slippage is considered by the expert advisor when closing trades. If the trade server fails to respond to the trade closure request in time and price has moved more than 5 points from the time of request, the trade under consideration will not be closed.
As a trade management tool, this expert advisor does not refer to any technical indicators for values to be used in trade identification as it does not perform another function besides closing trades. The program lies dormant most of the time until the user instructs it to do its role.
The 1 Click Button To Close All Open Positions Expert Advisor For MT4 – Exit Criteria
The 1 Click Button to Close All Open Positions Expert Advisor does not contain code for trade management as this is done manually by the trader. It does not open any trade, and it does not monitor trades in the current symbol, much less look at trades in other symbols.
The trader conducts his own analysis to trade the market and then enters the trade manually or algorithmically using another robot or script, but he can tap this program for help when the time has come to close the trade. The user must remember that clicking the Close All button closes not just the trade in one symbol but all the trades in the trading account.
The 1 Click Button To Close All Open Positions Expert Advisor For MT4 – Room for Improvement
The 1 Click Button to Close All Open Positions Expert Advisor needs a lot of improvement to become a more useful utility for manual trading. At this time, it is better to convert the expert advisor into a script as the latter is safer to use. This can be done without incurring any problems. The advantage is that the script does not get in the way if the user wants to put another expert advisor in the current chart.
Since the expert advisor is inactive for the most part, the idea of converting it into a custom indicator might come to the surface. However, this is not possible at all. While an indicator can perform a lot of functions and does not interrupt the operations of expert advisors in the current symbol, it cannot do any function related to trade operations, such as opening and closing trades, modifying trade orders and deleting pending orders. Only a script and an expert advisor can do such functions.
The most important thing to improve in this expert advisor is the manner of closing trades. This is such a major security concern that cannot be overlooked. If possible, the code must be updated to give the user a chance to choose one from multiple options when closing trades. This setting should be available in Inputs as a drop-down menu wherein the options are connected to one external variable.
The following trade exit options should be considered: close all trades in the current symbol, close all trades in the trading account, close all profitable trades in the active symbol, and close all profitable trades in the trading account. The user has several options to close trades based on his needs. More exit options can be added as necessary.
Another safety net that can be added is asking for confirmation if the user wants to carry out a specific option when the button is clicked. This way the user can confirm if he really intends to do something. This can be done by adding code that forces the platform to display a message box where the user can select one or more options. Additionally, when the message box appears, sound can be played to alert the user of the risk involved in performing the action he is about to carry out. Only a few lines of code must be added to put these things in place.
It is also a good idea to put a variable in Inputs that will allow the user to specify the magic number of trades that the trade closure action should be applied. When this is implemented, only the trades having the specified magic number will be closed by the robot. However, if a trade is opened manually by the trader himself, it will not be closed using this method. This matter must be considered when providing options for closing trades.
While it is not of extreme importance, if possible, the user must be given the capability to change the location of the Close button and move it anywhere on the chart. This can be done by making the base corner available as an external variable. In the same manner, the anchor points (x distance and y distance), as well as the width and height of the button in pixels, can also be made adjustable by putting them as variables in Inputs. This will give the user a lot of freedom to design the button in a way that pleases him.