Fibonacci Lines 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:
- Fibonacci Lines Expert Advisor For MT4
- The Fibonacci Lines Expert Advisor – Parameters
- The Fibonacci Lines Expert Advisor – Entry Criteria
- The Fibonacci Lines Expert Advisor – Exit Criteria
- The Fibonacci Lines Expert Advisor – Room for Improvement
The Fibonacci Lines Expert Advisor For MT4 utilizes the Fibonacci retracement tool, along with moving average and momentum indicators, to define and confirm a trade entry. While the values of moving average and momentum are computed straightaway without attaching them to the chart, the Fibonacci object is first created on the chart, and its value is obtained later by the robot to be used for trade confirmation.
The Fibonacci Lines Expert Advisor – Parameters
The Fibonacci Lines Expert Advisor offers two sets of parameters in inputs. The first set of parameters is considered initial settings, and the second set of parameters is used to override the initial values. The second set takes effect at the time of stop loss and take profit adjustment. See the parameters below:
- tick = false – With this setting, the robot will look for trade entries on every new candle. If value is true, the robot will conduct a trade search on every tick.
- Lots = 0.01 – Each trade is taken with a lot size of 0.01.
- TrailingStop = 40 – The moment a trade turns positive and gains 40 pips, trailing stop comes in.
- Stop_Loss = 20 – Each trade taken by this robot comes with a stop loss of 20 pips.
- MagicNumber = 1234 – Each trade opened by this robot is assigned this unique identifier.
- Take_Profit = 50 – Every trade taken by this robot comes with a take profit of 50 pips.
- FastMA = 20 – A moving average with a period of 20 is used in the program.
- SlowMA = 100 – A moving average with a period of 100 is used in the system.
- Mom_Sell = 0.3 – A sell signal is only considered for entry if the momentum value is less than 0.3.
- Mom_Buy = 0.3 – A buy signal is only considered for entry if the momentum value is less than 0.3.
- UseEquityStop = true – With this setting, open trades will be liquidated when drawdown reaches a certain percentage of the account balance.
- TotalEquityRisk = 1.0 – When account drawdown reaches one percent of the account balance, all open trades will be closed immediately for a loss.
- USECANDELTRAIL = true – This setting toggles the candle trail function on and off.
- X = 3 – When candle trail is on, the robot will probe the last 3 candles counting from the current open candle to determine the candle number with the lowest low or highest high.
- PADAMOUNT = 3 – When candle trail is on, the stop loss will be placed on the lowest low or highest high of the last 3 candles plus a pad amount of 3 pips.
- TRAILAMOUNT = 40 – Every time the stop loss is adjusted through candle trail, the take profit is adjusted correspondingly by adding or subtracting 40 pips to the previous take profit price.
The Fibonacci Lines Expert Advisor – Entry Criteria
The expert advisor uses two built-in MT4 indicators to define and validate the trend. These indicators are the moving average and the momentum, and they are used in the manner explained below. Additionally, the robot draws the Fibonacci tool on the chart to be used as trade filter. On every tick, the program determines if a new candle has formed. If so, it creates the Fibonacci object through two points. The first point is defined by the highest price on the last 20 candles and the equivalent open time of the candle on the next higher timeframe. The second point is defined by the lowest price on the last 20 candles and the equivalent open time on the next higher timeframe.
- Moving averages (periods 20 and 100, linear weighted, typical price) – The expert advisor obtains the moving average values corresponding to the current candle on the lower timeframe of the current chart symbol. If the 20 MA is greater than the 100 MA, the trend is up, and the signal is long. If the 20 LWMA is less than the 100 LWMA, the trend is down, and the signal is short.
- Momentum (period 14, close price) – The robot computes the values of the momentum indicator equivalent to the last three closed candles on the higher timeframe of the active symbol. If any of these values is less than 0.3, the current momentum is considered valid, and a trade signal will be executed.
- Fibonacci retracement – If the Fibonacci object has been found on the active chart, its values as it passes through candles 1 and 2 (i.e., Fibo1 and Fibo2) are obtained. This is done using the ObjectGetValueByShift function. If the open price of candle 2 is greater than Fibo2 and the close of candle 2 is less than Fibo1 or the close of candle 1 is less than or equal to Fibo1, a buy signal is generated. Meanwhile, if the open of candle 2 is less than Fibo2 and the close of candle 2 is greater than Fibo1 or the close of candle 1 is greater than or equal to Fibo1, a sell signal is indicated.
When a trade signal has been defined and confirmed, the expert advisor opens a trade with a lot size of 0.01, initial stop loss of 20 pips plus the spread, and initial take profit of 50 pips less the spread. After the trade has been executed, the robot puts on alert, prints a note on the terminal, sends a mobile notification, and sends an email to the trader.
On every new candle, the robot evaluates if it is possible to adjust the stop loss and take profit. If the market moves in favor of the trade, the stop loss and take profit are adjusted accordingly. For a long trade, the robot adds 40 pips to the previous take profit price to get the new take profit value. For a short trade, the robot subtracts 40 pips from the previous take profit price. The result is a continuously updated take profit price with little to no chance of being realized. While the stop loss adjustment makes sense, the take profit modification is unnecessary. Refer to the code snapshot above.
The Fibonacci Lines Expert Advisor – Exit Criteria
The Fibonacci Lines Expert Advisor uses a unique method of trailing the stop loss. While most systems employ an arbitrary number to start the stop trailing process, this trading program adjusts the stop loss through price action. For a long trade, its stop loss will be shifted to the low of the candle with the lowest low among three candles counted from the current open candle plus a pad amount of 3 pips. For a short trade, the stop loss will be moved to the high of the candle with the highest high among three candles plus 3 pips.
While this trade management strategy sounds great as stop trailing is dynamic, the trade result is not always good. Normally, when the trailing function is activated, the purpose is to secure the trade or lock in profits. In this case, even if trailing stop is triggered, it is still possible for a trade to end in loss, and this happens very frequently as observed in testing. With the default settings, the trading system failed to make money in the strategy tester.
The Fibonacci Lines Expert Advisor – Room for Improvement
The Fibonacci Lines Expert Advisor needs improvement to become profitable. Considering the parameters in inputs, the user would assume that the robot opens a trade only at the open of a new candle because the tick variable is set to false. However, the actual scenario is different because the code digresses. By inspection, a trade can be opened in real time whenever a signal occurs as a new tick comes in. See above code snapshot. This is only one aspect that should be considered for review. There might be other areas to improve.