MAE and MFE: Boost your trading system

Have you already developed a winning trading system that is profitable over time? Are you taking advantage of the full potential of your system? If you have some doubts to answer these questions, it is probably because you are not squeezing all the juice out of your strategy.

In this post I am going to teach you how to get the most out of your trading system so that you can get the most benefit possible. To do this, we will analyze the results of our trading strategy using two metrics: The MAE and the MFE. Let’s see what each of these metrics developed by John Sweeney is about.

1. What is the MAE?

MAE is the acronym in English for “Maximum Adverse Excursion” which translated into Spanish means “Maximum Adverse Excursion”. To the point and in summary: it measures the partial maximum losses that an operation had while it was open.

Example (which is how it is well understood): if you carry out a purchase operation, the MAE is the difference between the entry price and the lowest price that the financial asset had from the opening until the operation was closed. In the case of opening a short operation, the MAE is the difference between the entry price and the highest price that the asset had from the opening to the closing of the operation.

The MAE is an extremely useful metric to quantitatively define where to place the optimal levels of losses (stop loss).

2. What is the MFE?

MFE is the acronym in English for “Maximum Favorable Excursion” which translated into Spanish means “Maximum Favorable Excursion”. This metric measures the maximum partial profits of the trade while it was open.

Let’s take the example: if you open a purchase operation, the MFE is the difference between the entry price and the highest price that the financial asset had from the opening until the operation was closed. In the case of opening a short operation, the MFE is the difference between the entry price and the lowest price that the asset had from the opening to the closing of the operation.

The MFE allows us to quantitatively define where to place the optimal profit levels (take profit).

3. Initial considerations to use the MAE and MFE correctly.

Although these metrics are very useful for optimizing our trading systems, we must understand their limitations.

The size of the sample or results to be evaluated from our system should not be less than 50 operations. A minimum number of operations close to 100 would be ideal.

There are several ways to measure the MAE and MFE. You can measure it in pips in the case of Forex, dollars or euros per share in the case of the stock market, the total dollars or euros per operation (base currency of our account), percentage of the initial price, multiples of R…

If you develop a trading strategy that will operate in a single market, you will not have major problems interpreting the results and you can calculate them in pips or monetary units (euros or dollars) per share.

When your system trades in different currency pairs you must be careful when measuring these metrics because you must take into account the volatility of each currency pair where you want your trading system to operate. For example, you cannot compare 15 pips on the NZDUSD pair with 15 pips on the GBPJPY pair where the volatility is much higher.

To obtain more accurate and objective results, we measure the MAE and MFE as a percentage (%) of the entry price.

4. How to calculate the MAE and the MFE.

When we open a buy or sell trade, the price is constantly fluctuating in our favor or against us. In this way, the operation reaches a maximum profit value and maximum loss until the operation is closed, either because it reached our take profit, stop loss or because it is closed due to market conditions in our system.

Surely this has happened to you: you open a trade, it goes against you, hits the stop loss and then it goes in the direction of your analysis, reaching or exceeding your initial take profit level, but first it put you out of the market.

Soccer No GIF by Coca-Cola - Find & Share on GIPHY

At other times, you notice that the price almost reaches your take profit level, but does not quite touch it. Then the price goes against you until the stop loss is hit, not only losing your potential partial profits, but also ending the trade with a loss.

This is because generally, when we start in the world of trading, we focus on the net results of our operation, that is, if it produced a profit or a loss. But we do not realize that each operation provides us with a net result of the operation (profit or loss) and also two very important metrics: MAE and MFE. These two metrics will provide us with valuable information to optimize our trading system.

The formulas to calculate the MAE and the MFE are the following:

MAE (%) = [(precio de entrada – precio mínimo) / precio de entrada] * 100

MFE (%) = [precio máximo – precio de entrada) / precio de entrada] * 100

To better understand how to calculate these two metrics, take a look at this example:

Suppose we design a trading system that operates only on the for EURUSD, we do the respective backtesting and we get the following results:

(To facilitate the calculations, the closing price will be equal to the take profit or stop loss that we place at the time of opening the operation).

