lets say you want the stop order 5 cents above the ask or below the bid depending on direction. you can set it to be
Pos < 0 ? Ask + 0.05 : Bid - 0.05
So if you are Short, position will be less than zero, so the stop will be Ask+0.05.
if you are Long, position will be greater than zero, so the stop will be Bid-0.05.