Skip to content
All library documents

Building a Procedural Price Action EA with an EMA Filter

Article MQL5 articles

Summary

The article introduces procedural and functional programming concepts through a MetaTrader 5 expert advisor. Its example buys when the latest closed candle is bullish and entirely above an exponential moving average, and sells when a bearish candle is entirely below it. Exits can use account-level percentage profit or loss thresholds, stop loss, or take profit. The code is organized into functions and shared global variables, with inputs for the timeframe, EMA, position limits, and trade settings.

The article describes implementation and reports that a one-year strategy-tester run from November 2022 to November 2023 was profitable with low drawdown. It provides no detailed performance figures or testing methodology beyond that period, so the result is not enough to establish robustness or expected live performance. The author presents procedural organization as approachable for simpler projects, while noting that code can grow unwieldy as an EA becomes more complex and suggesting object-oriented design for larger systems.

Key ideas

  • Procedural programming breaks a task into smaller steps and functions.
  • The example buys bullish candles above the EMA and sells bearish candles below it.
  • The EA offers account percentage thresholds and conventional stop loss or take profit exits.
  • The reported tester outcome lacks detailed metrics and evidence of out-of-sample robustness.
  • Procedural design can become difficult to manage as a project grows.

Tags

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