long and sell signal on the same day problem - system tester

#1
Hi,

I am trying to use the following sample code:

buy long/buy to cover:
H>=O+parameter

sell long/sell short:
L<=O-parameter

Positions are opened intraday with delay=0. The problem is that there are days when both signals appears(buy and sell). Metastock resolves it only with "order bias" option and always sells my long position and again enters long.

I would like to build the system in such a way, that when both signals appears it reverse any previous position(i.e. when it was long before, it enters short).

I was trying different techniques without success :/
Even using something like Ref(Simulation.LongPositionCount,-1)=1

to check if in previous bar I had long position so I can short sell when I have a day with both signals. However, it doesn't work somehow.

I'll appreciate your hints.