In this strategy, a successful trade's position is partially exited at a few different prices.
One stop-loss exit order and one profit target exit order are in place at any one time.
The stop-loss exit is for the whole position, but the profit target exits are each for part of the position: when one fills, another profit target exit order is placed at the next price (from within 'OnExecution').
Upon filling the second-to-last profit target exit, it places the last profit target exit order for the remainder of the position.
When running the strategy on Market Replay, the last profit target exit order is accepted with a quantity smaller than the position.
When doing the same in a backtest, this order's quantity is correct.
I'm printing the quantity requested to the output window both immediately before and immediately after the exit order function call in the code, and the reported value is correct.
For some reason, the platform accepts the order with a different quantity, and only running on Market Replay.

Comment