I must be missing some basic assumptions about the operation of the percent rebalancing aspect of "order_target_percent()" as I would never have expected to see a short position (negative position.amount) come through a buy long only with a set_long_only() declared in initialize().
Yet some how the code in this strategy produces short positions.
This matters as I've got my TrailingStop code that automatically determines side for all positions and then automatically assigns a trailing stop based on that side. If we "were" long, and a trailing stop was set to protect that long position, but somehow we're now short (due to the mechanism within order_target_percent() I'm guessing), this throws my TrailingStop code against the wall (SPLAT!). I'm now exiting a short position I never thought I'd have.
Can anyone clue in this dazed and confused soul?