Margin is not just depends on the leverage, it's also depend on the lot size, symbol and broker. So you should try OrderCalcMargin(). However, this function may not 100% fit your strategy because it requires lot size as an input.
I think it's more meaningful when risk mgt based on stop lot level not margin, then calculate the lot size.

Margin is not just depends on the leverage, it's also depend on the lot size, symbol and broker. So you should try OrderCalcMargin(). However, this function may not 100% fit your strategy because it requires lot size as an input.
I think it's more meaningful when risk mgt based on stop lot level not margin, then calculate the lot size.
Thanks for your input Nguyen. I'll have a look at OrderCalcMargin() function. I need to know what lot size I can buy of an instrument/pair/commodity for 1% of the current account balance I hope that explains it better.
Thanks for your input Nguyen. I'll have a look at OrderCalcMargin() function. I need to know what lot size I can buy of an instrument/pair/commodity for 1% of the current account balance I hope that explains it better.
You're welcome. I understand your idea. However, this may cause a problem in some cases. For example:
- Your 1% = $100, 1 lot size requires $200 margin => You decide to reduce lot size to 0.5 and expect that it costs $100 => 0.5 just requires $50 of margin (because margin based on size) => Circling constraints problem.
- Some symbols may require $0 margin at all sizes => 1% account = unlimited lot size.
Anyway, this one may more complex than you think. For more details, you can see the symbol properties, it usually has a table of margin required for lot size ranges.
You're welcome. I understand your idea. However, this may cause a problem in some cases. For example:
- Your 1% = $100, 1 lot size requires $200 margin => You decide to reduce lot size to 0.5 and expect that it costs $100 => 0.5 just requires $50 of margin (because margin based on size) => Circling constraints problem.
- Some symbols may require $0 margin at all sizes => 1% account = unlimited lot size.
Anyway, this one may more complex than you think. For more details, you can see the symbol properties, it usually has a table of margin required for lot size ranges.
Yeah I was just looking at the tables.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi everyone, I'm looking for a lot size that will be result in margin used equal to 1% of account balance across the different instruments
I'm looking for a lot size calculation that will "normalise" any forex pair/commodity/crypto to use a margin equal to 1% of my account balance per trade (no stop loss or take profit). Basically have "margin used" determine my lot size for my EA, margin used must be 1% of account balance regardless of which instrument is being traded. I have functions to pull each variable but I'm having trouble putting them together. I just need a few examples of how to calculate it. I think I'm over-thinking it.
I've used the below links as help but to no avail.
https://forums.babypips.com/t/mt4-market-watch-contract-specification-margin-percentage/131161/4
https://www.mql5.com/en/forum/425460
https://www.mql5.com/en/docs/constants/environment_state/marketinfoconstants
Account balance: $100,000
Deposit/account currency: AUD
Leverage 30:1
Example 1 calc: EURCAD
Example 2 calc: AUDUSD
Example 3 calc: Wheat
Example 4 calc: XAGEUR
Example 5 calc: XAGAUD
My dodgy calc that I'm currently using which is completely incorrect but gives a ball park lot size that's manageable
Lot=MathFloor(((((Bal*0.01)/0.033)/MarginPerLot)/10)/2/Step)*Step;
Working data from broker in images below