QuantKit
Menu
Illustration: stacked translucent glass layers above a measuring caliper, on a dark field
Home / Guides / Review & research

Guides / Research

How do you calculate position size for forex and CFDs?

Guide By Timoranjes 8 min read

Editorial layout updated 17 November 2026 · Source-check dates remain stated in the article.

Marked Referral links may earn QuantKit a commission. How we’re paid. Payment does not determine our findings.

On this pageShort answerKey facts at a glanceWhy does position size come before the entry?How should you choose risk per trade?Where does the stop-loss go?Worked examples: calculating lot sizeHow do you include trading costs in position sizing?How should you handle rounding, minimum lots, and MQL5 code?How does sizing change under prop-firm rules?What we couldn't confirmWhat should you do next?FAQSources and methodRelated research

Short answer

Pick your risk per trade first (commonly 0.5%–1% of equity), place the stop where the trade idea is wrong, and size the position with lots = risk amount ÷ (stop distance × value per pip per lot) so a stop-out stays within that budget before gaps and unmodelled slippage. Always add round-turn costs to the loss per lot, round lots down to the broker's volume step, and size backwards from a prop firm's daily loss limit rather than account balance alone.

Key facts at a glance

  • Core formula: lots = risk amount ÷ (stop distance in pips × pip value per lot) — or include costs directly: lots = risk amount ÷ (stop × pip value + round-turn cost per lot).
  • Rounding rule: Always round down to the symbol's volume step (often 0.01 lots); skip trades where the calculated size falls below the minimum lot.
  • Equity vs balance: Sizing on equity (or balance minus open risk) accounts for floating losses when an EA holds multiple positions at once.
  • Prop-challenge adjustment: Surviving four full losses inside a 5% daily limit requires keeping risk per trade under 1.25% (under 0.75% for a 3% daily limit), minus a buffer for costs and slippage.

Why does position size come before the entry?

A good entry with oversized risk can still blow an account, while a modest edge with small, fixed risk usually survives long enough to test whether the strategy works. For automated strategies, the stakes are sharper: an EA repeats its sizing logic on every trade for months, so an oversized risk percentage or rounding bug is not one mistake — it is the same mistake repeated hundreds of times.

How should you choose risk per trade?

Risk per trade is the share of equity you accept losing if the stop is hit, chosen before looking at a chart. Many retail traders use 0.5%–1% per trade as a convention, not a rule. What matters is what a normal losing streak does to the account (compounded arithmetic: equity left = (1 − risk)^10):

Risk per trade Equity left after 10 straight losses Gain needed to get back to start
0.5% ≈ 95.1% ≈ +5.1%
1% ≈ 90.4% ≈ +10.6%
2% ≈ 81.7% ≈ +22.4%
5% ≈ 59.9% ≈ +67.0%

Arithmetic illustration only; not a forecast of how often losing streaks occur.

Check your backtest's longest losing streak first — and if you have not verified the report, see How to audit an MT5 backtest.

Balance or equity? Fixed-fractional sizing on equity automatically shrinks new positions while open trades are underwater. Sizing on balance ignores floating losses, which can stack risk rapidly in multi-position EAs.

Where does the stop-loss go?

Place the stop at the price that invalidates the trade idea (beyond a structural level, range boundary, or ATR multiple), not where the dollar loss looks comfortable. If the stop distance is wide, keep the stop and shrink the lot size — never pull the stop tighter to keep a preferred lot size.

Worked examples: calculating lot size

Example 1: EUR/USD (illustrative figures only)

  • Account equity: $10,000
  • Risk per trade: 1% = $100
  • Stop distance: 25 pips
  • Pip value: about $10 per pip per standard lot (USD-quoted pair, USD account)

$100 ÷ (25 × $10) = 0.40 lots

Example 2: USD/JPY (illustrative figures only)

When the quote currency differs from your account currency, pip value changes. For USD/JPY, one pip on one standard lot is 1,000 JPY — roughly $6.67 at an illustrative rate of 150.00.

$100 ÷ (25 × $6.67) ≈ 0.60 lots

