How to control max no. of open positions in live trading?

On back testing level it is easy to set max open position but finding it difficult to do in live intraday trading.
Suppose, I am running a exploration of 10 stocks or running 10 different AFLS on 10 different stocks. Now I want to control no. of max open positions. Let say if I keep max no. of position open to 1 then the 1st buy signal should be fired whichever appears in the exploration or any of the AFLS and to fire next buy signal the current position must exit. If I set max no. of open position to 2 then first 2 buy signal should fire the orders and in this case any other signal will fire only if at least one of the 2 buy signal is exited. I think raising a flag using StaticVarSet and redefining buy can be used to solve the issue but I am still learning and not a master of these functions. Can anyone guide me please how to proceed ?

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.