π Get Volume Limits (Min/Max/Step)ΒΆ
Helper method: retrieves symbol's volume limits - minimum, maximum, and step size. Essential for volume validation.
API Information:
- Sugar method:
MT5Sugar.getVolumeLimits(String symbol) - Returns:
double[3]- Array with [min, max, step] - Underlying:
symbolInfoDouble()calls for VOLUME_MIN, VOLUME_MAX, VOLUME_STEP
π½ InputΒΆ
| Parameter | Type | Required | Description |
|---|---|---|---|
symbol |
String |
β | Symbol name (e.g., "EURUSD") |
β¬οΈ OutputΒΆ
Returns: double[3] - Array: [volumeMin, volumeMax, volumeStep]
Throws: ApiExceptionMT5 if request fails
π Usage ExampleΒΆ
String symbol = "EURUSD";
double[] limits = sugar.getVolumeLimits(symbol);
System.out.printf("%s volume limits:%n", symbol);
System.out.printf(" Min: %.2f lots%n", limits[0]);
System.out.printf(" Max: %.2f lots%n", limits[1]);
System.out.printf(" Step: %.2f lots%n", limits[2]);
// Output:
// EURUSD volume limits:
// Min: 0.01 lots
// Max: 100.00 lots
// Step: 0.01 lots
See alsoΒΆ
- Normalize volume:
normalizeVolume()