Skip to content
All library documents

Building an MQL5 Expert Advisor for Consolidation Breakouts

Article MQL5 articles

Summary

This article outlines an Expert Advisor for trading breakouts from a recent consolidation range in MetaTrader 5. The range is defined by the highest and lowest prices over a chosen number of bars, optionally subject to criteria such as a minimum bar count and a maximum price width. A breakout is triggered when price closes beyond either boundary; the EA then enters in the breakout direction. The author distinguishes this close-based rule from entering as soon as price crosses a boundary and says the example does not wait for a retest.

The implementation discussion covers scanning price history, drawing the range, monitoring incoming prices, and placing trades with stop-loss and take-profit settings. The article also describes creating an EA project in MetaEditor and using MQL5 trading objects. It says the strategy was run in the tester, but the supplied text includes no readable performance figures or detailed test settings, so its effectiveness cannot be assessed from the evidence shown. Range parameters, timeframe, breakout confirmation, and risk controls remain design choices requiring testing; a breakout rule alone does not establish an edge.

Key ideas

  • The range boundaries come from the highest high and lowest low over a selected window of bars.
  • The example enters when a bar closes beyond the range and does not wait for a retest.
  • The range can be constrained by bar-count and price-width criteria.
  • The EA is described as drawing the range, monitoring prices, and placing directional orders with risk controls.
  • The text mentions tester results but supplies no readable performance statistics or full test methodology.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.