Convert to Quantity
The Convert to Quantity rule converts a decimal number into a properly formatted quantity (lot size) value for a specific financial instrument. This ensures that your calculated position sizes conform to the instrument's minimum lot size, lot step, and maximum lot constraints before being sent to the broker.
How It Works
Every financial instrument has specific lot size requirements defined by the broker, including a minimum quantity, a maximum quantity, and a step increment. The Convert to Quantity rule takes a raw decimal number representing a desired position size and formats it into a valid quantity that meets these requirements. The value is adjusted to the nearest valid step and clamped within the allowed range.
This is a critical step in any position sizing pipeline. If you calculate lot size using a Simple Calculator or other arithmetic rules, the result may not align with the broker's requirements. For example, you might calculate 1.237 lots, but the instrument only allows increments of 0.01 lots. Convert to Quantity handles this adjustment automatically, rounding down to avoid exceeding your intended risk.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
| Decimal Number (Qty) | Number | Yes | The raw decimal number representing the desired position size or lot count to convert. |
| Symbol | Symbol | Yes | The financial instrument whose lot size requirements are used for the conversion (e.g., EURUSD, AAPL, BTCUSD). |
Outputs
| Output | Type | Description |
|---|---|---|
| Quantity | Quantity | The formatted quantity value that conforms to the instrument's lot size requirements (minimum, maximum, and step increment). |
Tips
Always place Convert to Quantity as the final step in your position sizing pipeline, just before the output connects to an order rule. This ensures that all your arithmetic calculations are performed at full precision, and only the final result is rounded to a valid lot size. Rounding too early in the pipeline can compound small errors across multiple calculation steps and lead to unexpected position sizes.
Was this helpful? Let us know