In my experience, the lower value for max open positions will apply, irrespective if it is in the code or the analysis settings.
By sheer coincidence, I actually leave my Analysis settings Max Open Positions set to 25 and just rely on the afl (where it is set anywhere from 5 to 20 depending on the strategy).
What you have set in the FORMULA (SetOption) takes precedence over the settings.
This applies to everything.
No, that is not the case. Code always has precedence. If code says 20 max open positions, it will open 20 positions, regardless if you have less in the settings dialog.