Simple 2MA 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 Simple 2MA Expert Advisor For MT4, as the name implies, uses two moving averages as the primary indicator for trend direction and thus trade bias. The moving averages utilized in this trading system are not simple moving averages, though, but linear weighted moving averages applied to typical price, which are not typical settings for this indicator. However, the moving averages are not depicted in the above image as they are applied on the next higher period.
Apart from the moving averages, the expert advisor creates chart objects to be used as filter for trade entry. As shown in the image above, down and up fractals are drawn on the chart, as well as two trend lines. While the fractals are for display purposes only, the trend lines are utilized for trade signal generation. How the signal is produced is covered in succeeding pages of this article. When a definite trade entry signal has been generated, the momentum indicator qualifies the signal for entry.
The Simple 2MA Expert Advisor For MT4 – Entry Criteria
The Simple 2MA Expert Advisor draws the two trend lines on the active chart in this manner. First, it draws the up and down fractals with the data obtained from the iFractals function. Once done, the robot stores the values of the last 10 up fractals and last 10 down fractals in arrays as well as the candle numbers. To draw the upper trend line, the values of the first and third indexes in the up-fractal array are obtained, matched with the corresponding candle numbers, and then a line is connected between the two points. The same process is used for printing the lower trend line.
The user is given freedom to control how the robot works. This way he can do trial and error tests to determine the best combination of settings that will produce results. The user can tweak the following parameters in the Inputs tab of the expert settings:
- Lots = 0.01 – Each trade initiated by this robot has a position size of 0.01.
- TrailingStop = 40 – A winning trade that has bagged 40 pips will be trailed until closed by the new stop loss or initial take profit target.
- Stop_Loss = 20 – Every trade initiated by the robot has an expressed 20-pip stop loss. The actual stop loss is higher by the amount of spread upon trade entry.
- MagicNumber = 1234 – Each trade executed by this robot has a magic number of 1234 unless changed by the user. This information is useful in trade management and performance monitoring by the robot or the user.
- Take_Profit = 50 – Every trade initiated by the robot has an expressed 50-pip take profit. The actual take profit is lower by the spread amount upon trade entry.
- FastMA = 6 – A fast-moving average is used in tandem with another moving average to define the trend and trade direction.
- SlowMA = 85 – A slow-moving average is used in parallel with a faster moving average to determine the trend and trade direction.
- Mom_Buy = 0.3 – Any buy entry signal derived from other technical tools will be validated as long as the momentum value is lower than 0.3.
- Mom_Sell = 0.3 – Any sell entry signal generated from other technical tools will be verified as long as the momentum value is lower than 0.3.
- UseEquityStop = true – Since this variable is set to true, the robot will check the real-time drawdown of the open trades on the trading account to protect the capital.
- TotalEquityRisk = 1.0 – In case the existing drawdown equals one percent of the capital, the robot will immediately close the open trades and accept the loss.
- Max_Trades = 10 – With this setting, the robot is allowed to open up to a maximum of 10 market orders on the account.
- FractalNum = 10 – This is the number of up fractals and down fractals shown on the chart. The fractals are not for display only. They are used by the algorithm to generate trade signals.
The expert advisor employs various tools in an attempt to find good entries. Apart from technical indicators such as moving average and momentum, the robot also uses objects on the chart to achieve this goal. These technical tools for entry are explained in more detail below:
- Moving averages (periods 6 and 85, linear weighted averaging, price typical) – A crossover of these two moving averages is the primary trigger for trade entry and defines the trade direction. The values needed for the computation are derived from the open bar on the next higher timeframe of the active symbol. If the two moving averages crossed and the 6 LWMA is on top of the 85 LWMA, a buy signal is generated. On the other hand, if a crossover occurs and the 6 LWMA is under the 85 LWMA, a sell signal is produced.
- Momentum (price close, period 14) – The momentum indicator qualifies the signal provided by the moving averages. If a trade signal has been indicated and the momentum value is less than 0.3, this signal is confirmed for entry. The values of the momentum indicator are computed from the three previous candles of the next lower timeframe of the active symbol.
- Trend lines – The expert advisor draws two trend lines on the chart one above price and another below price. The trend lines are created not only for display but also for generating trade signals. If the upper and lower trend lines are sloping upward, a buy signal is obtained. If the upper and lower trend lines are sloping downward, a sell signal is come by.
If a trade entry has been identified, the robot will enter a market order with a trade volume of 0.01. This trade comes with a 50-pip take profit and 20-pip stop loss. Since the spread at the time of entry is considered, the actual take profit is a spread lower than the nominal amount and the actual stop loss is a greater than the nominal value by the spread amount.
If a trade signal has been generated later or on subsequent candles, a trade can be added at the open of each candle until the maximum trade number on the active symbol is 10. All trades taken by the expert advisor have individual stop loss and take profit values whose amounts are equivalent to the values set in Inputs, minus or plus the spread.
The Simple 2MA Expert Advisor For MT4 – Exit Criteria
When one or more trades are open, the Simple 2MA Expert Advisor employs the breakeven and trail functions to manage the trades. However, trades are not managed as a basket, but as individual orders. If a trade gains at least 30 pips, its stop loss will be adjusted to the entry price. When the total number of pips gained has reached 40 pips, the trade will be trailed toward the take profit target. The same treatment is provided to other trades in a trade cycle. If a trade fails to reach the threshold for breakeven and instead turns to the wrong side of the market, it will be exited by the stop loss.
The Simple 2MA Expert Advisor For MT4 – Suggestion for Improvement
The performance of the Simple 2MA Expert Advisor in the strategy tester is not good enough to conclude that it can be used for live trading. The testing was too short in duration to make this conclusion. In this testing, the result was breakeven at best. It appears the trading system is suitable for trading trending markets.