Skip to main content
The Account model represents a trading account in the MetaTrader 5 platform, containing balance, equity, margin, and other account-related information.

Properties

login
int
required
The account login number (unique identifier for the trading account)
balance
float
Current account balance
profit
float
Current profit on open positions
blocked_profit
float
Profit that is blocked (reserved)
blocked_commission
float
Commission that is blocked (reserved)
leverage
float
Account leverage ratio (e.g., 100 for 1:100 leverage)
volume
float
Total volume of open positions
equity
float
Account equity (balance + profit)
margin
float
Margin used by open positions
margin_free
float
Free margin available for trading
margin_level
float
Margin level percentage (equity/margin * 100)

Example

{
  "login": 12345678,
  "balance": 10000.00,
  "profit": 250.50,
  "blocked_profit": 0.00,
  "blocked_commission": 0.00,
  "leverage": 100,
  "volume": 2.5,
  "equity": 10250.50,
  "margin": 500.00,
  "margin_free": 9750.50,
  "margin_level": 2050.10
}

Methods

The Account model provides getter and setter methods for all properties:
  • getLogin() / setLogin($login) - Get/set the account login
  • getBalance() / setBalance($balance) - Get/set the account balance
  • getProfit() / setProfit($profit) - Get/set the current profit
  • getBlockedProfit() / setBlockedProfit($blocked_profit) - Get/set blocked profit
  • getBlockedCommission() / setBlockedCommission($blocked_commission) - Get/set blocked commission
  • getLeverage() / setLeverage($leverage) - Get/set the leverage
  • getVolume() / setVolume($volume) - Get/set the total volume
  • getEquity() / setEquity($equity) - Get/set the equity
  • getMargin() / setMargin($margin) - Get/set the used margin
  • getMarginFree() / setMarginFree($margin_free) - Get/set the free margin
  • getMarginLevel() / setMarginLevel($margin_level) - Get/set the margin level

Usage Example

use D4T\MT5Sdk\Models\Account;

// Create an account instance
$account = new Account([
    'login' => 12345678,
    'balance' => 10000.00,
    'profit' => 250.50,
    'leverage' => 100
]);

// Access properties
$login = $account->getLogin();
$equity = $account->getEquity();
$marginLevel = $account->getMarginLevel();

// Update properties
$account->setBalance(15000.00);
$account->setProfit(500.00);

Build docs developers (and LLMs) love