Skip to content

MetaTrader 5

MAE and MFE in Trading: Formulas, Examples and Analysis

MAE and MFE in trading measure how far a trade moved against and in favour of its entry while it was open. Maximum adverse excursion (MAE) is its largest unrealised loss; maximum favourable excursion (MFE) is its largest unrealised gain. Neither is the final result. Measure excursions in price units, account currency or initial risk units, and state the price feed, holding interval and cost convention.

Illustrative cover for MAE and MFE showing a trade path with adverse and favourable extremes around an entry line, with the official PineConnector logo.
The largest adverse move, largest favourable move and final exit are three different observations.

These path measures complement the averages in the trading metrics library. Two trades can close with the same result after very different adverse moves. Conversely, the same MAE and MFE can conceal a different order of price movements.

MAE and MFE at a glance

Scroll horizontally to read every column.

Measure What it records What it does not establish
Maximum adverse excursion Largest unrealised loss relative to entry The final loss or an appropriate stop distance
Maximum favourable excursion Largest unrealised gain relative to entry A gain that could necessarily have been captured
Realised result Result at the actual exit, under the chosen cost convention The extremes reached earlier
Excursion in R Excursion in currency divided by initial risk An account-level drawdown percentage

TradingView defines the corresponding trade-list fields as maximum unrealised profit and loss.[1] This article writes both excursion magnitudes as non-negative amounts. A report may plot adverse movement below zero instead; check the axis before comparing values.

What are the MAE and MFE formulas?

For a single entry with fixed size, let E be the entry fill, H the highest relevant price and L the lowest relevant price during the trade. Include only observations between entry and exit. The following formulas measure price movement before costs.

Long: MAE = max(0, E − L); MFE = max(0, H − E)

Short: MAE = max(0, H − E); MFE = max(0, E − L)

The zero floor prevents a favourable-only path from producing negative MAE. For a linear instrument with a fixed conversion rate, multiply the price distance by units held and the account-currency value of one price unit. Contracts, currency conversion and changing position sizes require their own valuation.

Excursion in R = excursion in account currency ÷ initial R

Initial R is the currency risk between the entry and the initial stop. Keep that denominator after the stop moves, as explained in R-multiple trading. If there was no defined initial risk, an excursion in currency is still measurable, but an R value needs an explicitly documented denominator.

For variable size, reconstruct the marked trade value through time instead of multiplying every extreme by the final volume. Record partial realised results and remaining exposure consistently. A price reached after half the position closed did not apply to the original full size.

Worked example: adverse movement, favourable movement and exit

Illustrative numbers, not a recommendation or strategy results. A hypothetical linear instrument is valued in USD. A long enters at 100 with 10 units, each worth 1 USD per price point. The initial stop is 95. Spread, commission, slippage and financing are omitted.

The price path while the trade is open is 100 → 97 → 108 → 104. The last value is the exit.

  • Initial R: (100 − 95) × 10 = 50 USD.
  • MAE: (100 − 97) × 10 = 30 USD, or 30 ÷ 50 = 0.6R.
  • MFE: (108 − 100) × 10 = 80 USD, or 80 ÷ 50 = 1.6R.
  • Realised result: (104 − 100) × 10 = +40 USD, or +0.8R.

The 40 USD difference between MFE and the final result is a description of this path. It is not evidence that another exit could reliably have captured the peak. An exit rule has to identify its action using information available at that time.

A short reverses the directions. With entry 100, high 103, low 92 and exit 96, the same 10 units give MAE of 30 USD, MFE of 80 USD and a realised gain of 40 USD.

How do you read an MAE/MFE scatter plot?

Read the axes before the dots. A chart might put MAE on one axis and final profit on the other. Another might compare MFE with final profit. MetaTrader 5's tester documentation includes profit-versus-excursion plots.[2] Those are different from an MAE-versus-MFE chart.

