Ok, guys, another progress was made. I think I figured out a way to send both the real exit order and cancel the emergency exit at once.
And also, here's another discovery - it seems that parent and child orders are not necessary for my purpose of sending orders two at a time. All that seems necessary is to set the first order you want to send to transmit "false", so it will be sent together with the other order.
So here's our hypothesis: we are sending the first two orders at 10:00 AM. The first order is sent by our system, because of a signal, whereas the second order is sent also by our system but olny for safety reasons, to reside on the IB server in case our pc crashes or similar.
1) IB macro "placeorder" is executed and sends our entry MKT order to IB: it's set to transmit "0", will be sent when the second one gets sent and then it will read "filled".
2) IB macro "placeorder" is executed and sends our emergency exit TRAIL order to IB: it's set to transmit "1", and it will read "presubmitted"
Now we are safe and no matter what happens to our pc at home - IB has our emergency exit in place. If nothing happens to our pc at home, we get to 11:30 AM and our system gives a signal for exit, so it will now have to send that signal to IB and at the same time cancel the emergency exit that was put in place before.
1) IB macro "cancelorder" is executed and cancels our emergency exit TRAIL order: this row is set to transmit "0" and it will read "cancelled", once sent together with the following order
2) IB macro "placeorder" is executed and sends our regular exit MKT order to IB: it's set to transmit "1" and it will read "filled".
So, summarizing it: we have this pattern:
1) "filled" regular entry order set to transmit "0"
2) "presubmitted" emergency order set to transmit "1"
then, later:
1) "cancelled" emergency order set to transmit "0"
2) "filled" regular exit order set to transmit "1"
All this work to just be safe in case our pc crashes, which happened on my second day of trading and made me lose 80% of my capital on a day when my system actually would have made money.
And also, here's another discovery - it seems that parent and child orders are not necessary for my purpose of sending orders two at a time. All that seems necessary is to set the first order you want to send to transmit "false", so it will be sent together with the other order.
So here's our hypothesis: we are sending the first two orders at 10:00 AM. The first order is sent by our system, because of a signal, whereas the second order is sent also by our system but olny for safety reasons, to reside on the IB server in case our pc crashes or similar.
1) IB macro "placeorder" is executed and sends our entry MKT order to IB: it's set to transmit "0", will be sent when the second one gets sent and then it will read "filled".
2) IB macro "placeorder" is executed and sends our emergency exit TRAIL order to IB: it's set to transmit "1", and it will read "presubmitted"
Now we are safe and no matter what happens to our pc at home - IB has our emergency exit in place. If nothing happens to our pc at home, we get to 11:30 AM and our system gives a signal for exit, so it will now have to send that signal to IB and at the same time cancel the emergency exit that was put in place before.
1) IB macro "cancelorder" is executed and cancels our emergency exit TRAIL order: this row is set to transmit "0" and it will read "cancelled", once sent together with the following order
2) IB macro "placeorder" is executed and sends our regular exit MKT order to IB: it's set to transmit "1" and it will read "filled".
So, summarizing it: we have this pattern:
1) "filled" regular entry order set to transmit "0"
2) "presubmitted" emergency order set to transmit "1"
then, later:
1) "cancelled" emergency order set to transmit "0"
2) "filled" regular exit order set to transmit "1"
All this work to just be safe in case our pc crashes, which happened on my second day of trading and made me lose 80% of my capital on a day when my system actually would have made money.