Consolidation Breakout 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:
- Consolidation Breakout Expert Advisor For MT4
- The Consolidation Breakout Expert Advisor for MT4 – Parameters
- The Consolidation Breakout Expert Advisor for MT4 – Entry Criteria
- The Consolidation Breakout Expert Advisor for MT4 – Exit Criteria
- The Consolidation Breakout Expert Advisor for MT4 – Room for Improvement
As the name implies, the Consolidation Breakout Expert Advisor For MT4 attempts to trade a specific market condition known as breakout. To define a market breakout, the robot uses moving averages and creates trend line objects on the chart. A breakout occurs if the moving averages have crossed in one direction and if price has broken one trend line while the other two trend lines point in the breakout direction. A third technical tool is used to confirm the strength of the breakout.
The trading system was run in the strategy tester using 10 months of historical data to determine its effectiveness. As observed, the program worked best when the market breaks out and the breakout is strong. When the market makes a reversal or pullback or moves in a trading range, the performance turned bad. One test run showed a negative result for the trading system.
The Consolidation Breakout Expert Advisor for MT4 – Parameters
The Consolidation Breakout Expert Advisor hunts for trades at the start of a newly formed candle and takes multiple trades in a trade cycle as the situation permits. Prior to opening trades, the robot performs a series of routine inspection. This includes assessing the account drawdown if trades are open, trailing the stop loss if applicable, counting the number of bars on the active chart, checking the take profit value, examining the free margin, and counting the open trades. Once the checks are successful, the robot proceeds to the trade search.
The following list contains the external variables presented to the user when the expert advisor is launched on the current symbol. It will give the user an overview of the inner workings of the trading system and the ability to influence the outcome of the trade operation.
- Lots = 0.01 – This is the lot size of trades taken by this robot.
- TrailingStop = 30 – Trailing stop comes into play when a trade has gained at least 30 pips.
- Stop_Loss = 20 – The robot sets an initial stop loss of 20 pips to each trade.
- MagicNumber = 1234 – This number identifies the trades taken by the expert advisor.
- Take_Profit = 70 – The expert advisor sets the take profit to 70 pips upon trade execution.
- FastMA = 10 – A moving average with a period of 10 is used in this trading system.
- SlowMA = 65 – A moving average with a period of 65 is used in this trading system.
- Mom_Sell = 0.3 – A sell signal will be executed for entry when the momentum is 0.3 or below.
- Mom_Buy = 0.3 – A buy signal will be executed for entry when the momentum is 0.3 or below.
- UseEquityStop = true – With this setting, the robot monitors the account drawdown in real time to take action once it reaches a specific level.
- TotalEquityRisk = 1.0 – When equity stop is true, the robot will liquidate all open positions the moment the drawdown reaches one percent of the account balance.
- Max_Trades = 10 – The expert advisor can have up to 10 trades open in a trading cycle.
- FractalNum = 10 – The expert advisor draws the last 10 up and down fractals on the chart.
The Consolidation Breakout Expert Advisor for MT4 – Entry Criteria
The trading system utilizes moving averages and trend lines to determine the trend direction and the momentum indicator to measure the strength of the trend. Exactly how these tools are used in the algorithm is explained in the following bullet points:
- Moving averages (periods 10 and 65, linear weighted, typical price) – The robot obtains the values of moving averages for the current candle on the active chart. A bullish signal will be generated if the 10 LWMA is greater than the 65 LWMA, while a bearish signal will be provided if the 10 LWMA is less than the 65 LWMA.
- Momentum (14 period, close price) – The robot derives values of the momentum indicator for the three previously closed candles. If any of these momentum values is less than 0.3, a buy or sell signal previously generated will be confirmed for entry.
- Trend lines (middle, upper, and lower) – The expert advisor draws three trend lines on the chart and uses the objects created for trade confirmation. If the upper trend line is pointing down, lower trend line is pointing up, and the middle trend line is pointing up, a buy signal will be generated. If the upper trend line is pointing down, lower trend line is pointing up, and middle trend line is pointing down, a sell signal will be provided. See above code snapshot.
When the technical studies provide and confirm a trade signal, the expert advisor sends a trade request with a lot size of 0.01, stop loss of 20 pips plus the spread, and take profit of 70 pips less the spread. The trade execution is carried out on the same tick that the signal is generated, that is, at the formation of a new candle. If signals occur in subsequent candles, trades may be added by the robot as long as the current open trades are less than 10.
The Consolidation Breakout Expert Advisor for MT4 – Exit Criteria
The Consolidation Breakout Expert Advisor employs the trailing function to adjust the stop loss of winning positions. The take profit set during entry is not modified. When a trade gains at least 30 pips, its stop loss will be moved beyond the entry price at a distance of 30 pips from the market price (i.e., bid price for a buy trade or ask price for a sell trade). It is likely that the stop loss is not equal to the open price when trailing stop is activated, especially if the market volatility is high. Trailing stop goes on until price touches the take profit or the recent stop loss.
The Consolidation Breakout Expert Advisor for MT4 – Room for Improvement
There are some aspects in the Consolidation Breakout Expert Advisor that need improvement. First, the default number of 10 maximum trades might not be good for the trading performance to begin with. This might have contributed to the poor performance in testing. Therefore, the user must explore the optimal number of open trades that will lead to good results. If possible, the source code must be reviewed to space out the multiple trades taken by the robot. Obviously, opening multiple trades in a small price range is not good as it increases the chance for the drawdown to grow quickly.
Another possible improvement is to remove the block of code and the condition to run the expert advisor in testing with different entry rules. As defined in the code, running the expert advisor in the strategy tester would involve fewer filters such as removal of the trend lines as confirmation tool. Therefore, the testing result would be rendered useless and cannot be used to opine on the potential of the trading program to generate profits. Removing the statement is easy to do, would not adversely affect the trading operation in testing, and would have results that will be useful in comparing the results of demo trading. See the code snippet above.
In testing, the trading performance was poor. The win percent was only 32 percent, maximal drawdown was high (at 13 percent), and a significant portion of the account balance was lost. This was the result of back testing with the default settings. To see better results, the changes suggested should be considered, and the user must do lengthy testing using various combinations of settings, possibly with optimization turned on. In addition, the user should apply the robot in symbols that tend to trend than to range. At present, these symbols include NZDUSD, EURCAD, EURUSD, and all yen pairs.