Auto Stop And TakeProfit 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!
The Auto Stop And TakeProfit Expert Advisor For MT4 is a basic trade management utility that executes only one function. Once run on any chart, the expert advisor checks if there is any trade and if the trade has a stop loss and take profit already. If not, the robot will set the stop loss and take profit values based on the desired amounts defined by the user in Inputs.
Since this expert advisor performs trade modification only, there is no use running it in the strategy tester to test its performance. Even if the user makes such an attempt, he cannot see any trade opened and closed by the robot. The function for opening trades is simply not there to begin with, so there is no trade whose stop loss and take profit need to be adjusted.
Someone might think that this tool does not deserve to be included in the group of expert advisors due to its basic and single function. However, no other type of MQL4 program can take its place. A script executes its designed functions in one iteration no matter how long it completes its operation and then leaves the terminal for good. On the other hand, a custom indicator stays on the active symbol unless removed by the user, but it cannot perform trade functions.
The Auto Stop And TakeProfit Expert Advisor For MT4 – Entry Criteria
When the Auto Stop and TakeProfit Expert Advisor is first dropped on a chart, it creates a button in the upper-left part of the main chart containing the text “AutoStop-TakeProfit Expert is running.” It is displayed with a big text and highlighted by a colorful background to catch the attention of the user when he drops by to check this chart. This way the user is aware of its presence and can use it in a moment’s notice.
The expert advisor is idle most of the time. On every tick, it cycles through the trade pool to find a trade on the current symbol. If there is none, it will return the command to the terminal. If in case a trade was found during its inspection, it will check if it has a stop loss and take profit. If none, it will immediately assign the stop loss and take profit based on the amount declared by the user in Inputs or the default values.
There are only three variables in Inputs that the user can work on. Apart from the stop loss and take profit, which are self-explanatory, the other variable available is easy to understand and use. These variables and their default values are explained below:
- StopLoss = 250 – The robot sets the stop loss of trades in the current symbol to 250 points (or 25 pips). The user can change this value at will based on the traded setup and timeframe.
- TakeProfit = 250 – The robot sets the take profit of trades in the current symbol to 250 points (or 25 pips). The user can adjust this value at any time according to his traded setup and timeframe.
- size = 10 – This variable refers to the size of the text in pixels on the button created on the upper-left portion of the screen. If the text is too big or too small, the user can try other values until he finds the right size. The size is adjusted in real time.
In each iteration, the robot performs a series of steps. First, it examines the trades in the terminal if there is any trade opened on the symbol where the robot is running. Then it checks the close time if it is not equal to zero. Next it analyzes the trade if it is a buy or a sell trade. Finally, it determines the stop loss if it is equal to zero or to another value not expected by the robot. In the first case, the robot immediately adds the stop loss to the trade. In the second case, the robot adjusts the stop loss to the expected value. For example, for a buy trade, the stop loss should be 25 pips below the open price. If this is not the case, the robot intervenes and puts the stop loss to its rightful place.
The expert advisor handles the take profit placement after the stop loss has been put into place. If the robot finds out that a trade has no take profit, it will immediately set the required take profit. If the trade has a take profit but the value is incorrect, the robot will amend the take profit and use the correct value.
If the user adds another trade to the current symbol and the trade has no stop loss or take profit or the values are different from the expected amounts, the robot will make the necessary changes. If trades were already in place even before the robot was attached to the chart, the robot will do the same thing.
If the user wants, he can use the expert advisor to other symbols as well. To do this, the user must apply one instance of the robot to each symbol of choice. There is no need to provide or change a magic number. The robot looks at the symbol of the open trade and works on the current symbol only.
The Auto Stop And TakeProfit Expert Advisor For MT4 – Exit Criteria
The Auto Stop and TakeProfit Expert Advisor is not involved in trade management other than setting the stop loss and take profit prices desired by the trader. Once this is done, it is up to the market to decide which result to give each trade. If price touches the stop loss, the trade ends in loss. If it hits the take profit, the trade ends in profit.
The Auto Stop And TakeProfit Expert Advisor For MT4 – Suggestion for Improvement
The Auto Stop and TakeProfit Expert Advisor performs a very simple function. If the user monitors and trades several symbols and wants the robot to set the stop loss and take profit of the trades in each symbol, applying one instance of the expert advisor to each symbol can be time-wasting considering it performs only one function. To solve this problem, the code must be revised so that the robot can see all trades in all symbols of the trading account. Making this change might take time, but this is a welcome development.
To make the robot more useful, adding more functions is an area to explore. For example, the robot can be programmed to execute trades as well based on the requirements of the trader. To implement this, the robot should create buttons on the chart that the user can click to open trades. Further, more buttons can be added to allow the user to manually close the trades he has initiated. These are just options provided to the trader to make the robot more versatile, but the user does not need to use them all the time. As the need arises, the additional options can come in handy.
When used in a demo account, the expert advisor seems to perform its current function well. The stop loss and take profit adjustment was fast. Almost no delay was encountered, and no error was returned. One thing that can be improved is the unit of measurement for the stop loss and take profit values in Inputs. Today, most foreign exchange traders are more familiar with pips than points, so it is better to define the values in pips than points.