Skip to content
All library documents

Trading Trend-Line Breakouts and Reversals with an MQL5 EA

Article MQL5 articles

Summary

The article describes an MQL5 Expert Advisor that acts on two trend lines a trader draws and names on a chart. The user selects a timeframe, position size, and trading mode. The EA extends the lines to the right, compares recent closed-candle prices with the lines, and looks for reversals or breakout-and-retest setups. Its modes allow reversal entries, breakout-and-retest entries, or both.

Trade management uses the most recently closed candle to place a stop loss and targets a reward-to-risk ratio of 4:1. The article walks through the EA’s object identification and candle-data logic, then describes checks intended to validate retests and avoid duplicate entries. It is an implementation tutorial rather than a performance study: it provides no backtest results establishing that the setups are profitable. Signals also depend on correctly named, manually drawn lines and recent candle behavior, so results may vary with chart configuration, market, and execution conditions.

Key ideas

  • The EA identifies the intended uptrend and downtrend lines by the object names supplied in its inputs.
  • It compares recent closed-candle prices with the corresponding trend-line values to detect touches and breaks.
  • Trading modes support reversals, breakout-and-retest entries, or a combination of both.
  • Stop losses use the latest closed candle’s high or low, while take profit is set at four times the entry-to-stop distance.
  • The article explains implementation mechanics but does not present evidence that the strategy is profitable.

Tags

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