How to set a stop loss?

Hello,
I am doing a backtest and I set the maximum loss stop at 1%:
image

However, when I take a look at the report, I find losses of more than 1%. Could please explain me why is that? and how can I fix it?
image

Best regards,
Siamak

Check out "Exit at trade price only (0)" of stops settings.
Set to Exit intraday at high low prices.

1 Like

thank you , I change it to Exit intraday at stop (1) and now it works. Thanks.

I’d also recommend looking at the Applystop() function. If it’s in your AFL it will override the backtest GUI settings, same as any option set in AFL.

You’ll find it beneficial to keep track of instead of manually entering in settings. Makes it easier when AFL scripts start piling up. Settings you have to set each time or load saved settings.
https://www.amibroker.com/guide/afl/applystop.html

And the setoption() function. You can create a code snippet as a template for your AFL. I have a snippet set in editor for options I set regularly like positionsize, max open positions , and initial equity. Very handy when keeping track of AFL and reports to see everything in the script.
https://www.amibroker.com/guide/afl/setoption.html

1 Like

Thank you very much @Metamega, it is really helpful. I appreciate it.