Position Size From the Stop, Not From a Gut Feeling: The Lot Formula That Survives Gold
Most position-sizing mistakes are not about the risk percentage. They are about the arithmetic: a lot size copied from a forum, a pip value assumed instead of read from the symbol, a result rounded up because it looked cleaner. On gold, where one broker quotes two decimals and another three, that arithmetic breaks quietly.
The rule is simple: the size of the trade is decided by the stop, never the other way round. You choose how much you are willing to lose, you find where the trade is proven wrong, and the lot size is whatever fits between the two.
Step 1: read the symbol, don't assume it
The money lost per lot for a given stop distance is: (stop distance in price / tick size) × tick value. Both numbers come from the broker's symbol specification, so read them at runtime instead of hard-coding a pip value.
Step 2: round DOWN, and refuse when you can't
Lots must fit the volume step of the symbol. Rounding to the nearest step can push your real risk above what you decided. Always round down. If the result is below the minimum lot, the honest answer is "this trade is too small for this account at this stop" — not a forced minimum lot with double the intended risk.
double LotFromRisk(double riskMoney, double stopDistancePrice) { double tickSize = SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_SIZE); double tickValue = SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_VALUE_LOSS); double step = SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_STEP); double minLot = SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MIN); double maxLot = SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MAX); if(tickSize <= 0 || tickValue <= 0 || step <= 0 || stopDistancePrice <= 0) return 0.0; // bad data: do not trade double lossPerLot = stopDistancePrice / tickSize * tickValue; double lots = MathFloor(riskMoney / lossPerLot / step) * step; // round DOWN if(lots < minLot) return 0.0; // too small: refuse, do not force minLot return MathMin(lots, maxLot); }
Step 3: the traps that cost real money
Points and pips are not the same thing, especially on gold and on 3- and 5-digit symbols: always work in price distance and let tick size do the conversion. Use SYMBOL_TRADE_TICK_VALUE_LOSS for the stop-loss side, because it can differ from the profit-side value on cross pairs. And send the stop with the order itself: a stop added afterwards leaves a window where the size you calculated protects nothing.
Why it matters
A position size that ignores the stop is a guess about risk. A size derived from the stop is a decision. The difference does not show up on a winning day; it shows up on the day the stop is hit and the loss is exactly the number you agreed to before entering.
The same rule is what I used when building ATS Lot Sizer for MT5 — happy to answer questions about the edge cases in the comments.


