I can simulate this in the Portfolio Backtester using the Portfolio_CurrentEntries keyword and the following logic (where MaxEntriesTotal is an input):
Code: Select all
Condition1 = Portfolio_CurrentEntries < MaxEntriesTotal;
One option is to have a counter that's stored in a global variable. However, this would be a bit of a bother -- I'd need to have code that determines when an order has been opened or closed for each symbol, and increase or decrease the counter accordingly.
I'm also aware of the MarketPosition_at_Broker_for_The_Strategy keyword. However, this appears to return the total number of contracts held. I'm looking instead for the total number of open orders.
Are there any easier ways to count the total number of entries that are currently open for a strategy, across all charts that are running that strategy?