Backtest Report - Buy and Hold not working

When I run a Backtest on any AFL code and then view the report I see an error on the Buy and Hold figures - see below. I have upgraded to 6.31.0 (and I was sure it was working in earlier versions).

Is there something that I'm missing?

Thanks in advance

image

You should check YOUR DATA. Apparently you have something wrong with your data for DIA as the ENDING price is ZERO hence B&H on it produces -100% (-commission).

Today wanted to compare a few simple strategies to buy and hold SPY. Never really used the BH compare before or never noticed this issue.

Had the same results as OP and was pulling my hair out trying multiple symbols, ranges etc.

Commented out my commission rules in the AFL and problem solved. Tried setting commissions in the options menu as well and the issue OP had above happened.

So long as theirs no commissions set in AFL or options, the BH column doesn’t bankrupt itself.

Yes I can reproduce that now when you mentioned the interference with commission setting. Will check.

UPDATE: I checked and the reason for this behavior is that when commission is non-zero AND "Allow position shrinking" option has been turned OFF by the user, B&H position can not be open because funds are not sufficient without shrinking 100% pos size by commission amount.

So the FIX is to turn ON "Allow position shrinking" option (it is ON by default) and re-run backtest.

3 Likes

I have a related but different issue - the B&H stats do not appear in the report at all despite having turned B&H on
Capture

Unfortunately I am experiencing a similar problem. My entire Buy & Hold column no longer appears. I checked the commission (zero) & position shrinking (turned on). This started happening for all systems in the past week or so. I have not updated Ami nor changed data provider. Any help would be greatly appreciated. Thanks.
Screenshot (91)
Screenshot (92)

I found out why Buy & Hold wasn't working. My commodity etfs did not trade at the time of the From trade date. I obviously changed the trade from/to dates while working with other symbols and did not change them back. Hopefully this finding will help others.
Best,
Carl

1 Like