Auto SL And TP Expert Advisor For MT4

Auto SL And TP 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. Auto SL And TP Expert Advisor For MT4
  2. The Auto SL And TP Expert Advisor for MT4 – Parameters
  3. The Auto SL And TP Expert Advisor for MT4 – Exit Criteria
  4. The Auto SL And TP Expert Advisor for MT4 – Exit Criteria
  5. The Auto SL And TP Expert Advisor for MT4 – Room for Improvement

 

The Auto SL And TP Expert Advisor For MT4 is a trading tool for setting either stop loss or take profit or both in case a trade does not come with a stop loss or take profit. It cannot be considered an automated trading system as it does not open trades by itself. That is why it does not work in back tester because it requires a previously placed trade to perform its functions.

When the robot is applied to a chart, it scans the trading account to find open trades (either buy or sell). Once a trade is found, the robot checks further if the trade was placed without a stop loss or take profit. If this is the case, the robot modifies the trade by setting a price for the stop loss or take profit. The scope of the robot is the whole trading account. It does not have to be attached to multiple charts to work. Applying the program to one chart is enough.



FREE Auto SL And TP EA

Download the FREE Auto SL And TP Expert Advisor for MT4.

To receive my email 100% sure: 
Put my email on your whitelist!

The Auto SL And TP Expert Advisor for MT4 – Parameters


The Auto SL And TP Expert Advisor has two main functions that are carried out on every tick. These functions are the stop loss adjustment and take profit adjustment. The robot performs these functions separately from one another.

The user is given several parameters to adjust in inputs the first time the robot is attached to the chart. However, he can change the values of these parameters at any time. The variables, default values and purposes are explained in detail below:

 

 

    • Set_StopLoss = true – By default, this variable is set to true, meaning stop loss placement will be carried out by the robot. Otherwise, the robot will not place the stop loss of trades without stop losses.

 

    • Set_TakeProfit = true – The user can set this value to true or false. If true, take profit placement will be done by the expert advisor. If false, the robot will not put a take profit target to trades without take profits.

 

    • StopLoss_Method = 1 – The user can choose between two methods of stop loss. A value of 1 means that the user will decide the amount of stop loss, while a value of 2 means that the stop loss will be based on the value of the average true range.

 

    • Fixed_SL = 5 – This value is in pips. If the stop loss method is 1, the robot will set the stop loss at a distance of 5 pips from the open price.

 

    • StopLoss_ATR = 0.7 – This value is used as a factor. If the stop loss method is 2, the robot will get the ATR value and multiply it by a factor of 0.7 to get the stop loss. The user can set another factor of his choosing.

 

    • TakeProfit_Method = 1 – The user can set either 1 or 2 for this variable. If the value is 1, the take profit will be placed at a certain number of pips from entry price. If the value is 2, the take profit will be a multiple of the ATR value.

 

    • Fixed_TP = 10 – If the take profit method is 1, the default take profit is 10 pips.

 

    • TakeProfit_ATR = 1.8 – If the take profit method is 2, the take profit will be equal to the ATR value times 1.8.

 

    • ATR_TimeFrame = 7 – The ATR value is computed on the timeframe defined by this variable. The value of this variable ranges from 0 to 9. If the value is 0, the timeframe used is the current timeframe. The value of 7 is equivalent to the daily chart.

 

    • ATR_Period = 30 – The period used for the ATR computation is 30. This value is much greater than the standard value used by most traders (i.e., 14).

 

    • Alert_On = false – By default, this parameter is false, meaning alerts will not be shown on the chart. If true, alerts will be displayed if the stop loss or take profit of a trade has been set.

 

 

The Auto SL And TP Expert Advisor for MT4 – Exit Criteria

 

The expert advisor uses one technical indicator to define the location of the stop loss or take profit of a trade. This indicator is among the array of chart studies that comes with MT4.

 

 

    • Average true range (period 30, daily timeframe) – The value of the ATR is computed from the daily timeframe by default and for the previous candle. This value is multiplied by the stop loss multiple or take profit multiple set by the user in inputs to get the actual stop loss or take profit price. This indicator is used only when the user sets the StopLoss_Method or TakeProfit method to 2.

 



During initialization, the expert advisor determines the timeframe equivalent to the value of the ATR_TimeFrame set by the user in inputs. Normally, the value of this variable is expressed as an enumeration, which is easier to set than a number does. In this expert advisor, the user can set any value from 0 to 9. A value of 1 is equivalent to one-minute timeframe, 2 is equal to five-minute timeframe, 3 is equal to 15-minute timeframe, and so on. The default value is 7, which refers to the daily chart. When the value is zero, the robot will use the period of the current timeframe. See image above.

 

The timeframe determined during initialization is only used when obtaining the value of the average true range, which is only computed when the user explicitly defines in inputs that the stop loss or take profit be based on ATR multiple. If the user chooses the first option (i.e., fixed number), then the stop loss or take profit will be a number of pips from the entry price.

 

In order for the expert advisor to work, it must find an open trade without stop loss or take profit on any symbol of the active trading account. If so, it looks at the stop loss or take profit method chosen by the trader in settings. If the current order is a buy trade, its stop loss will be placed below the open price, and its take profit will be put above the entry price. If the order is a sell, its stop loss is placed above open price, and its take profit price is set below entry price.

 

The Auto SL And TP Expert Advisor for MT4 – Exit Criteria

 

The Auto SL And TP Expert Advisor does not actively take part in trade management. After setting the stop loss or take profit of a trade, the job of the robot is done. In this case, the trade can be closed only by the stop loss or take profit. It is only a matter of time.



The Auto SL And TP Expert Advisor for MT4 – Room for Improvement

 

The Auto SL And TP Expert Advisor works exactly as it is called. It performs no other functions. It would have been better had the robot been programmed to trail the stop loss or bring it to breakeven to make the robot a more versatile tool. Regardless, its scope of operation is global, so it is still useful. The trader may initiate a trade on any symbol, and the robot can see the trade and set the stop loss and take profit.

 

While the logic of the code is still correct, there is one condition that can be improved to achieve better precision. In the image above, the coder uses an inequality operation to determine if a trade has no stop loss or take profit. This can be made more precise and concise by equating the OrderStopLoss() function to zero.

 

FREE Auto SL And TP EA

Download the FREE Auto SL And TP Expert Advisor for MT4.

To receive my email 100% sure: 
Put my email on your whitelist!

 

Partially Automated Trading Besides Your Day Job

Alerts In Real-Time When Divergences Occur

My Recommended MT4/MT5 Broker

About Me

I'm Mike Semlitsch the owner of PerfectTrendSystem.com. My trading career started in 2007. Since 2013 I have helped thousands of traders to take their trading to the next level. Many of them are now constantly profitable traders. 

The following performance was achieved by me while trading live in front of hundreds of my clients:

Connect With Me:  

Results From 5 Months!
This service starts soon! Be the first who get's notified when it begins!

This FREE Indicator Can Transform
Your Trading!

FREE Indicator + Telegram Group


Request the Ultimate Double Top/Bottom Indicator which is used by 10,000+ traders.