Hi,
why do not use reverseLong/Short(1)or test NumOpenLong/Short system variable before opening the trade?

Ciao