Setting up margin in the formula

I've been trying to learn AFL for a few months now. I am no expert. I came across a problem with margin set up in my code.

First I ran a backtest with no margin using "Position size = -100/MaxOpenPositions"
I got results.
After that I decided to run the backtest again with 100% margin so I changed to: "Position size = -200/MaxOpenPositions"
Is that the right set up for a 100% margin?
I am not sure, because I got strange results. During the backtest, different stocks were bought by the system when compared to the first backtest with no margin. How can margin affect what stocks will be bought?

Please help me clarify this problem. I was trying to find an answer everywhere but with no success.

Thank you.

If you are using margin account you need to say it so in the settings. Analysis->Settings, "General" tab, Account margin: 50 (default is 100 which means no margin account)