Yes you do need to wait until your filled before you can modify an order. I get the same error once and the it modifies after its filled. Since its a market order your submitting it will take 1 or 2 OnBarUpdate cycles before it fills and then the stops will move.
I look forward to assisting you further.
Comment