Scenario: trading system holds a maximum of 4 stocks at a time. Currently the system has three positions and is looking to fill the fourth. For the next trading day there are three stocks that fulfill the end of day criteria and let's say the system requires a break of the 5 day moving average for entry and I want to enter limit orders for the trade.
[I have ignored margin in this example to simplify the explanation] Given that 75% of my trading dollars are occupied in the three positions I already own, I cannot enter three additional limit orders. Even if I could enter all three orders and more than one `hit', I would violate my trading model as I now own more than four positions. I would like to limit the back tester to not wait to see which of the three orders triggered or if multiple orders triggered place the order with the highest position value in the portfolio, BUT only place the order with the highest position value (in this case only one, or in this hypothetical model could be up to the four highest position values) in the queue and if the intraday condition (breaks below the 5 dma) is not met than no new position is placed in the portfolio. Currently, if the first ranked stock (in order of position value) does not met the intraday criteria but the second and/or third ranked ones do, etc. , the back tester will place the highest ranked stock in the portfolio thus resulting in misleading back test results. Does anyone know how to limit the back tester to the number of available open positions in the model?