Symbol model represents a trading instrument (symbol) configuration in the MetaTrader 5 platform, including pricing, volume limits, swap rates, and trading sessions.
Properties
Symbol name (e.g., “EURUSD”, “GBPUSD”, “XAUUSD”)
Symbol path in the symbols tree
Base currency of the symbol (e.g., “EUR” for EURUSD)
Human-readable description of the symbol
Current spread in points
Swap calculation mode
Swap rate for long positions
Swap rate for short positions
Minimum volume (lot size) for trading
Maximum volume (lot size) for trading
Maximum volume limit for total positions
Volume step (increment) for trading
Value of one tick in the deposit currency
Minimum price change (tick size)
Contract size (e.g., 100000 for standard forex lot)
Margin calculation mode
Number of decimal places in the price quote
Array of trading session configurations (SymbolTradeSessions objects)
Example
Volume Values
Volume values in MT5 are typically represented in hundredths of a lot:1000= 0.01 lot (1 micro lot)10000= 0.10 lot (10 micro lots)100000= 1.00 lot (1 standard lot)
Digits and Precision
Thedigits field determines the price precision:
5- For most forex pairs (e.g., 1.08501)3- For JPY pairs (e.g., 150.123)2- For some metals and commodities
Methods
The Symbol model provides getter and setter methods for all properties:getName()/setName($name)- Get/set the symbol namegetPath()/setPath($path)- Get/set the symbol pathgetCurrencyBase()/setCurrencyBase($currency_base)- Get/set base currencygetDescription()/setDescription($description)- Get/set descriptiongetSpread()/setSpread($spread)- Get/set the spreadgetSwapMode()/setSwapMode($swap_mode)- Get/set swap modegetSwapLong()/setSwapLong($swap_long)- Get/set long swapgetSwapShort()/setSwapShort($swap_short)- Get/set short swapgetVolMin()/setVolMin($vol_min)- Get/set minimum volumegetVolMax()/setVolMax($vol_max)- Get/set maximum volumegetVolLimit()/setVolLimit($vol_limit)- Get/set volume limitgetVolStep()/setVolStep($vol_step)- Get/set volume stepgetTickValue()/setTickValue($tick_value)- Get/set tick valuegetTickSize()/setTickSize($tick_size)- Get/set tick sizegetContractSize()/setContractSize($contract_size)- Get/set contract sizegetCalcMode()/setCalcMode($calc_mode)- Get/set calculation modegetDigits()/setDigits($digits)- Get/set digitsgetTradeSessions()/setTradeSessions($trade_sessions)- Get/set trade sessions
Usage Example
Common Symbol Categories
- Forex - Currency pairs (e.g., EURUSD, GBPUSD)
- Metals - Precious metals (e.g., XAUUSD, XAGUSD)
- Indices - Stock indices (e.g., US30, NAS100)
- Commodities - Oil, gas, etc. (e.g., USOIL, UKOUIL)
- Crypto - Cryptocurrencies (e.g., BTCUSD, ETHUSD)