MaxOpenPositions is a MAXIMUM number of positions EVER needed during entire backtest. It is not "current" number of positions. It is scalar number. Global backtester setting. The limit. It is like "c" (speed of light). Absolute limit. It does not change "bar by bar".
To limit number of positions based on equity you should just use fixed amount for position size.
// that would give you 5 positions when equity is 5000 and 10 if equity is 10000
PositionSize = 1000;