Skip to content
All library documents

Flat Market Breakout EA Using Smoothed Standard Deviation

Article MQL5 code base

Summary

This MetaTrader expert advisor identifies a flat range and uses its boundary lines to place pending orders. It also evaluates a smoothed Standard Deviation across the current and four preceding bars: a strictly rising sequence is treated as evidence that a trend exists. The EA refrains from placing pending orders when no flat zone is detected and removes the associated chart lines. When an order triggers, it cancels the remaining pending orders and manages the open position with a trailing stop.

Stop loss and take profit may be fixed or dynamic, and position size may be constant or depend on the number of trades closed by stop loss or take profit. The document gives a conceptual description and specifies EURUSD on a 30-minute chart, but provides no performance results, parameter values for the range logic, or backtest details. It therefore explains the EA's operating rules without establishing whether they are profitable or how robust they are across markets.

Key ideas

  • A strictly rising sequence of smoothed Standard Deviation values across five bars is used as a trend condition.
  • Pending orders are placed only when the EA detects a flat zone bounded by two lines.
  • After one pending order triggers, the EA deletes the others and applies a trailing stop to the resulting position.
  • Stop loss, take profit, and position size can use fixed or dynamic settings.

Tags

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