Trend Line 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 Trend Line Expert Advisor For MT4 displays objects on the chart that indicate the formation of swing highs and swing lows as well as the current short-term trend. As shown in the image above, a trend line in white connects the two recent swing points, and this trend line is used by the expert advisor to initiate trades. In addition, the last ten up and down fractals are printed above and below price for information purposes only.
When tested over five months of historical data and using one symbol and period, the expert advisor opened trades too late into the test period. When it did open trades, the performance was so good at first that the equity curve climbed so high and fast. However, it started turning around in the middle of testing and ended a little below the initial trading balance. Therefore, the trading system is not currently profitable with the default settings. Opening trades late might be an issue only in the strategy tester and not in demo trading. Anyone interested to try out this trading system in demo account must apply it in various trading instruments and periods using different settings to find the best combinations that will yield results.
The Trend Line Expert Advisor For MT4 – Entry Criteria
The Trend Line Expert Advisor searches for trade entry once on every candle. If a new candle has developed on the active period, the robot will loop through the orders in the trade pool to count the number of trades and, if there are any, determine if the trades can be secured by breaking even or trailing the stop. If there are no open trades, the robot will look at the free margin to see if new trades can be opened. If that is the case, the expert advisor will engage in trade hunting.
There are some parameters in Inputs provided to the trader that he can play with to customize how the robot works and achieve his desired results. The most important parameters and their default values are listed and explained below:
- Lots = 0.01 – This value is the lot size of all trades, which is the minimum lot size in most trading accounts.
- TrailingStop = 40 – The expert advisor will trail the stop loss of open trades when price moves in the profitable direction. Stop trailing begins when a trade has gained 40 pips.
- Stop_Loss = 20 – The nominal stop loss of each trade is 20 pips.
- MagicNumber = 1234 – The expert advisor identifies its own trades by this number, allowing for easy trade management.
- Take_Profit = 50 – The nominal take profit of each trade is 50 pips.
- FastMA = 6 – The trading system makes use of a fast-moving average with a period of six.
- SlowMA = 85 – The trading system makes use of a slow-moving average with a period of 85.
- Mom_Sell = 0.3 – A signal for sell entry will be validated if the momentum value is less than 0.3.
- Mom_Buy = 0.3 – A signal for buy entry will be confirmed if the momentum value is less than 0.3.
- UseEquityStop = true – This parameter instructs the expert advisor to monitor the current drawdown and to take action if needed to protect the trading account.
- TotalEquityRisk = 1.0 – If the current drawdown is equivalent to one percent of the account balance, the expert advisor will close all open trades to preserve the capital.
- Max_Trades = 10 – With this value, the expert advisor can open as many as 10 trades on the active pair.
- FractalNum = 10 – This setting instructs the program to display 10 up and down fractal arrows.
The expert advisor uses a few technical tools in generating a signal for entry. One indicator is applied to the next lower timeframe, and another indicator is applied to the next higher timeframe. The other technical tool is implemented on the current timeframe. These technical tools are discussed in more detail below:
- Linear weighted moving averages (period 85 and 6, typical price) – The moving averages provide the main trigger for entry. The values needed for signal generation are drawn from the current bar of the next higher period of the active symbol. A bullish signal is generated if the 85 LWMA is below the 6 LWMA, and a bearish signal is obtained if the 85 LWMA is above the 6 LWMA.
- Momentum (price close, period 14) – The momentum indicator is used to confirm a signal for trade entry. The values required for confirmation are generated from the previous three bars of the next lower period on the active symbol. At least one of these values should be less than 0.3 to have a trade signal validated.
- Trend line – A trend line is being drawn by the expert advisor in the current timeframe. The signal provided by the trend line must be in agreement with that of the moving averages so that a trade can be taken. For a buy trade, the trend line must be pointing upward, and for a sell trade, the trend line must be pointing downward.
Once a trade signal has been defined and verified, a trade will be executed on the active symbol with a lot size of 0.01 as declared in Inputs. The user may use a bigger value, but this is not a good idea since the robot can open multiple trades in a trade cycle. During trade request, the specification for stop loss and take profit is sent to the trade server. While it appears that the stop loss is 20 pips in Inputs, the actual stop loss value is higher than this by the spread amount. On the other hand, the take profit amount of 50 pips is reduced by the spread value during trade entry.
As defined in Inputs, the robot may execute several trades when opportunities exist. The maximum number of open trades is 10. If the user thinks that this is too many, he can set a lower value for this variable. This can be a good decision if supported by testing. The multiple trades open on the current symbol can be a combination of buy and sell trades, and each one has its own stop loss and take profit values.
The Trend Line Expert Advisor For MT4 – Exit Criteria
The Trend Line Expert Advisor manages open trades in two ways. The first method is a passive approach. It involves the use of take profit and stop loss for trade exit. The second method is an active approach. It entails the use of functions that modify the stop loss first by breaking even and second by trailing the stop. While these functions facilitate the protection of winning trades, this action has the side effect of disturbing the favorable balance between reward and risk.
The Trend Line Expert Advisor For MT4 – Room for Improvement
As determined in testing, the Trend Line Expert Advisor is not yet fit for live trading. Further testing in the strategy tester is absolutely necessary. Then the user can embark on forward testing using a demo account. This journey might take long, but it is a must before one considers using this trading system in real trading.
There is one area that might need an improvement. It is about the distance between trade entries. As observed in testing, trades were dispersed all over the place, which is chaotic for monitoring. If possible, trades should be spread out regularly so that drawdown is reduced. This change would need an adjustment of the program code, however.