Has anyone else noticed or have any issues with using order_target_percent and 0 as the percentage?
order_target_percent(stock,0,limit_price=None,stop_price=None)
On occasion I see this behavior when running the backtester and I don't understand why.
2010-01-05 07:32:00 TNA BUY 863 $22.94 $19,794.63
2010-01-12 11:22:00 TNA SELL -862 $22.32 ($19,242.43)
2010-01-12 11:23:00 TNA SELL -1 $12.38 ($12.38)
2010-01-15 13:47:00 TNA BUY 845 $22.83 $19,293.88
2010-01-20 08:07:00 TNA SELL -845 $22.69 ($19,174.74)
So on the first call of order_target_percent(stock,0) it sells all but 1 of the shares I own. Then on the next run through it will sell the remaining 1 share.
My expectation is that order_target_percent(stock,0) would be the same as order(stock,-context.portfolio[stock].amount).
Is this just me or has anyone else seen this behavior?