Operation Type Entry price Minimal price Maximum price Closing Price MAE (Pips) MAE (%) MFE (Pips) EFM (%) Result
Purchase 1.08200 1.07900 1.08350 1,07900.00 -30 -0.28 $15.00 0.14 loser
Purchase 1.07525 1.07255 1.07805 1,07255.00 -27 -0.25 $28.00 0.26 loser
Sale 1.09950 1.09700 1.10101 1,09700.00 -15.1 -0.14 $25.00 0.23 winner
Purchase 1.06100 1.05910 1.06450 1,06450.00 -19 -0.18 $35.00 0.33 winner
Sale 1.10450 1.10340 1.10750 1,10750.00 -30 -0.27 $11.00 0.10 loser
Purchase 1.08100 1.07900 1.08450 1,07850.00 -twenty -0.19 $35.00 0.32 loser
Purchase 1.09150 1.08980 1.09550 1,08980.00 -17 -0.16 $40.00 0.37 loser
Purchase 1.10300 1.10200 1.10700 1,10700.00 -10 -0.09 $40.00 0.36 winner
Purchase 1.09700 1.09500 1.10050 1,10050.00 -twenty -0.18 $35.00 0.32 winner
Purchase 1.08700 1.08500 1.09100 1,08500.00 -twenty -0.18 $40.00 0.37 loser

The analysis of our system gives us the following results:

Average MAE in Pips = -20.8

Average MAE in % = -0.19

Average MFE in Pips = 30.4

Average MFE in % = 0.28

% Hit = 40

% failure = 60

Total Lost (pips) = 149

Total Profit (pips) = 135

Mathematical Expectation = -1.4

The negative mathematical expectation of our system tells us that it is not profitable and if we implement it in a real account it would produce losses. Now we use the MAE and MFE metrics to reset the take profit and stop loss levels and see what happens to the results of our trading system. How do we do it? Very simple, as follows:

  • To adjust the new stop loss level of a purchase operation we multiply the entry price by the average value of the MAE (in percentages). We will subtract this value obtained from the entry price and the result will be our SL. In the case of a sale operation, the result obtained is added to the entry price.
  • For him new take profit level of a purchase operation we multiply the entry price by the average value of the MFE and we add this value to the entry price, thus obtaining the new TP. In the case of a sale operation, instead of adding the result, we subtract it from the entry price.

The results are shown in the following table:

Take Profit Stop Loss G/P Result
1.08503 1.07984 -21.6 loser
1.07826 1.07310 -21.5 loser
1.09642 1.10170 30.8 winner
1.06397 1.05888 29.7 winner
1.10759 1.10671 -22.1 loser
1.08403 1.07884 30.3 winner
1.09456 1.08932 30.6 winner
1.10609 1.10079 30.9 winner
1.10007 1.09481 30.7 winner
1.09004 1.08483 30.4 winner

% Hit = 70

% failure = 30

Total Lost (pips) = 65.2

Total Profit (pips) = 213.4

Mathematical Expectation = 14.81

If we analyze these results, we can see that by using the MAE and MFE to adjust the levels of TP and SL, we have maximized gains and reduced losses. Now the expectation of our system is positive, which means that we transform a losing system into a winning system. It is important to note that the rules of our system did not change, we only changed the levels of TP and SL.

Important clarification: doing this is optimizing our trading strategy, so it is recommended that you leave a percentage of the data out of sample to do a real backtest of your trading system and not fall into over-optimization.

5. Analysis of the MAE and MFE.

If you analyze the formula for calculating these metrics and their possible values, we can deduce some interesting things:

  • When we open a buy trade and the price immediately rises to touch our take profit without falling into the zone of partial losses, then the MAE is equal to zero. And in the case of a short operation, the price falls until touching the TP without ever exceeding the entry price. This would be the ideal scenario that every trader wants every time he opens a trade.
  • If, on the contrary, the operation immediately turns against us and at no time does it orbit the zone of partial profits, then in MFE is equal to zero.
  • If he MFE is much higher than the profit of the operationThis means that we are leaving money on the table. This is a clear sign that we are not closing trades at the right time. When this happens, it is best to place a trailing stop or drag stop to protect the profits already obtained.
  • If he MAE is far from the price of entry, our tolerance to irrigation may be too high. This may be a clear sign that our trading system can be improved.

Finally, I would like to tell you that it is a good idea to complement these metrics with the ATR indicator (Average True Range) because it shows us the volatility of the price at the time of entering the market. This allows placing the profit and loss margins based on the volatility of the moment and not only as a fixed percentage. In this way, we avoid exiting the market early at times of higher volatility and at the same time allow us to further tighten stops at times of lower volatility.

If you were not applying this, do not go crazy. Just keep them in mind and learn about it. It is about having more and better information about your trading systems.

Now I ask you, did you know these metrics? Do you apply them in your trading? are you going to use them? I read you in comments!

Leave a Comment