How to Calculate Lot Size for a Fixed Risk Percent in MetaTrader 5

How to Calculate Lot Size for a Fixed Risk Percent in MetaTrader 5

13 July 2026, 21:18
Amal Yuldashev
0
19

Position sizing is the one piece of risk management every trader is told to do, and most of us either eyeball it or skip it when the setup looks good. It is also the difference between a normal losing streak and a blown account. The math is not hard. The problem is that the version most people copy is subtly wrong the moment you trade anything other than a standard-lot major on a dollar account.

Here is how to size a trade by a fixed percent of your account in MT5, correctly, on any symbol.

Start from the money, not the lots

You do not start by picking a lot size. You start by deciding how much you are willing to lose on the trade, then work backwards to the lots that produce exactly that loss at your stop.

  • Risk money = account balance × risk percent
  • Lots = risk money ÷ loss per lot at your stop

That second line is where it goes wrong for most people.

The part everyone gets wrong: loss per lot

Plenty of tutorials tell you one lot loses "about ten dollars per pip." That is only true for a standard-lot major FX pair on a USD account. On gold, indices, JPY pairs, or a non-USD account it is simply not the number, and sizing off it quietly over-risks or under-risks you.

The robust way is to ask the symbol itself what a tick is worth, using two values MT5 exposes for every instrument:

  • SYMBOL_TRADE_TICK_SIZE, the smallest price increment (a tick).
  • SYMBOL_TRADE_TICK_VALUE_LOSS, what one tick is worth in your account currency for one lot, on the loss side. Use the _LOSS variant, not the plain SYMBOL_TRADE_TICK_VALUE. The generic one is the profit-side value, and since you size off your stop you want the loss side. They match on most FX pairs but differ on some instruments, and for risk the loss value is the correct one.

Count how many ticks your stop is, multiply by the value per tick, and you have the loss per lot for that exact symbol. No hardcoded pip values, no per-broker special cases.

The code

// Risk-based lot size, correct on FX, metals, indices and crypto
string sym = _Symbol;
double riskPercent = 1.0;   // risk 1% of balance

double riskMoney = AccountInfoDouble(ACCOUNT_BALANCE) * riskPercent / 100.0;
double slDist = MathAbs(entryPrice - slPrice);   // stop distance in price
double tickSize = SymbolInfoDouble(sym, SYMBOL_TRADE_TICK_SIZE);
double tickValue = SymbolInfoDouble(sym, SYMBOL_TRADE_TICK_VALUE_LOSS);   // loss side: you size off the stop

double lossPerLot = (slDist / tickSize) * tickValue;   // money lost per 1.0 lot
double lots = riskMoney / lossPerLot;

// round to the broker's volume step and clamp to its limits
double step = SymbolInfoDouble(sym, SYMBOL_VOLUME_STEP);
lots = MathFloor(lots / step) * step;   // floor, so you never exceed your risk
lots = MathMax(SymbolInfoDouble(sym, SYMBOL_VOLUME_MIN), MathMin(SymbolInfoDouble(sym, SYMBOL_VOLUME_MAX), lots));

Two details that matter. Round the volume down to the step, never up, so rounding can never push you past the risk you chose. And clamp to the broker's minimum and maximum so the order is actually valid.

A worked example

Account 5,000 USD, risking 1 percent, so 50 USD on the trade.

EURUSD, entry 1.10000, stop 1.09800. Stop distance is 0.00200. Tick size is 0.00001 and tick value is about 1 USD per lot, so the stop is 200 ticks and the loss per lot is 200 USD. Lots = 50 ÷ 200 = 0.25. A quarter lot with a 20 pip stop risks 50 USD, exactly on target.

Now the same account and risk on gold, entry 2400.00, stop 2397.00, a 3.00 stop. Tick size 0.01, tick value about 1 USD per lot, so 300 ticks and 300 USD per lot. Lots = 50 ÷ 300 = 0.16 after rounding down, which risks about 48 USD. If you had reached for "ten dollars per pip" here you would have been nowhere near right. The tick-value method just works, and you never had to know the contract size.

The honest caveats

  • For cross pairs where neither currency is your account currency, the per-tick value drifts slightly with price, so treat the number as right at the moment you size, not to the last cent at the close. If you want the broker's own exact figure, OrderCalcProfit() does the currency conversion for you and is the most reliable source on gold, indices and non-USD accounts.
  • Commission and slippage add a little to real risk. If you run tight stops, subtract a few points of buffer.
  • If the account is too small to take your chosen risk at that stop, the minimum lot will risk more than you wanted. Do not trade it blind. Either skip the trade or accept the higher risk knowingly.

If you would rather not do this by hand

If you do not want to wire this into every EA or run the numbers on every setup, I built a free MT5 tool that does exactly the above on the chart. Drag three lines to your entry, stop and target, and it reads out the lot size for the risk percent you pick, respecting your broker's step and limits, on any symbol. It is the Visual Risk and Position Size Calculator, it is free, and it is only a calculator: no signals, no repaint, nothing traded on your behalf. If it saves you one mis-sized trade, an honest review helps the next trader find it.