Skip to content
All library documents

Using MAE and MFE Distributions to Set Stops and Targets

Article MQL5 articles

Summary

The article describes an MQL5 analyzer that reconstructs closed round trips from deal history and measures each trade’s maximum adverse excursion (MAE), maximum favorable excursion (MFE), and exit efficiency. It groups deals by position identifier, reads M1 highs and lows between entry and exit, and separates excursion samples for winning and losing trades. Suggested stop distance comes from a chosen percentile of winners’ MAE; a target reference comes from winners’ median MFE. Efficiency compares the favorable move captured at exit with the maximum available excursion.

The approach replaces arbitrary fixed risk-reward assumptions with measurements from a particular strategy, symbol, and historical window. The article gives an illustrative price example and explains how to interpret overlap between winners’ and losers’ excursions. It also describes a chart report and per-trade CSV. The output is diagnostic, not predictive: M1 candles approximate tick extremes, consolidated trades can hide individual scale-ins or exits, historical regimes may change, and stable percentiles require a substantial sample. Suggested levels should be treated as hypotheses and evaluated on subsequent trades.

Key ideas

  • MAE measures the greatest move against an entry, while MFE measures the greatest move in its favor.
  • Closed trades are reconstructed from grouped deal records and the M1 candles spanning each trade.
  • A selected percentile of winners’ MAE can inform stop distance, while median winners’ MFE can inform targets.
  • Exit efficiency and loser excursions help distinguish possible exit issues from entry or stop issues.
  • The measurements are historical diagnostics with M1 resolution and sample-size limitations.

Tags

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