@maximump The easiest way to do it is creating two variables: one counting open longs and the other for shorts. An then compare both with a normal 'condition' block.
@xfire Your suggestion uses martingale but only when the "once per bar" condition is met. I need it to open a martingale position as soon as the previous trade is closed at stop loss, and not at the next bar.
So, a buy trade hits stoploss and a sell trade is opened immediately.