On TWS, you can create a 'conditional' order to trigger your first rule at X price. Your second rule, also a conditional order, can be set to trigger at a particular time. Unfortunately, with 2 conditional orders, you can't set an exit at MOC, but you can set it just before the close, for...