Backtested results from historical file

I am using the code from the page -

I am unable to add to an existing position using this code. The only trade listed in the Amibroker results is 10/16/2000 with 21 shares. If I try to add to the position as in 10/17/2000 Amibroker ignores this trade. I am missing some configuration parameter in Amibroker to allow the added position?

Input file looks like this:

Thanks for any help/direction.

The formula from KB does not implement scaling-in. Second buy is redundant (because the position is already open) and as such skipped.

Hello, how can we implement scaling in in the formula? I use this formula a lot, thank you