But up to 3 trades should be opened, not just one, so NumOpenX == 0 is not the right solution here.

I am trying to implement this behavior:

1. Check the open price at 8 o'clock
2. When the price moves 15 pips up, open one short trade
3. When the price moves 20 pips up, open the second short trade
4. When the price moves 25 pips up, open the third short trade
5. All trades should have a stoploss 50 pips from 8 o'clocks opening price and a takeprofit at the 8 o'clock open price.
The long scenario vice versa.
Manually this would be done by pending orders.