Choosing a Stop-Loss Threshold by Optimizing a Trade Performance Metric
Summary
The document asks how to choose a stop-loss boundary automatically from a trade log containing entry and exit times, profit or loss, maximum adverse excursion, and maximum favorable excursion. The suggested approach frames threshold selection as an optimization problem. Select a performance metric that matches the objective, then search for the threshold that optimizes it; for example, minimize maximum drawdown or minimize the negative of trade expectancy to maximize expectancy.
The answer points to general numerical optimization routines as a practical implementation route. It does not prescribe a specific objective, threshold-search method, or validation procedure, and it reports no results from applying the method to the listed trades. The resulting threshold therefore depends on the chosen metric and the trade sample. The document presents an optimization framing, not evidence that a selected stop will improve future performance.
Key ideas
- Trade records with maximum adverse excursion can be used to evaluate candidate stop thresholds.
- Threshold selection can be framed as minimizing a chosen trade metric.
- Maximum drawdown and trade expectancy are examples of possible objectives.
- The chosen metric determines what the optimization treats as a favorable stop setting.
- The proposed method gives no out-of-sample validation or guarantee of future improvement.
Tags
Full text
# Calculate optimal stop loss from MAE or MFE # Calculate optimal stop loss from MAE or MFE I have a list of trades. For each trade I have the following information - Entry date and time - Exit date and time - P/L - MAE (Maximum Adverse Excursion, sometimes called within trade drawdown) - MFE (Maximum Favorable Excursion, sometimes called within trade run-up) I use TradeStation, and currently, to calculate the stop loss, I manually observe the Maximum Adverse Excursion chart and attempt few values where I think it might be good a fit. A threshold which will remove quite a few big losses and relatively few big wins. For example Green dots: profitable trades Red dots: losing trades (absolute value of P/L is plotted) What I'm looking for is a way, to calculate the stop loss (or boundary if you will) automatically, from the trades list. Personally I prefer Python. But any formula, paper, or programming language / pseudo code would really help. ## Answer by babelproofreader (score 2, accepted) https://quant.stackexchange.com/a/67995 This is a straightforward minimisation problem, for which there are many routines available in Python, e.g. SciPy. You just need to minimise a trade metric of choice such as max drawdown, or alternatively to minimise the negative of a trade metric that you want to maximise, e.g. minimise the -TradeExpectancy
Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.