Thanks Andrew - would you please provide an example of how this would be done, I am not very comfortable using global variables.
Unfortunately this goes beyond free level of support we provide in regards to scripting questions.
It was my understanding that global variables didn't work in backtesting.
Your understanding is correct. But due to the sequence of calculations in Portfolio Backtester, it is the exception, GV will work there.
I'm sure this will be a good reference for others who have a similar issue in the future. It seems logical that there would be some kind of key word that would limit further entries - like if portfolio_currententries = portfolio_maxentries then trade=false.
Please leave us such
feature request.
Furthermore - not having a limiting functionality means that entries are made when there is not enough cash/margin in the account to fund them. They should automatically be rejected if there is not enough cash/margin, shouldn't they?
They should, but this is something that is limited by
Portfolio Settings, not by your code in this case.