Skip to main content
The Order model represents a trading order in the MetaTrader 5 platform.

Properties

symbol
string
Trading symbol for the order (e.g., “EURUSD”, “GBPUSD”)
type
int
Order type (numeric value)
type_str
string
Order type as a human-readable string
profit
float
Current profit/loss on the order

Example

{
  "symbol": "EURUSD",
  "type": 0,
  "type_str": "buy",
  "profit": 125.50
}

Order Types

The type field represents different order types in MT5. Common values include:
ValueDescription
0Buy
1Sell
2Buy Limit
3Sell Limit
4Buy Stop
5Sell Stop

Methods

The Order model provides getter and setter methods for all properties:
  • getSymbol() / setSymbol($symbol) - Get/set the trading symbol
  • getType() / setType($type) - Get/set the order type (numeric)
  • getTypeStr() / setTypeStr($type_str) - Get/set the order type (string)
  • getProfit() / setProfit($profit) - Get/set the current profit

Usage Example

use D4T\MT5Sdk\Models\Order;

// Create an order instance
$order = new Order([
    'symbol' => 'EURUSD',
    'type' => 0,
    'type_str' => 'buy',
    'profit' => 125.50
]);

// Access properties
$symbol = $order->getSymbol();
$type = $order->getType();
$profit = $order->getProfit();

// Update properties
$order->setProfit(150.00);
$order->setTypeStr('sell');

Build docs developers (and LLMs) love