Recommendations for Calculating MAE and MFE


Hey Brian, I’m looking for some guidance on how best to calculate and plot Maximum Adverse Excursion and Maximum Favorable Excursion to be able to see where potential stop losses / profit targets may exist during backtests. Tradestation offers this functionality, I was curious if you know of a python library that does the same for Quantrocket research?



If you want to swim with the current, use max drawdown instead. Both moonchart and pyfolio use max drawdown. If you prefer MAE, I’m sure you can find sample code somewhere out there if you look.


More specifically was looking at MAE and MFE because they help determine stop loss watermarks. Also noticed there isn’t any stats in the Tearsheets for profit factor, avg win/loss ratio, and % of winning trades which seem practically important for determining a positive win expectancy (TradeStations support these, as well as AmiBroker). Any plans to support these types of statistics?


You can save your entry and exit prices to the results csv.

Request noted for the extra statistics. Moonchart is open-source so you could also extend it yourself or submit a PR.