The original diagram below uses MAE in R horizontally and MFE in R vertically. Each dot represents one hypothetical trade; its label also records the final result. The example trade is A at (0.6R, 1.6R), with a final result of +0.8R.

Illustrative MAE versus MFE scatter with four hypothetical trades measured in initial R. Trade A has 0.6R adverse excursion, 1.6R favourable excursion and a final result of plus 0.8R.
Illustrative coordinates, not strategy results. MAE is a positive magnitude on the horizontal axis; MFE is on the vertical axis. Final results are listed separately because excursions do not determine the exit.
  • Further right: a larger adverse move occurred, regardless of the final result.
  • Higher up: a larger favourable move occurred, regardless of whether the trade closed with a gain.
  • A losing trade high on the chart: a favourable excursion preceded the eventual loss, but the chart does not supply a usable exit rule.
  • A winner far to the right: the trade recovered from a large adverse move. A tighter stop might have removed that winner.

Keep units consistent. Larger positions naturally produce larger cash excursions for the same price path. R-normalisation addresses initial size and stop distance together, but does not remove differences in holding time, instrument or rule version.

What data do you need to calculate excursions?

An entry and an exit alone do not reveal either extreme. A usable record needs:

  • Identity and timing: the trade, direction, entry and exit timestamps, timezone, and any partial entries or exits.
  • Valuation: fill prices, quantity, contract multiplier, account currency and conversion method.
  • The path: intrabar highs and lows, or finer observations, restricted to the period the position was open.
  • The quote: bid, ask, last or another named series, from the relevant provider.
  • The convention: costs included, initial stop and R, plus how scale-ins and partial closes are grouped.

Whole-bar extremes can include prices before entry or after exit. Daily highs and lows cannot establish the exact excursion of a trade open for only part of that day. Even intrabar high and low values omit their order unless finer observations supply it.

MetaTrader 5's help states that a security is generally bought at the Ask and sold at the Bid, so a long normally closes at the bid and a short at the ask.[3] An executable-price reconstruction uses the relevant exit quote against the actual entry fill. A mid-price path can miss the spread component. See bid-ask spread explained.

Where are MAE and MFE in TradingView and MT5?

As of 25 September 2026, TradingView's documented trade-list labels are “Favorable excursion” and “Adverse excursion”. Open the strategy report's Trades tab and select columns using Column setup. The Download icon exports every available column to CSV.[1]

Both fields are shown in currency and as a percentage of trade size. That percentage is not a percentage of initial R. The separate report plots for run-ups and drawdowns concern the strategy's equity. Use the TradingView report guide to distinguish trade-level and account-level measures.

Under the default testing range, TradingView retains individual data for the latest 9000 trades. An excursion analysis based on that CSV can therefore cover a shorter period than the aggregate Metrics tab.[1]

TradingView's broker emulator infers a historical intrabar path from chart OHLC by default. Its high historical bar-detail setting uses lower-timeframe OHLC where available.[1] More detail changes the simulation's evidence; it does not turn simulated extrema into broker executions.

In MT5, the Strategy Tester report includes MFE-Profits and MAE-Profits distribution graphs, with both axes in the deposit currency and each position's profit including swaps.[2] These describe tested positions, not the account's actual trading history; the MT5 report guide covers the rest of the report. A report from one data source cannot establish the intratrade quotes on another account.

Can MAE/MFE analysis determine a stop or target?

MAE and MFE can describe what an existing rule allowed trades to experience. They cannot select a stop or target without retesting the resulting rule. In particular, the extrema omit sequence:

Illustrative original path Original excursions With a hypothetical stop at 98 and target at 106
100 → 97 → 108 → 104 MAE 3 points; MFE 8 points Stop is crossed first
100 → 108 → 97 → 104 MAE 3 points; MFE 8 points Target is crossed first

Both original trades finish at +4 points. The table assumes continuous movement between listed prices and immediate fills at the new levels, solely to illustrate sequence. The proposed levels are not recommended settings.

