MFE & MAE Tool

This is a simple implementation of the MFE/MAE Tool for TradingView.
It's a quite powerful tool and pretty useful in systematic trading, but I don't see many trader using it these days.
It's created for EMA cross, but you can easily change it to use your own signals.

What is MAE/MFE Tool
  • MAE stands for Maximum Adverse Excursion - Worst P&L during the trade
  • MFE stands for Maximum Favorable Excursion - Best P&L during the trade

The idea is pretty simple. We take only signals without any position management or exits and measure the best/worst P&L for the next X bars after the signal was.

The primary use case for it is to understand how good your signals are .
If you'll add complicated money management tools, exits, and SL/PT to your strategy, it brings quite a lot of noise. After that, it's pretty tricky to understand if your signals bring much information about future price movements. In other words, bad money management can ruin good signals, and you might discard the entire strategy without knowing that. So this is why I think it's important to check the quality of your signals separately.

Another simple way to use it is to estimate where to put SL/PT
In this example, we're computing MAE/MFE in percent. We're plotting it both on the chart and computing some statistics based on it. This is why it's pretty easy to get a quick understanding of what is your SL/PT should be.

MAE/MFE tool consists of a:
  • Chart - it displays a point for every signal. Long/Short trades can have different colors. On hover you'll see details for this signal.
  • Table with stats - we're computing basic metrics for these Signals like average/min/median/max MAE/MFE, number of trades, and how many trades hit selected SL and PT. Stats are also separated by the side so you can see performance separately for longs and shorts.

The indicator is highly customizable, you can configure:
  • Bars you want to use to compute MAE/MFE
  • Side selection
  • SL and R:R
  • Styling of the chart
  • Position and style of the table
  • Parameters for the EMA

EMA cross and its parameter were selected randomly, so don't estimate to see a great performance here.

MFE/MAE tool is a pretty powerful concept. At some point, I'll create an entire article in my blog with more examples and descriptions.

Thanks to @MUQWISHI for helping code it.

Please remember that past performance may not indicate future results.
Due to various factors, including changing market conditions, the strategy may no longer perform as well as in historical backtesting.
This post and the script don’t provide any financial advice.

Pine Programming v5: qntly.com/pineprog
Adv.Pine Use-Cases: qntly.com/advpine

Access to Pro Indic.: qntly.com/proind

Hire Me: qntly.com/hirepine
Telegram: qntly.com/tel
Script open-source

Dans le véritable esprit de TradingView, l'auteur de ce script l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par le règlement. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.

Vous voulez utiliser ce script sur un graphique ?