Skip to content
Dave Mabe
Close menu

"How can I optimize the stop and target levels in my trading strategy?"

By Dave Mabe

Here's a question from Jason D. (name used with permission):


Jason D.

How can I include Target, Stop, and Timed Exit in the backtest results so that I can see the optimal target, stop, and exit time?


Dave:

Ironically, the best way to determine the optimal levels for stops and targets for a strategy is to run your backtest without any stops or targets included.

How does this help?

Amibroker and Trade-Ideas automatically include the MAE and MFE values for each trade.

These stand for Maximum Adverse Excursion and Maximum Favorable Excursion.

These are maximally dumb names for a simple concept: the point at which the trade was the most profitable (MFE) and least profitable (MAE).

You can use these numbers to determine optimal settings for your stop with running dozens of backtests in guess-and-check mode.

I always include parameters in my backtest code where I can specify the stop level without making a code change.

If the strategy does position sizing based on the stop distance, then how do you specify the size based on no stop?

In this case, I have separate logic to size based on the "stop," but then in this mode, the backtest doesn't actually stop any trades out.

This allows you to determine optimal stop levels across the entire trade set, which is powerful.

This type of analysis is on the roadmap for the Strategy Cruncher and will be available soon.

More on the process for stops, targets, and timed exits tomorrow.

Thanks for the question, Jason D.

-Dave

P.S. Wish you could backtest your ideas - without spending months learning to code? Run your first backtest in an afternoon using my Amibroker AFL Course.

Get Instant Access to the AFL Course