Uploaded by Tony Bertoni

MAE n MFE theory n practice Great

advertisement
MAE n MFE discussion
https://forum.mql4.com/39915/page1 and http://estrategiastrading.com/como-utilizar-la-mae-mfe/#more1999
MAE is telling you that your "entry strategy" got you into a position too early, by an amount equal to the MAE. As
such your "Profit potential" for the trade was undermined by an amount equal to the MAE.
MFE is the maximum Profit that can be extracted by your
Strategy based on your Entry.
MAE is for tuning your entry strategy, n SL.
MFE is for tuning your exit strategy, n TP.
Full wave Excursion
MFE
EMFE $ take/give bk.
MAE
Profit
FWE= MAE + MFE
The difference between MFE and the Profit is something I call "excess MFE" or simply "EMFE" and this is money
that you left on the table by virtue of your exit strategy keeping the position open too long. Also called ” ETD“
End of Trade Drawdown
Profit = MFE – EMFE
Profit = FWE – MAE – EMFE
(to maximase Profit reduce MAE n EMFE)
And thirdly, time is money. Capital tied up supporting the margin position of a trade is capital that can't be used to
support another trade.
So the "time to MAE" and "time to EMFE" are parameters to analyze as they are an indication to you of the time
WASTED as you are not using your capital wisely/efficiently.
And lastly, it is critical that you investigate the chronology of the occurrence of MAE and MFE.
If MAE occurs before MFE then the trade was good but needs optimization to tune the entry and exit strategies for
minimal MAE and minimal EMFE.
But if MAE is occurring after MFE then the strategy is busted in multiple ways. Perhaps the most significant being that
it is opening positions opposite to that which one should be taking. If your strategy is opens a long position and the
market proceeds to carve out a price action that results in the MFE occurring before the MAE for your trade then that
means your trade really should have been a short position, not a long position (in which case the MFE for the Long
position becomes the MAE for the short, and vice versa for the MFE).
I think I may have posted these up before, can't remember:
Analysis of MAE, MFE, ETD, SL n TSL
from forums
Originally Posted by elitetradernyc
Hey guys, I've got a swing trading system where I buy a position at once and scale out of the
position. Just wondering, if there is any room for improvement based on these statistics, how do I
interpret them?
Average MAE -2.61%
Average MFE 9.42%
Average ETD -5.85%
TB these need SD to be able to evaluate worse DD
1. If your MAE is 2.61%, it means that a disaster stop at 5.22% (2 * MAE) will be very unlikely
to be hit.
4.2% ?
2. If MFE is 9.42%, you should probably be out of half the position at about 9% gain, then
move the stop to 4.2% as a profit stop (i.e., 9.42% - the 5.22% disaster stop distance, as
that is the distance that it is unlikely to hit).
3. Either exit some more (another half of the then remaining position?) when you hit the MFE
that is hit only 25% of the time.
4. Trail the last portion, with whatever tick quantum that is comfortable to you.
Applying Linear Regression LR to MAE x P n MFE x P
MAE – we expect a positive slope, Correlation(P, MAE)= positive value, ie the
less MAE the greater the P. P=Profit? (s/b the greater the reward the greater
the risk, for positive correlation???)
A negative slope indicates the trader allows large drawdowns in the hope of
recovering to a profit, (hope should not be a traders word).
MFE – similarly, we expect a positive slope, Correlation(P, MFE)= positive,
indicating most of the MFE was taken as profit, n
Since it is impossible to take more P than the MFE, the slope cannot exceed 1.
The closer it gets to 1 the more effective the strategy is to take P from the
available MFE.
The MAE is also useful in setting initial stop losses. For example, if a trader finds that most of
their
winning trades do not go against them by more than 30 points, they can then use
that knowledge to cut their losses when they are more than 30 points. In other words, LOSING
trades that have a MAE beyond 30 points are UNLIKELY to recover.
if over a 100 trade sample size you find that your MFE average is 50 points but your gross
profit average is only 25 points, then it could suggest your exit price could be improved.
Qué es la MAE-Maximun Adverse Excursion?
El término MAE, yo lo traduciría como “Incursión Máxima Adversa”, se refiere al mayor movimiento en tu
contra mientras estás dentro de la operación.
Se ve mucho mejor con un gráfico:
Ejemplo MAE en operación short (Ganancia = 0)
y
long (Con Perdida ).
Este gráfico de dispersión, hecho con excel, muestra la MAE de las operaciones ganadoras y perdedoras de un
sistema de trading tipo mean reversión sobre el SPY – sale a los 10 días despues de la entrada y sin stop loss.
(260 operaciones en total).
(MAE/trade) %
MAE% - Excursión negativa vs resultados %
Puedo ver un patrón distinto entre la MAE de las operaciones ganadoras y las perdedoras.Tengo una relación
lineal entre la incursión negativa y el resultado de la operaciones perdedoras.
Puedo ver que las operaciones ganadoras ( resultado % mayor que cero) no suelen tener una MAE superior al
6%.
O lo que es lo mismo: si mi trade va arriba del 6% de excursión adversa, es muy difícil que la operación termine
con ganancias.
Aquí puedo llegar a pensar en utilizar initial SL - stop de protección. ¿Puedo llegar a mejorar si añado un stop
loss a 6%?
Toma de beneficios
¿Hasta dónde han llegado las ganancias?
No muy lejos.
Puedo hacer un análisis similar con la MFE, midiendo la relación entre la excursión positiva de las operaciones y
la rentabilidad final.
MFE %
Salvo contadas excepciones, la mayor parte de los trades positivos obtienen entre 0 y 5% de rentabilidad .
(Bueno, como se trata de un sistema de reversión a la media puedo pensar que es normal tener un alto
porcentaje de acierto – más del 70 % de las operaciones terminan en ganancia- pero poco beneficio por
operación).
Aquí la relación también es lineal respecto a las operaciones que logro cerrar en positivo.
¿Pero qué pasa con las pérdidas? A mi parecer no tienen un comportamiento tan claro.
Volatilidad con ATRs
Jugar con porcentajes suele ser engañoso. Ya sabes, si tienes una pérdida del 10% , necesitas una revalorización
del 11,11% para recuperarte. (Si te interesa, puedes ver “¿Cuánto cuesta recuperar una pérdida?” en estaentrada).
Una alternativa para examinar la MAE o MFE es medirlas en relación con el ATR- Average True Range- que
tenías al iniciar la operación.
En mi caso, puedo ver que las operaciones que terminan en ganancia nunca tienen una MAE superior a 4 veces el
ATR inicial. Lo que me da otra idea para saber dónde posicionar correctamente el stop loss.
Medir el “edge”: e-ratio
Utilizar la MAE o MFE en relación con el ATR te permite obtener valores comparables para distintos sistemas o
condiciones. Esto es lo que hace el e-ratio.
Con este ratio puedes medir el “edge”, digamos “ventaja”, de un componente de tu sistema de trading. En mi
opinión es útil para valorar el potencial de distintas señales de entrada.
CÁLCULO E-RATIO
1.
Normaliza’ la MAE y MFE respecto al valor del ATR inicial (MAE dividido el ATR de cada operación y también
MFE dividido ATR).
2. Calcula el promedio de los valores normalizados (avgMAE y avgMFE).
3. El cociente avgMFE/avgMAE es el e-ratio.
TB: Tendria que ser (Profit de las ganadoras, en vez de MFE, pq MFE no contiene ETD, vease el
primer grafico y al mismo tiempo, tendria q ser el MAE de las perdedoras, en vez the todas las
MAEs)
Para que los trades tengan una ventaja positiva, el e-ratio debe ser mayor que 1 . Pero evidentemente cuanto
mayor sea más potencial tendrá tu sistema.
TB: Con Profit en vez de MFE, entonces Profit / MAE tiene q ser > 1 para ser util, cuanto mas major)
En el caso del ejemplo el e-ratio es de 1.08
Nota: La información sobre el e-ratio la he encontrado en este blog donde también puedes encontrar el código
para Amibroker y para TraderStudio.
e-ratio: How to measure your trading edge in 4 easy steps
October 30th, 2009 · 19 Comments · Backtest
e-ratio is a metrics that measures the edge of a trading system component. For example, we could
use it to quantify the edge gained from a donchian channel breakout entry signal. (P n MA below).
THE CONCEPT
TB: The graph above shows the Entry signal, MAE as a PR, and MFE followed by an Exit
signal, what we want to measure is the EDGE of the system, which is the trade offered by
the system, ie (MFE-ETD)/MAE ) ETD=ExitTradeDrawdown, what was left out at the table.
The e-ratio quantifies the edge by calculating the overall amount trades go in your favor versus the
overall amount trades go against you. The higher value the value of the e-ratio, the more trades
move in your favor – giving you a good indication of the edge measured.
Take all the trades generated by the entry signal.
Close each trade after a given duration of n days.
Calculate the e-ratio based on data from all trades (formula detailed in 4 steps below). This gives
you the e-ratio for a trade duration of n days.
Repeat the operation for various values of n to chart the e-ratio curve as a function of the
number n of days – as illustrated below:
The e-ratio of the entry criteria is plotted above. The higher the value of the e-ratio, the better the edge. In the instance above the 45-day
e-ratio is 1.21 but drops to 1.07 for day 68.
STEP 1: RECORD MAE AND MFE FOR EACH TRADE
For each trade, measure the Maximum Favorable Excursion and the Maximum Adverse
Excursion.
Maximum Excursions are the maximum amount the price goes against you (Adverse) or in your
favor (Favorable) during the trade. MAE is calculated between the entry price and the lowest price
during the trade. MFE is calculated between the entry price and the highest price during the trade.
Note that both values are positive.
STEP 2: NORMALISE MAE AND MFE VALUES (TB:Unnecessary if in %, ie. MAE/ Price, (MFEETD)/P %
To be able to compute the e-ratio across different markets, the Excursion values should be
normalised to a common denominator – such as a unit of volatility. The Average True Range is a
good measure of volatility. In many systems it is also used to drive the position sizing, making it
really relevant. TB: the following is unnecessary, as MAE/Atr/MFE/Atr = MAE/ATR
Divide all MAE and MFE values by the ATR calculated at the beginning of the trade. In this
example we use the same period for the ATR and the Donchian Channel.
This gives you comparable values across all markets and conditions.
STEP 3: AVERAGE MAE AND MFE VALUES ACROSS ALL TRADES
Simple maths here: just add all normalised MAE values calculated in step 2 and divide by the
number of MAE trades. Repeat the operation for the MFE values.
STEP 4: FINAL DIVISION = E-RATIO
Simply divide the average MFE by the average MAE to give you the e-ratio. The higher the
number, the better, with any values above 1 implying a positive edge.
TB: (MFE-ETD)/MAE or PROFIT/MAE all in percentage of Price, this will allow for
comparison of different securities.
ANALYSIS
Plotting the e-ratio across different trade durations allows you to check the edge offered by the
signal and in what timeframe works it best for the its signal parameters.
You can also combine e-ratios for different parts of a system to see how they impact each other.
Another component of a trading system could be a trade filter, for example, trade with the main
trend: RETURN TO THE MEAN
Only buy when the moving average (at a higher timeframe) is rising and below the price.
Only sell when the moving average (at a higher timeframe) is declining and above the price
The second e-ratio plotted is from a combined entry signal and trade filter. You can see the improvement a filter logic makes! The
system tested was a Donchian Channel Breakout (17 days) with 7 Futures markets. The MA used for filtering was 108 days.
The e-ratio is one tool in the box of an automated trading system developer. It can quickly give you
an overall feel for a component to include in the trading system
Credits: e-ratio was introduced to me by Curtis Faith in his Way of the Turtle book.
Note: The e-ratio was calculated using TradersStudio (and Excel). I will follow-up with a post
containing the code used to calculate it.
Forum: When I run a backtest I average all the MAEs % together and I look for strategies that have the lowest
overall average MAE% as this is an indication that those entry strategies are doing a better job at
predicting/forecasting/timing the market for opportune entry points.
While we use the average MAE value to search for optimal entry strategies (and parameters) we also look to the
average EMFE% to search for optimal exit strategies. Probably this is the ETD.
We are looking for strategies that have the smallest average MAE and smallest average EMFE as these strategies are
doing the best job at being predictors of when to get into the market and when to get out of the market.
That said, of course we don't want strategies that are waiting so long to get into the market and are then jumping
back out of the market prematurely such that we have small average MAE and small average EMFE but also small
total profit.
The simple way I filter for this is I have sorting/filtering criteria. I run a backtest, I have a csv file that gets updated at
every deinit() with the resultant average MAE and average EMFE values for that specific trade parameter combo as
well as the average profit per trade. The csv file is only updated if the average MAE, average EMFE, and average
profit/trade all meet a minimum threshold.
An example might be something like "average MAE must be no more than -$100, average EMFE must be no more
than +$100, and average profit per trade must be no less than $200". Just an example.
Then I will rank-sort the resulting data by profit per trade and seek out the maximum profitable trade strategy.
(MFE-ETD)/MAE or PROFIT/MAE or another thought below:
TB: What about optimizing based on some formula for the sake of comparison, like say
Opt = avgProfit% / (1.4*avgMAE% + 0.6*avgSTD%)
The factors are because MAE% is YOUR Capital loss, while STD% is the House’s Capital loss, thus less
important.
Now my down selection criterion is actually a little more complicated than that because I don't really use "gross profit"
as a metric of success. I look for strategies that have the best RAROC (risk-adjusted return on capital).
This involves computing the probability of losing 50% of the account (median drawdown) and normalizing (risk
adjustment) the ROI such that the result risk of ruin is that I have a 1% chance of losing 50% of the
account's equity (so-called 1%/50% rule, some people are even more conservative and go for 1%/20%). Once I
have this data I can them compute the RAROC and rank-sort the output of RAROC.
TB: The above paragraph brings to memory the Excel sheet “Risk of Ruin” in the folder “Risk”, perhaps
it is the same risk of ruin formula function of (drawdown).
What you will find is that strategies which have inherently low average MAE and inherently low average EMFE will also
be inherently more profitable (for all the obvious reasons) and will thus inherently have higher RAROC. It all comes
together nicely.
1005phillip
2011.03.31 19:50
#
supertrade:
There’s a lot of talk about MAE/MFE ..M for Maximum... but are there any attempts to single out outliers? ..for
instance, a particular trade may have moved 300 pips in the adverse direction before turning a profit while most
trades only move around 50.. would an mAE/mFE .. m for mean, be more descriptive? Yes, see e-ratio above
TB: This is also answered by SD Standard Deviation, where 1, 2 or 3 x SD would include or exclude the outliers.
If you are using the code I uploaded last summer I believe it contains the outlier identification procedures (per WECO
rules) and purges outlier trades from the analysis. Honestly the code from last year is so old though I can't remember
whether I updated it with this logic that long ago or if it was a more recent addition.
If the M is for maximal but it is Maximal per trade, not Maximal for a basket of trades. And naturally the standard
deviation of the MAE's and EFME's is relevant as well, to eliminate outliers?.
TB: Also follow Excel spreadsheet like “tb-Optimal SL by MAE.xlsx” in Math Graph folder in the desktop.
Download