Same risk, same stop distance, different lot size. Trading a fixed "0.5 lots" across symbols is not a risk rule; it is a different bet on every instrument. For gold, indices, and other CFDs, contract sizes vary by broker — always read contract size, tick size, and tick value in MT5 (Market Watch → right-click → Specification).

How do you include trading costs in position sizing?

On a raw-spread account, hitting your stop also incurs commission and spread. On 0.40 lots at a $7 round-turn commission, commission adds $2.80, turning a $100 planned risk into $102.80 before slippage — a systematic 2%–3% overshoot on tight-stop strategies.

Because commission scales with lot size, add round-turn cost per lot to the divisor:

lots = risk ÷ (stop × pip value + cost per lot)
Example: $100 ÷ (25 × $10 + $7) ≈ 0.389, rounded down to 0.38 lots.

Check measured broker costs in QuantKit's CFD broker cost study, model a full trade (including overnight funding) in the free CFD all-in cost calculator, and account for overnight financing on multi-day holds (Forex swap and overnight costs). Remember that a stop is an order, not a guarantee: price gaps can fill beyond it.

How should you handle rounding, minimum lots, and MQL5 code?

Brokers trade in volume steps (often 0.01 lots). Always round down to the step; rounding up silently exceeds your chosen risk. If the calculated size is below the minimum lot, skip the trade at that stop distance rather than forcing the minimum lot.

Illustrative MQL5 lot-size function

This minimal example sizes from equity, a risk percentage, a stop distance in price units, and an optional round-turn cost per lot, rounding down to the broker's volume step. This code is illustrative: QuantKit has not compile-tested it in MetaEditor or run it against a broker. Compile and test it on a demo account before relying on it.

