Head and Shoulders 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 Head and Shoulders Expert Advisor For MT4 uses various technical tools when trading the financial market. It employs the fractal indicator to find reversal points on the chart in line with the direction of two trend lines. To qualify a trade signal, a pair of moving averages is also used along with the momentum indicator. All these technical tools are applied on the active timeframe and symbol. It is not clear why the name of the expert advisor is associated with the famous head and shoulders price action pattern.
The Head and Shoulders Expert Advisor For MT4 – Entry Criteria
The Head and Shoulders Expert Advisor gives the user some control on how he wants the expert advisor to perform its functions. This is done by offering some crucial parameters in trade operations as inputs that the user can tweak as he sees fit. These parameters are discussed below:
- Lots = 0.01 – This number is the fixed lot size for all trades taken by the expert advisor.
- Stop_Loss = 20 – All trades initiated by this expert advisor come with a stop loss of 20 pips.
- MagicNumber = 1234 – This number is given to a trade upon entry to associate it with this robot.
- Take_Profit = 50 – The nominal take profit amount of each trade is 50 pips.
- FastMA = 6 – A moving average (period 6) is being used in this trading system for identifying the trend.
- SlowMA = 85 – Another moving average (period 85) is used in this trading system for identifying the trend.
- Mom_Sell = 0.3 – The momentum value should be less than 0.3 so that a sell signal is validated.
- Mom_Buy = 0.3 – The momentum value must be less than 0.3 so that a buy signal is confirmed.
- UseEquityStop = true – With this setting, the robot will put the account drawdown in monitor status to control the risk to the account.
- TotalEquityRisk = 1.0 – If the account drawdown reaches this threshold (1% of the account balance), all trades will be exited in loss so as to preserve the capital.
- Max_Trades = 10 – With this value, the robot is allowed to open up to 10 trades on the current symbol.
- FractalNum = 10 – This value prompts the expert advisor to display the last 10 up fractals and last 10 down fractals on the chart.
- USETRAILINGSTOP = true – This setting instructs the robot to trail the stop of winning trades when a certain threshold of gain is achieved.
- WHENTOTRAIL = 40 – The robot will trail the stop of winning trades when they gain at least 40 pips.
- PADAMOUNT = 10 – This parameter defines the buffer amount between the high or low of a pre-defined number of candles and the actual stop loss price. This value is in pips.
- USECANDELTRAIL = true – By this setting, stop trailing is done with the use of candlesticks.
- X = 3 – This setting means that the expert advisor will put the stop loss on the high or low of the previous 3 candles.
This trading system makes use of several technical tools in finding a trade entry, and these indicators are used on the current timeframe of the active chart. How the values of each indicator are interpreted to signify a trade signal is explained below:
- Fractals – The expert advisor records the values of the last 10 up and down fractals and displays them on the chart for the user to see. Not only is this record used for display, but it is also utilized for trade generation. While there are 10 values in each list, the index is numbered from 0 to 9. If index 2 is greater than index 3 and index 2 is greater than index 1, a bearish bias is developed. This means that the last three indexes in the array form a down fractal. On the other hand, if index 2 is lower than index 3 and index 2 is lower than index 1, a bullish bias is come by. This means that the last three indexes in the array form an up fractal.
- Moving averages (periods 85 and 6, linear weighted average, typical price) – These two linear weighted moving averages are applied on the current timeframe of the active symbol, and the values needed for computation are derived from the current open bar. If the 6-period LWMA is above the 85-period LWMA, the trend is bullish. If the 6-period LWMA is below the 85-period LWMA, the trend is bearish.
- Momentum (14 period, price close) – This indicator is applied on the current timeframe and symbol, and the data required for calculation are obtained from the previous three bars. If any of these data is smaller than 0.3, a buy or sell signal is validated.
- Trend lines – The expert advisor draws two trend lines on the main chart, one above price and another below price. These objects are then used to generate a trade signal. If the vertical distance between the two coordinates of the upper trend line is less than 20 pips and the lower trend line is pointing up, a bullish signal is generated. If the distance between the two points of the upper trend line is less than 20 pips and the lower trend line is pointing down, a bearish signal is generated.
When a trade opportunity arises, the robot will open a trade with a position size of 0.01. During entry, the stop loss and take profit are also established. While the stop loss appears to be 20 pips, the actual stop loss value is higher than this by the spread amount. Meanwhile, the actual take profit value is lower than 50 pips by the amount of spread. Since the algorithm runs by the tick, the robot will open 10 trades on the candle where the signal has been generated.
The Head and Shoulders Expert Advisor For MT4 – Exit Criteria
The Head and Shoulders Expert Advisor employs both passive and active methods in trade management. The passive method is through the use of stop loss and take profit, and the active method is through the implementation of trail stop and breakeven. In the last approach, a trade is brought to breakeven when it has gained 30 pips and then trailed when the total number of pips gained is at least 40 pips.
The Head and Shoulders Expert Advisor For MT4 – Room for Improvement
The Head and Shoulders Expert Advisor needs some improvement to become a profitable trading system. One suggestion for improvement is about the PadAmount used in setting the stop loss. As discussed beforehand, the PadAmount is the gap between the high or the low of a candle and the actual stop loss price. Setting an arbitrary value of 10 pips is not a good idea since it is too restrictive. The best strategy is to use the spread value at the time of entry.
Also, the vertical distance between the two points of the trend lines should be available in Inputs. In the code, this distance is hard-coded as 20 pips, which might not be best in all trade situations. The user should be given freedom to set this distance in consideration with the period and symbol chosen.
One obvious flaw in this trading system is the opening of 10 trades on one candle when a signal has been generated. This is definitely a bad idea. To address this issue, the user can set the maximum trades to one instead of 10 in Inputs. A better solution is to be done programmatically, that is, adding one trade in each subsequent candle if the entry rules are met and if price has moved at least a certain distance from the previous trade.