A wider stop creates another problem: a trade that previously stopped out has no later observations within its original holding interval. The old MFE cannot establish what would have happened after that exit. A full replay under the altered rule is required.

To investigate a rule change, define the candidate on a research sample, preserve the chronology and cost model, and evaluate the frozen version on separate data. TradingView's strategy documentation describes out-of-sample testing without additional tuning.[1] Repeatedly changing levels after inspecting that second sample turns it into more development data.

Include losing trades as well as winners. Studying only the MAE of eventual winners conditions the analysis on an outcome unavailable at entry. The stop placement guide covers how a price rule becomes an execution instruction.

How does PineConnector affect the comparison?

A measurable TradingView rule may produce an alert, then a webhook, PineConnector processing and an EA order request. Broker acceptance, a deal and a resulting position are separate events. PineConnector's setup test checks the processing record and broker trade separately.[4]

Calculate the broker trade's excursions from its own fills, holding interval and quotes. A simulated TradingView exit does not establish when the MT5 position closed or whether a broker-side stop existed. Match those records before attributing a difference to the trading rule.

PineConnector's Analytics guide lists performance metrics but does not document MAE/MFE reconstruction or an intratrade quote export.[5] Those capabilities are not documented; test on demo. The documented averages do not supply a missing price path.

Frequently asked questions

What is maximum adverse excursion in trading?

Maximum adverse excursion, or MAE, is the largest unrealised loss a trade experiences relative to entry while it remains open. A long entering at 100 and reaching a low of 97 has a price MAE of 3 points before costs. MAE is separate from the final result and from the account's peak-to-trough drawdown.

What is maximum favorable excursion?

Maximum favourable excursion, or MFE, is the largest unrealised gain a trade reaches while open. A long entering at 100 and reaching 108 has an MFE of 8 price points before costs. The trade may close below that peak or finish with a loss. MFE does not prove that a rule could capture the maximum.

How do you use MAE and MFE analysis?

MAE and MFE analysis compares adverse and favourable movement with final trade results under a consistent valuation method. A scatter plot can reveal trades that recovered from adverse movement or surrendered earlier gains. Any proposed stop or target change still needs a chronological replay and separate evaluation data, because excursions alone do not reveal which level was reached first.

Does TradingView show MAE and MFE?

As of 25 September 2026, TradingView documents “Adverse excursion” and “Favorable excursion” columns in its strategy report's Trades tab. Each shows a currency amount and a percentage of trade size. Column setup controls their visibility, and the CSV download includes every available column. These are simulated trade measures, not confirmed excursions from a connected broker account.

Reviewed 25 September 2026. Facts were checked against the linked sources on that date. Nothing in this article was tested on a trading account.

Related reading

Sources

  1. TradingView – Pine Script v6 User Manual: Strategies, accessed 25 September 2026.
  2. MetaQuotes – MetaTrader 5 Help: Testing Report, accessed 25 September 2026.
  3. MetaQuotes – MetaTrader 5 Help: Basic Principles, accessed 25 September 2026.
  4. PineConnector – Test your setup, accessed 25 September 2026.
  5. PineConnector – Trading analytics, accessed 25 September 2026.

PineConnector executes the instructions you send it. It does not select trades, manage money, or hold funds. Trading carries risk, and past performance of any strategy does not indicate future results.


Leave a comment

Back To PiCo Blog

Ready when your strategy is

You bring the strategy.We bring the infrastructure.

Connect TradingView to MetaTrader, choose where MT5 runs and put the full PineConnector workflow through its paces from your first month.

Strategy and trading decisions remain yours. The MT5 environment can be ours.

PineConnector Edge

Run the full PineConnector workflow.

$59/mo at launch

Core plan · 1 connection · 1 hosted MT5 environment

Try Core for $7

7 days of Core for $7, then $59/month at the launch price unless you cancel.