Requirement :: Need to either take entry on buy side or sell side based on some condition. After entry on either buy side or sell side, wait for another condition to take exit. After exit, start strategy from beginning that is take a trade from either buy or sell depending on condition.
Approach :: Two sets are constructed. One for buy and one for sell. If entry in one set is taken, restricting entry in another set using positions details keyword. After one set entry and then subsequent Set exit. The strategy is stuck in live-entered status. How to automatically move it to Exited status so that it can be reactivated based on reactivate after setting?
Note :: Condition for exit is not based on PnL so can’t put the condition directly in universal exit.