thanks. i will try itModification is the same as cancel and submit new order. So might as well cancel and send a new one.
Not sure you understand how the IB API works in principle. If you've registered and waiting for execution reports then no while loop is necessary. You wait until the whole order is complete or you wait for partial fill+some time and then send the stop. Marketable stop orders don't work outside RTH of course.