

A lot size can look mathematically precise and still be unacceptable to a broker. In MQL4, volume must satisfy the instrument’s minimum, maximum and permitted increment. Rounding a calculated position to two decimal places does not establish that it meets those requirements.
For automated mt4 trading, incorrect lot normalization can produce rejected orders or, more seriously, valid orders that exceed the intended risk. The causes usually sit between a sizing formula and the volume finally passed to OrderSend().
Treating Decimal Places as the Lot Step
NormalizeDouble(lots, 2) rounds to hundredths. It does not guarantee that the result lies on the broker’s permitted volume grid. An instrument with MODE_LOTSTEP of 0.25 accepts 0.25, 0.50 and 0.75 lots, but not 0.60, however neatly formatted.
A script should retrieve MODE_LOTSTEP and quantize the calculated volume to an allowed increment, accounting for the minimum lot. The final value needs a separate validity check; decimal formatting is not a substitute for contract rules.
Rounding Up When the Formula Sets a Risk Ceiling
Imagine a hypothetical cocoa CFD for which one lot represents 10 metric tons and volume increases in steps of 0.1 lot. A strategy buys at $7,200 per ton with a stop at $7,050, a $150 difference. Each full lot therefore risks $1,500 before slippage and charges.
With a $420 risk allowance, the raw calculation produces 0.28 lot. Rounding to the nearest permitted increment gives 0.3 lot, risking $450, or $30 above the limit. Rounding down to 0.2 lot risks $300. The smaller position leaves part of the allowance unused, but preserves its purpose. A chart showing a $150 stop distance cannot reveal the excess created by rounding direction.
Clamping Small Volumes to the Broker Minimum
A common script pattern replaces every calculated size below MODE_MINLOT with the minimum permitted volume. That converts a risk-based calculation into a forced trade. If the account can afford only 0.03 lot under its stop-loss model but the minimum is 0.10, submitting 0.10 more than triples the intended exposure.
The correct outcome may be no order at all. A minimum lot is an eligibility threshold, not a recommendation to enlarge a position. Developers should compare the minimum’s potential loss with the account’s risk limit before permitting execution.
Reusing Volume Rules From Another Symbol
Lot specifications are instrument-specific. An EA that reads the active chart’s MODE_LOTSTEP while sending an order for another symbol can normalize against the wrong grid. Differences are especially consequential when switching between currency pairs, equity CFDs and commodities.
In mt4 trading scripts handling multiple markets, retrieve MODE_MINLOT, MODE_MAXLOT and MODE_LOTSTEP for the exact symbol submitted to OrderSend(). Recheck those properties when broker specifications change rather than treating initialization-time values as permanent.
Ignoring Volume Limits After Partial Position Reductions
A requested partial close must also satisfy volume rules. Normalizing only the quantity being closed can leave a residual position below the broker’s permitted minimum, causing the operation to fail. Conversely, rounding the closure upward may eliminate more exposure than intended.
Before opening a CFD position, test the sizing routine against the broker’s live symbol specifications using values just below and above each lot increment. Confirm the resulting volume, estimated stop-loss amount and possible residual position, and reject the order whenever a valid size would breach the defined risk ceiling.