// ILLUSTRATIVE ONLY: compile and test on a demo account before use.
// Returns lots so that a stop-out costs no more than riskPercent of equity,
// including an optional round-turn cost per lot (e.g. commission) in account
// currency. Returns 0.0 on any invalid input or metadata, or when even the
// minimum lot would exceed the budget. Excludes swap, slippage and gaps.
double LotsForRisk(const double riskPercent,
                   const double stopDistance,             // price units, > 0
                   const double costPerLotRoundTurn = 0.0) // account currency, >= 0
{
   // Validate inputs
   if(!MathIsValidNumber(riskPercent)  || riskPercent <= 0.0 || riskPercent > 100.0) return 0.0;
   if(!MathIsValidNumber(stopDistance) || stopDistance <= 0.0)                       return 0.0;
   if(!MathIsValidNumber(costPerLotRoundTurn) || costPerLotRoundTurn < 0.0)          return 0.0;

double equity = AccountInfoDouble(ACCOUNT_EQUITY); if(!MathIsValidNumber(equity) || equity <= 0.0) return 0.0; double riskMoney = equity * riskPercent / 100.0; if(!MathIsValidNumber(riskMoney) || riskMoney <= 0.0) return 0.0;

// Read symbol metadata and check that every call succeeded double tickValue, tickSize, step, minLot, maxLot; if(!SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_VALUE_LOSS, tickValue) || !SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_SIZE, tickSize) || !SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_STEP, step) || !SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MIN, minLot) || !SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MAX, maxLot)) return 0.0; if(!MathIsValidNumber(tickValue) || tickValue <= 0.0 || !MathIsValidNumber(tickSize) || tickSize <= 0.0 || !MathIsValidNumber(step) || step <= 0.0 || !MathIsValidNumber(minLot) || minLot <= 0.0 || !MathIsValidNumber(maxLot) || maxLot < minLot) return 0.0;

// Loss per lot at the stop, plus per-lot round-turn cost double lossPerLot = (stopDistance / tickSize) * tickValue + costPerLotRoundTurn; if(!MathIsValidNumber(lossPerLot) || lossPerLot <= 0.0) return 0.0;

double lots = riskMoney / lossPerLot; if(!MathIsValidNumber(lots) || lots <= 0.0) return 0.0;

// Cap, then round DOWN to the volume step (never up) lots = MathMin(lots, maxLot); lots = MathFloor(lots / step) * step; lots = NormalizeDouble(lots, 8);

// Guard against floating-point rounding pushing the loss over budget if(lots * lossPerLot > riskMoney) lots = NormalizeDouble(lots - step, 8); if(lots < minLot) return 0.0; // minimum lot exceeds the budget return lots; }

Code notes: SYMBOL_TRADE_TICK_VALUE_LOSS uses the loss-side conversion rate (important on cross pairs) under current market conditions. Pass commission as costPerLotRoundTurn (e.g., 7.0 for $3.50/side); minimum ticket charges, swap, slippage, gaps, existing open exposure, margin, and aggregate broker volume limits are not included. For non-linear instruments, consider OrderCalcProfit in a dedicated function tested on demo.

How does sizing change under prop-firm rules?

A prop evaluation adds a stricter budget — the firm's daily loss limit and maximum loss. Size backwards from the daily limit: surviving four full losses in a day requires staying under 1.25% per trade on a 5% daily limit, or under 0.75% on a 3% daily limit, minus a buffer for costs and slippage.

Three details tighten the arithmetic further: floating losses count immediately on equity-based daily limits; correlated positions (such as long EUR/USD, long GBP/USD, and short USD/CHF at 1% each) act like one larger bet; and trailing maximum loss reduces remaining room as gains accrue.

See How prop-firm challenges work, QuantKit's FTMO review, and Funded Trading Plus review for dated firm limits. QuantKit's Trade Manager Prop Risk tracks daily drawdown against a prop limit and stops new risk when triggered (waitlist only; no tool makes you pass).

What we couldn't confirm

  • Broker-specific tick values, contract sizes, minimum lot sizes, and margin rules vary by symbol and entity; always read them from your live platform specification.
  • The illustrative MQL5 snippet above has not been compile-tested in MetaEditor or executed on a broker server.

What should you do next?

Model your planned trade's spread, commission, and financing in the free CFD all-in cost calculator, then check whether your EA's historical trade list survives prop-firm drawdown rules using Prop challenge risk: validate the EA backtest.

FAQ

What is a good risk per trade?

There is no single universal percentage. Many retail traders use 0.5%–1% of equity per trade because a normal losing streak leaves the account intact. Check your strategy's longest historical losing streak and any prop-firm daily loss limit, then pick a risk level that survives both.

How do I calculate lot size in forex?

Use lots = risk amount ÷ (stop distance in pips × pip value per lot). For example, $100 risk with a 25-pip stop and $10 per pip per lot gives 0.40 lots. Always read pip or tick value from your broker's symbol specification because it varies by quote currency and account currency.

Should I size on balance or equity?

Sizing on equity is safer whenever multiple trades can be open simultaneously, because it accounts for floating losses. Sizing on balance ignores open drawdown and treats each new entry as if no other risk were live.

Does position sizing include spread and commission?

The basic formula excludes trading costs. To include them, add the round-turn cost per lot to the divisor: lots = risk ÷ (stop × pip value + cost per lot). On tight-stop strategies, omitting commission can cause a 2%–3% overshoot on every stopped trade.

What if the calculated lot size is below the minimum lot?

Skip the trade at that stop distance, or use a smaller contract/account where the minimum lot fits your budget. Trading the minimum lot anyway breaks your risk rule and increases loss per trade above plan.

How does position sizing change in a prop-firm challenge?

Size backwards from the firm's daily loss limit rather than the notional account balance. Leave room for several losses in one session, group correlated positions together, and account for equity-based daily checks and trailing maximum loss floors.

Sources and method

About the author — Timoranjes

Quantitative researcher in Hong Kong publishing under a pseudonym. Every QuantKit cost figure, rule table, and audit guide lists its source, fetch date, and arithmetic so you can verify it independently. Mistakes are logged publicly in the corrections log.

Public profiles & contact: About · Methodology · GitHub · Glama MCP · Whop store · [email protected]

Disclosure: QuantKit sells its own tools and may earn a disclosed commission from marked Referral links listed on /disclosure/. This article contains no Referral links. Cost figures and wording are not adjusted for partners.

Risk warning: Trading forex and CFDs on margin carries a high risk of loss, and prices can gap past a stop-loss. All figures and code on this page are illustrations only, not recommendations or forecasts. Past performance is not indicative of future results. This is not financial advice.