MAE MFE code/indicator
Forums › ProRealTime English forum › ProOrder support › MAE MFE code/indicator
- This topic has 9 replies, 7 voices, and was last updated 4 years ago by GraHal.
-
-
01/16/2019 at 3:31 PM #88818
Hi all,
Is there a readymade code for MAE and MFE.
I would like to be able to answer the question:
“what is the maximum amount ever gained since this trade started” – for MFE and the opposite for MAE for both sell and buy orders
I started writing the code for this but am hoping it already exists
Also, it would be good to have “what is the MFE on the last X bars”
Thanks
P.S – I really appreciate your help and support, it is amazing!
01/16/2019 at 4:34 PM #88833This might be of use:
https://www.prorealcode.com/topic/mae-and-mfe-calculator/
It comes up as the top item if you type MAE MFE in the search box!
01/16/2019 at 5:29 PM #88837Thanks,
Naturally, I checked it before posting, but it is not exactly what I am looking for, the question is does a pre built indicator exist in the language, like ATR for example or HIGH, LOW etc.
Otherwise I can code it myself, it just takes longer…
Thanks again!
01/16/2019 at 6:00 PM #88844There is no pre-built indicator or code that provides what you want but coding it wouldn’t be very difficult and a lot of the basic calculations are in what I wrote. You just need to start recording MFE and MAE highest highs and lowest lows distance from TRADEPRICE from the moment a position is opened and then reset it when it is closed.
1 user thanked author for this post.
05/14/2019 at 9:22 AM #9842805/14/2019 at 10:46 AM #98449The MAE term stands for “Maximum Adverse Excursion” and refers to the biggest movement against you while you are at market.
While the MFE (Maxime Favorable Excursion) is the inverse: maximum gain achieved while you are at market.
1 user thanked author for this post.
06/24/2019 at 1:52 PM #101314I have been using Probacktest to backtest my trading strategies for over two months now on a daily basis.
I have recently noticed that the MAE figure on the detailed report does not take into account the max movement against you on the entry bar itself; but then also noticed yesterday night by reviewing a small sample of the winning trades from the detailed report’s closed positions list that the MAE is not really the max price it went against your trade at all. This makes me wonder whether the absolute performance figures and MFE have any bearing….
Should I trust that the return figure on the overview tab information on the probacktest results is correct?
I normally use the MAE as an indicator of the size of stop loss required for the strategy, but how accurate is it? can I trust it? please help
06/24/2019 at 7:19 PM #101340a small sample of the winning trades from the detailed report’s closed positions list that the MAE is not really the max price it went against your trade at all.
I (and I’m sure others?) would love to see examples of what you found??
I’m not doubting what you say btw.
05/02/2020 at 9:38 AM #129348inside a strategy, it shows mae / mfe
123456789101112131415161718192021222324252627282930313233343536if longonmarket thenlowestprice=min(tradeprice(1),low)mae=lowestprice-tradeprice(1)if mae>mae[1] thenmae=mae[1]endifhighestprice=max(tradeprice(1),high)mfe=highestprice-tradeprice(1)if mfe<mfe[1] thenmfe=mfe[1]endifendifif shortonmarket thenhighestprice=max(tradeprice(1),high)mae=tradeprice(1)-highestpriceif mae>mae[1] thenmae=mae[1]endiflowestprice=min(tradeprice(1),low)mfe=tradeprice(1)-lowestpriceif mfe<mfe[1] thenmfe=mfe[1]endifendifif not onmarket or ((longonmarket and shortonmarket[1]) or (longonmarket[1] and shortonmarket)) thenhighestprice=0lowestprice=closemfe=0mae=0endifgraph round(mfe) coloured(0,0,255,255) as "Maximum Favorable Excursion"graph round(mae) coloured(255,0,0,255) as "Maximum Adverse Excursion"05/02/2020 at 11:01 AM #129361 -
AuthorPosts
Find exclusive trading pro-tools on