I have an issue where the quantities of my stop-loss and take-profit working orders are being updated to the sum of the individual orders to which they're attached.
When conditions are right, I create two orders: one scalper and one runner.
The scalper order has a stop-loss and a take-profit attached to it.
The runner order only has a parabolic-stop-loss attached to it.
When both orders are created, the flow of orders seems fine. However, during the call to OnBarUpdate for the next bar, the stop-loss and take-profit working orders have their quantities updated to the sum of the individual scalper and runner orders. This is not good.
Here are screenshots of relevant code and debug tracing:
The code in OnStateChange for State == SetDefaults:
The code snippet that executes the orders:
The trace file contents:
I am attaching the trace file (DEBUG.TXT) so that you may have access to the order JSON, which is appended to the end of each order line.
I would really like to understand why the scalper's stop-loss and take-profit, as well as the runner's parabolic-stop-loss are all having their quantities updated to the sum of the individual order's quantities.
Thanks.
Comment