Open additional new pending order once order been triggered

 

Can anyone suggest some code that able to open a new pending order once the existing pending order been trigger ? and put the current count of total open order into the magic number of this newly open pending order ?

I assume this will need to check on every tick, so thinking to avoid using OrderTotal() to loop through and check. thanks a lot in advance 

Reason: