Only one buy and one sell

Some plan need to have only one open buy and one open sell. If a buy position is open, it only can open a sell and if a sell position is open, it only can open a buy. If a buy and a sell positions are open, ESB won’t enter any new position. To achieve this, set “max open positions” on 2 and then set entry position like this:

Buy expression: (TotalOpenedOrders=0 OR !PrevOrderIsBuy[0]) and (…)

Sell expression: (TotalOpenedOrders=0 OR !PrevOrderIsSell[0]) and (….)

The expression is like: (if it hasn’t opened any order yet OR previous order is not Buy/Sell) AND (…) Then Open a new Buy/Sell.

Replace dots with your current entry conditions. For example you can set ESB open only new position by cross of two moving average and you need only either one buy or one sell or both and not open any other position till these are open.

Buy expression: (TotalOpenedOrders=0 OR !PrevOrderIsBuy[0]) and (MA1 crossup MA2)

Sell expression: (TotalOpenedOrders=0 OR !PrevOrderIsSell[0]) and (MA1 crossdown MA2)