Dynamic Lot Sizing for Prop Firm EAs: Formula and Examples
Position size is the decision that weighs most on an account's outcome and the one that gets the least attention. A fixed-lot EA risks more on wide-stop trades and less on tight-stop trades for no reason. Dynamic sizing fixes that: every trade risks the same share of the account, whatever the stop distance.
The formula
Lots = (capital × risk %) ÷ (stop distance × value per point per lot)
In MQL5 the point value is not hard-coded: it comes from the symbol through SYMBOL_TRADE_TICK_VALUE and SYMBOL_TRADE_TICK_SIZE, because it changes with the pair, the account currency and, on crosses, the price itself.
Example 1: EURUSD
A 100,000 USD account, 0.5% risk (500 USD) and a 25-pip stop. On EURUSD one pip on 1 lot is worth about 10 USD, so each lot risks 250 USD on that stop: 500 ÷ 250 = 2.00 lots.
Example 2: XAUUSD
Same 500 USD risk and an 8 USD stop on the gold price. With a common 100-ounce contract, each lot loses 800 USD on that stop: 500 ÷ 800 = 0.625 lots. The broker only accepts multiples of its volume step (usually 0.01), so you must round down to 0.62. Rounding up looks harmless, but repeated over hundreds of trades it pushes real risk above the configured level. Always check your broker's contract size: not all of them use 100 ounces.
Caps the EA must respect
- Symbol minimum and maximum lot (
SYMBOL_VOLUME_MIN,SYMBOL_VOLUME_MAX) and volume step (SYMBOL_VOLUME_STEP). - Its own lot cap, in case an abnormally tight stop blows up the calculation.
- Total exposure: if the EA can hold several positions at once, the risk that counts is the sum of all of them.
- Free margin: the order must not leave the account on the edge of a margin call.
How long the account survives a streak
Long losing streaks are not rare: with a 45% win rate, over 500 trades the probability of at least 8 losses in a row is about 85%, and of 10 in a row about 43% (our own simulation with independent trades). Here is the account with a fixed risk per trade:
| Consecutive stops | 1% risk | 0.5% risk |
|---|---|---|
| 5 | −4.9% | −2.5% |
| 10 | −9.6% | −4.9% |
| 15 | −14.0% | −7.2% |
| 20 | −18.2% | −9.5% |
With a 10% overall loss limit, 1% risk leaves room for about ten losses in a row; 0.5%, for about twenty. That is the calculation to make before choosing your risk, not after.
A buffer for the daily limit
If the prop firm cuts you off at 5% daily, do not set the EA to stop exactly at 5%: slippage and open positions can take you past it. A common buffer is to pause trading at a 3–3.5% daily loss. We cover this in the guide to passing an FTMO challenge with an EA.
Frequently asked questions
What risk per trade is reasonable in a challenge?
Many traders use between 0.25% and 1%. The closer the daily loss limit, the lower it should be.
Should risk be based on balance or equity?
Using the lower of the two is the most prudent choice, because prop firm limits are usually measured on equity.
Why does my EA open a different lot than calculated?
Because of the broker's volume step, minimum and maximum lot, available margin, or a lot cap inside the EA.
The lot you request is not always the lot you get. Between the EA's calculation, the risk multiplier, broker volume-step rounding and margin limits you can end up with three different numbers, and the per-symbol exposure cap is one of the rules EAs break most by accident. Details and a nine-step self-audit in Prop firm rules your EA breaks without meaning to.
If your sizing depends on avoiding news, here is this week's economic calendar.