How to open 1 buy order at most and 1 sell oder at most at the same time?

How to open 1 buy order at most and 1 sell oder at most at the same time? Thanks.
Count your orders. Abort if count >= 1.