It seems that adding a stop loss is the best tool investors have in terms of risk management. I’ve lost a lot of money be not setting the right stops. I’d like to propose 2 additional fields for strats, an “Optimal” and “Suggested” stop loss.
The suggested stop loss would be added by the strat manager, and should normally be the stop they use themselves.
The optimal stop loss would be calculated based on historical trade data. Since each trade record includes its max drawdown. This would be useful to both investors and managers.
A algorithm for optimal would look something like (javascript) …
let bestStopLoss: number = NaN;
let bestPL = -1000000000;
const MAX_STOP_LOSS = 10000;
interface Trade {
pl: number;
dd: number;
}
// Check each trade's drawdown to see if it's the optimal one
for (const currentTrade of trades) {
// Only check profitable trades with drawdowns
// Ignore if maximum stop loss is exceeded
if (currentTrade.pl > 0 && currentTrade.dd < 0 && currentTrade.dd > MAX_STOP_LOSS) {
// Use the drawdown as the stoploss
const stopLoss = currentTrade.dd - 1;
// Calculate total profit for this stoploss by checking each trade
let pl = 0;
for (const trade of trades) {
// Stop loss triggered
if (trade.dd < stopLoss) {
pl += stopLoss;
}
// Not triggered
else if (trade.dd > stopLoss) {
pl += trade.pl;
}
}
// If more profit, stoploss is better than previous best
if (pl > bestPL) {
bestPL = pl;
bestStopLoss = stopLoss;
}
}
}
alert('Optimal stop loss: ' + bestStopLoss);
alert(`P/L: ${Math.round(totalPL)} vs Optimal P/L: ${Math.round(bestPL)}`);