Buy Sell Stop Buttons 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:
- Buy Sell Stop Buttons Expert Advisor For MT4
- The Buy Sell Stop Buttons Expert Advisor For MT4 – Entry Criteria
- The Buy Sell Stop Buttons Expert Advisor For MT4 – Exit Criteria
- The Buy Sell Stop Buttons Expert Advisor For MT4 – Room for Improvement
The Buy Sell Stop Buttons Expert Advisor For MT4 is a semi-automatic trading system for MetaTrader4 trading platform. It works on one symbol only, that is, the symbol where it is attached by the user. If the user wants to use this expert advisor in other trading symbols, one instance of the program should be attached to each of those symbols.
As the name suggests, the robot might be thought of as a program that creates buy and sell stop buttons on the chart that the user can interact with when he intends to open trades. Such assumption is not correct in the actual scenario. It can be said that this expert advisor is incorrectly named. In reality, the robot creates buy, sell and close buttons on the chart (see image above).
It becomes clear that the expert advisor actually allows the trader to manually open trades and manually close the trades. While manual trade entry is a requisite, manually closing trades is not mandatory, just an option for the trader that he can use at any time. This is because the robot can manage the trades on behalf of the trader. In order to do this, the robot needs direction from the trader. The user should set the stage by putting in the desired values in Inputs.
The Buy Sell Stop Buttons Expert Advisor For MT4 – Entry Criteria
On every tick, the Buy Sell Stop Buttons Expert Advisor executes three major functions. These functions are the trade exit, breakeven and trailing. However, the time spent on each function will be short if there is no open trade yet on the current symbol.
There are a few variables in Inputs that the user must acquaint himself with and tweak as necessary to make the most of this trading tool. These variables are covered in detail below:
- USESTOP = true – When this variable is set to true, the robot will check on every tick if an open trade can be closed.
- USEMOVETOBREAKEVEN = true – When this parameter is set to true, the expert advisor will check on every tick if the stop loss of an open trade can be moved to breakeven.
- WHENTOMOVETOBE = 10 – The stop loss of a trade will be moved to breakeven if the trade has gained at least 10 pips. This event happens only once.
- PIPSTOMOVESL = 5 – When the breakeven function is on and a trade has gained 10 pips, the expert advisor will move the stop loss five pips beyond the entry price to secure five pips of profit.
- Lots = 0.01 – This lot amount is only a nominal position size. The actual lot size depends on the maximum risk.
- MaximumRisk = 0.02 – Since this value is greater than zero, the robot will not use the lot size above. To get the actual lot size, this value is multiplied to the free margin and divided by 1,000.
- TrailingStop = 40 – The trailing stop function takes effect when a trade has earned at least 40 pips.
- Stop_Loss = 20 – When the user has initiated a trade by clicking the Buy or Sell button, the trade has an initial stop loss of 20 pips.
- TakeProfit = 50 – After the user has executed a trade, the robot will immediately set the take profit to 50 pips.
- MagicNumber = 1111 – Each trade executed by clicking on the Buy or Sell button will have this magic number to be used later in trade management.
- NumberOfTrades = 3 – This variable does not refer to the number of trades allowed to be opened on each symbol; rather, it refers to the number of times that the robot attempts to open a trade when the user clicks on the Buy or Sell button.
The expert advisor does not use a technical indicator for trade entry, only for trade exit. What this indicator is and how it is used for this purpose are explained below:
- Bollinger bands (period 20, deviation 2) – A standard Bollinger bands indicator is used for trade exit. A buy trade will be closed if the close price of the previous candle is above the upper band, and a sell trade will be closed if the close price of the previous candle is below the lower band. The values of the upper and lower bands are obtained from the previous bar of the current period and symbol.
When the user clicks either the Buy or Sell button on the active chart, the robot instantly sends a trade request to the trade server. This request includes the lot size, stop loss, take profit, and magic number specifications. While it appears that the user can set the lot size to any value of his choosing in Inputs, this value will be overlooked by the robot during trade execution as the maximum risk variable is greater than zero.
To get the lot size, the robot determines the free margin on the trading account and then multiplies the value of the maximum risk. Next, the product is divided by 1,000 and the quotient is normalized to three digits. To prevent order entry errors due to invalid lot amount, the robot checks further if the obtained lot size is within the range of the minimum and maximum lot amounts allowed for the trading account.
The Buy Sell Stop Buttons Expert Advisor For MT4 – Exit Criteria
By setting the stop loss and take profit of each trade, the Buy Sell Stop Buttons Expert Advisor allows the market to have some say over the outcome of a trade. Because the robot actively manages winning trades, the market can only affect losing trades. If price moves against a trade for 20 pips, the trade will be closed in loss. On the other hand, the moment a trade gains 10 pips, the robot will immediately secure the profit by moving the stop loss to five pips beyond the entry price. If the new stop loss has not been hit and price moves further in the trade’s favor, the trade will be trailed when the gain reaches 40 pips.
In addition to breakeven and trailing stop, the expert advisor may close a trade from time to time as it deems necessary. This happens when the robot receives a signal that is opposite to the direction of an open trade. This signal comes from the Bollinger bands. For example, if the trade under consideration is a buy trade and the indicator gives a bearish signal, the trade will be forcibly closed, but only if the order profit is positive.
The Buy Sell Stop Buttons Expert Advisor For MT4 – Room for Improvement
The Buy Sell Stop Buttons Expert Advisor needs some improvement to become a more useful tool. While the buttons look good on the chart, it is better if some options or information provided in Inputs are also shown on the main chart so that the user does not have to click on the expert settings to check some details from time to time.
Also, there is one variable in Inputs that is not serving its purpose well. This variable is Lots. Allowing users to adjust this value will only cause confusion if they later find out that the lot size of opened trades is not the same as they have set in Inputs. Had the maximum risk variable been set to zero by default, this should not be a cause of concern. To solve this issue, either the Lots variable is taken out from Inputs, or the maximum risk variable is set to zero by default.