BBSTRADER 2.4.0
Loading...
Searching...
No Matches
objects.hpp
Go to the documentation of this file.
1
5
6#pragma once
7
8#include <pybind11/numpy.h>
9
10#include <concepts>
11#include <string>
12#include <type_traits>
13#include <vector>
14
17namespace MT5 {
18
20enum class Timeframe : int32_t {
21 M1 = 1,
22 M2 = 2,
23 M3 = 3,
24 M4 = 4,
25 M5 = 5,
26 M6 = 6,
27 M10 = 10,
28 M12 = 12,
29 M15 = 15,
30 M20 = 20,
31 M30 = 30,
32 H1 = 1 | 0x4000,
33 H2 = 2 | 0x4000,
34 H3 = 3 | 0x4000,
35 H4 = 4 | 0x4000,
36 H6 = 6 | 0x4000,
37 H8 = 8 | 0x4000,
38 H12 = 12 | 0x4000,
39 D1 = 24 | 0x4000,
40 W1 = 1 | 0x8000,
41 MN1 = 1 | 0xC000
42};
43
45enum class OrderType : int32_t {
46 BUY = 0,
47 SELL = 1,
48 BUY_LIMIT = 2,
49 SELL_LIMIT = 3,
50 BUY_STOP = 4,
51 SELL_STOP = 5,
52 BUY_STOP_LIMIT = 6,
53 SELL_STOP_LIMIT = 7,
54 CLOSE_BY = 8
55};
56
58enum class OrderState : int32_t {
59 STARTED = 0,
60 PLACED = 1,
61 CANCELED = 2,
62 PARTIAL = 3,
63 FILLED = 4,
64 REJECTED = 5,
65 EXPIRED = 6,
66 REQUEST_ADD = 7,
67 REQUEST_MODIFY = 8,
69};
70
72enum class OrderFilling : int32_t {
73 FOK = 0,
74 IOC = 1,
75 RETURN = 2,
76 BOC = 3 // Book Or Cancel
77};
78
80enum class OrderReason : int32_t {
81 CLIENT = 0,
82 MOBILE = 1,
83 WEB = 2,
84 EXPERT = 3,
85 SL = 4,
86 TP = 5,
87 SO = 6
88};
89
91enum class DealType : int32_t {
92 BUY = 0,
93 SELL = 1,
94 BALANCE = 2,
95 CREDIT = 3,
96 CHARGE = 4,
97 CORRECTION = 5,
98 BONUS = 6,
99 COMMISSION = 7,
100 COMMISSION_DAILY = 8,
104 INTEREST = 12,
105 BUY_CANCELED = 13,
106 SELL_CANCELED = 14,
107 DIVIDEND = 15,
108 DIVIDEND_FRANKED = 16,
109 TAX = 17
110};
111
113enum class DealReason : int32_t {
114 CLIENT = 0,
115 MOBILE = 1,
116 WEB = 2,
117 EXPERT = 3,
118 SL = 4,
119 TP = 5,
120 SO = 6,
121 ROLLOVER = 7,
122 VMARGIN = 8,
123 SPLIT = 9
124};
125
127enum class TradeAction : int32_t {
128 DEAL = 1,
129 PENDING = 5,
130 SLTP = 6,
131 MODIFY = 7,
132 REMOVE = 8,
133 CLOSE_BY = 10
134};
135
137enum class SymbolCalcMode : int32_t {
138 FOREX = 0,
139 FUTURES = 1,
140 CFD = 2,
141 CFDINDEX = 3,
142 CFDLEVERAGE = 4,
144 EXCH_STOCKS = 32,
145 EXCH_FUTURES = 33,
146 EXCH_OPTIONS = 34,
148 EXCH_BONDS = 37,
149 EXCH_STOCKS_MOEX = 38,
150 EXCH_BONDS_MOEX = 39,
151 SERV_COLLATERAL = 64
152};
153
155enum class SymbolTradeMode : int32_t {
156 DISABLED = 0,
157 LONGONLY = 1,
158 SHORTONLY = 2,
159 CLOSEONLY = 3,
160 FULL = 4
161};
162
164enum class SymbolSwapMode : int32_t {
165 DISABLED = 0,
166 POINTS = 1,
167 CURRENCY_SYMBOL = 2,
168 CURRENCY_MARGIN = 3,
169 CURRENCY_DEPOSIT = 4,
170 INTEREST_CURRENT = 5,
171 INTEREST_OPEN = 6,
172 REOPEN_CURRENT = 7,
173 REOPEN_BID = 8
174};
175
177enum class DayOfWeek : int32_t {
178 SUNDAY = 0,
179 MONDAY = 1,
180 TUESDAY = 2,
181 WEDNESDAY = 3,
182 THURSDAY = 4,
183 FRIDAY = 5,
184 SATURDAY = 6
185};
186
188enum class SymbolGTCMode : int32_t { GTC = 0, DAILY = 1, DAILY_NO_STOPS = 2 };
189
191enum class OptionRight : int32_t { CALL = 0, PUT = 1 };
192
194enum class OptionMode : int32_t { EUROPEAN = 0, AMERICAN = 1 };
195
197enum class AccountTradeMode : int32_t { DEMO = 0, CONTEST = 1, REAL = 2 };
198
200enum class AccountStopoutMode : int32_t { PERCENT = 0, MONEY = 1 };
201
203enum class AccountMarginMode : int32_t { RETAIL_NETTING = 0, EXCHANGE = 1, RETAIL_HEDGING = 2 };
204
206enum class BookType : int32_t { SELL = 1, BUY = 2, SELL_MARKET = 3, BUY_MARKET = 4 };
207
209enum class SymbolExecution : int32_t { REQUEST = 0, INSTANT = 1, MARKET = 2, EXCHANGE = 3 };
210
212enum class SymbolChartMode : int32_t { BID = 0, LAST = 1 };
213
215enum class DealEntry : int32_t { IN = 0, OUT = 1, INOUT = 2, OUT_BY = 3 };
216
218enum class OrderTime : int32_t { GTC = 0, DAY = 1, SPECIFIED = 2, SPECIFIED_DAY = 3 };
219
221enum class PositionType : int32_t { BUY = 0, SELL = 1 };
222
224enum class PositionReason : int32_t { CLIENT = 0, MOBILE = 1, WEB = 2, EXPERT = 3 };
225
227enum class CopyTicks : int32_t { ALL = -1, INFO = 1, TRADE = 2 };
228
230enum class TickFlag : int32_t {
231 BID = 0x02,
232 ASK = 0x04,
233 LAST = 0x08,
234 VOLUME = 0x10,
235 BUY = 0x20,
236 SELL = 0x40
237};
238
241 return static_cast<TickFlag>(static_cast<int32_t>(a) | static_cast<int32_t>(b));
242}
243
245enum class TradeRetcode : int32_t {
246 REQUOTE = 10004,
247 REJECT = 10006,
248 CANCEL = 10007,
249 PLACED = 10008,
250 DONE = 10009,
251 DONE_PARTIAL = 10010,
252 ERROR = 10011,
253 TIMEOUT = 10012,
254 INVALID = 10013,
255 INVALID_VOLUME = 10014,
256 INVALID_PRICE = 10015,
257 INVALID_STOPS = 10016,
258 TRADE_DISABLED = 10017,
259 MARKET_CLOSED = 10018,
260 NO_MONEY = 10019,
261 PRICE_CHANGED = 10020,
262 PRICE_OFF = 10021,
263 INVALID_EXPIRATION = 10022,
264 ORDER_CHANGED = 10023,
265 TOO_MANY_REQUESTS = 10024,
266 NO_CHANGES = 10025,
267 SERVER_DISABLES_AT = 10026,
268 CLIENT_DISABLES_AT = 10027,
269 LOCKED = 10028,
270 FROZEN = 10029,
271 INVALID_FILL = 10030,
272 CONNECTION = 10031,
273 ONLY_REAL = 10032,
274 LIMIT_ORDERS = 10033,
275 LIMIT_VOLUME = 10034,
276 INVALID_ORDER = 10035,
277 POSITION_CLOSED = 10036,
278 INVALID_CLOSE_VOLUME = 10038,
279 CLOSE_ORDER_EXIST = 10039,
280 LIMIT_POSITIONS = 10040,
281 REJECT_CANCEL = 10041,
282 LONG_ONLY = 10042,
283 SHORT_ONLY = 10043,
284 CLOSE_ONLY = 10044,
285 FIFO_CLOSE = 10045
286};
287
289enum class ReturnCode : int32_t {
290 OK = 1,
291 FAIL = -1,
292 INVALID_PARAMS = -2,
293 NO_MEMORY = -3,
294 NOT_FOUND = -4,
295 INVALID_VERSION = -5,
296 AUTH_FAILED = -6,
297 UNSUPPORTED = -7,
299 INTERNAL_FAIL = -10000,
300 INTERNAL_FAIL_SEND = -10001,
301 INTERNAL_FAIL_RECEIVE = -10002,
302 INTERNAL_FAIL_INIT = -10003,
303 INTERNAL_FAIL_CONNECT = -10004,
304 INTERNAL_FAIL_TIMEOUT = -10005
305};
306
308enum class SymbolType : int32_t {
309 FOREX = 0,
310 FUTURES = 1,
311 STOCKS = 2,
312 BONDS = 3,
313 CRYPTO = 4,
314 ETFS = 5,
315 INDICES = 6,
316 COMMODITIES = 7,
317 OPTIONS = 8,
318 UNKNOWN = 9
319};
320
346
349 int64_t login;
350 int32_t trade_mode;
351 int64_t leverage;
352 int32_t limit_orders;
356 int32_t margin_mode;
359 double balance;
360 double credit;
361 double profit;
362 double equity;
363 double margin;
364 double margin_free;
370 double assets;
371 double liabilities;
373 std::string name;
374 std::string server;
375 std::string currency;
376 std::string company;
377};
378
381 bool custom;
382 int32_t chart_mode;
383 bool select;
384 bool visible;
388 int64_t volume;
389 int64_t volumehigh;
390 int64_t volumelow;
391 int64_t time;
392 int32_t digits;
393 int32_t spread;
397 int32_t trade_mode;
398 int64_t start_time;
403 int32_t swap_mode;
407 int32_t filling_mode;
408 int32_t order_mode;
410 int32_t option_mode;
411 int32_t option_right;
412 double bid;
413 double bidhigh;
414 double bidlow;
415 double ask;
416 double askhigh;
417 double asklow;
418 double last;
419 double lasthigh;
420 double lastlow;
421 double volume_real;
425 double point;
434 double volume_min;
435 double volume_max;
436 double volume_step;
438 double swap_long;
439 double swap_short;
449 double session_aw;
464 std::string basis;
465 std::string category;
466 std::string currency_base;
467 std::string currency_profit;
468 std::string currency_margin;
469 std::string bank;
470 std::string description;
471 std::string exchange;
472 std::string formula;
473 std::string isin;
474 std::string name;
475 std::string page;
476 std::string path;
477};
478
479// Pack structs to ensure binary compatibility with API/IPC
480#pragma pack(push, 1)
482struct TickInfo {
483 int64_t time;
484 double bid;
485 double ask;
486 double last;
487 int64_t volume;
488 int64_t time_msc;
489 uint32_t flags;
490 double volume_real;
491};
492
494struct RateInfo {
495 int64_t time;
496 double open;
497 double high;
498 double low;
499 double close;
500 uint64_t tick_volume;
501 int32_t spread;
502 uint64_t real_volume;
503};
504#pragma pack(pop)
505
507struct BookInfo {
508 int32_t type;
509 double price;
510 uint64_t volume;
511 double volume_real;
512};
513
516 int32_t action = 0;
517 int64_t magic = 0;
518 int64_t order = 0;
519 std::string symbol = "";
520 double volume = 0.0;
521 double price = 0.0;
522 double stoplimit = 0.0;
523 double sl = 0.0;
524 double tp = 0.0;
525 int64_t deviation = 0;
526 int32_t type = 0;
527 int32_t type_filling = 0;
528 int32_t type_time = 0;
529 int64_t expiration = 0;
530 std::string comment = "";
531 int64_t position = 0;
532 int64_t position_by = 0;
533};
534
537 int32_t retcode;
538 double balance;
539 double equity;
540 double profit;
541 double margin;
542 double margin_free;
544 std::string comment;
546};
547
550 int32_t retcode;
551 int64_t deal;
552 int64_t order;
553 double volume;
554 double price;
555 double bid;
556 double ask;
557 std::string comment;
558 int64_t request_id;
561};
562
565 int64_t ticket;
566 int64_t time_setup;
568 int64_t time_done;
571 int32_t type;
572 int32_t type_time;
573 int32_t type_filling;
574 int32_t state;
575 int64_t magic;
576 int64_t position_id;
578 int32_t reason;
581 double price_open;
582 double sl;
583 double tp;
586 std::string symbol;
587 std::string comment;
588 std::string external_id;
589};
590
593 int64_t ticket;
594 int64_t time;
595 int64_t time_msc;
596 int64_t time_update;
598 int32_t type;
599 int64_t magic;
600 int64_t identifier;
601 int32_t reason;
602 double volume;
603 double price_open;
604 double sl;
605 double tp;
607 double swap;
608 double profit;
609 std::string symbol;
610 std::string comment;
611 std::string external_id;
612};
613
615struct TradeDeal {
616 int64_t ticket;
617 int64_t order;
618 int64_t time;
619 int64_t time_msc;
620 int32_t type;
621 int32_t entry;
622 int64_t magic;
623 int64_t position_id;
624 int32_t reason;
625 double volume;
626 double price;
627 double commission;
628 double swap;
629 double profit;
630 double fee;
631 std::string symbol;
632 std::string comment;
633 std::string external_id;
634};
635
636#if (defined(_MSVC_LANG) && _MSVC_LANG >= 202302L) || (__cplusplus >= 202302L)
638template <typename T>
639concept IsScopedEnum = std::is_scoped_enum_v<T>;
640#else
642template <typename T>
643concept IsScopedEnum = std::is_enum_v<T> && !std::is_convertible_v<T, int>;
644#endif
645
650template <IsScopedEnum EnumClass>
651constexpr auto operator+(EnumClass a) noexcept {
652 return static_cast<std::underlying_type_t<EnumClass>>(a);
653}
654
655} // namespace MT5
Concept to check if a type is a scoped enumeration (Legacy fallback).
Definition objects.hpp:643
Namespace containing MetaTrader 5 (MT5) client definitions and wrapper classes.
Definition metatrader.hpp:24
PositionReason
Reason for position creation.
Definition objects.hpp:224
TradeAction
Types of trade actions in a request.
Definition objects.hpp:127
@ SLTP
Modify Stop Loss / Take Profit.
@ REMOVE
Remove pending order.
@ DEAL
Place a market order (instant execution)
@ MODIFY
Modify pending order price/expiry.
@ PENDING
Place a pending order.
CopyTicks
Flags for copying ticks.
Definition objects.hpp:227
AccountMarginMode
Account margin calculation mode.
Definition objects.hpp:203
TickFlag
Flags describing tick content.
Definition objects.hpp:230
@ VOLUME
Tick changed Volume.
@ ASK
Tick changed Ask price.
OrderFilling
Order filling policies.
Definition objects.hpp:72
@ IOC
Immediate or Cancel: Execute available, cancel remainder.
@ FOK
Fill or Kill: Execute fully or cancel.
@ RETURN
Return: Execute available, keep remainder (standard)
OrderState
States of an order.
Definition objects.hpp:58
@ PLACED
Order accepted.
@ STARTED
Order checked, but not yet accepted by broker.
@ EXPIRED
Order expired.
@ REQUEST_MODIFY
Order is being modified (internal)
@ FILLED
Order fully executed.
@ REQUEST_ADD
Order is being registered (internal)
@ REJECTED
Order rejected.
@ REQUEST_CANCEL
Order is being deleted (internal)
@ CANCELED
Order canceled by client.
@ PARTIAL
Order partially executed.
Timeframe
Standard chart timeframes.
Definition objects.hpp:20
@ M5
5 Minutes
@ M20
20 Minutes
@ M15
15 Minutes
@ H12
12 Hours
@ M30
30 Minutes
@ M4
4 Minutes
@ M2
2 Minutes
@ M10
10 Minutes
@ M12
12 Minutes
@ M3
3 Minutes
@ M1
1 Minute
@ M6
6 Minutes
DealType
Types of deals involved in trading.
Definition objects.hpp:91
@ CHARGE
Additional charge.
@ CORRECTION
Correction deal.
@ BONUS
Bonus deposit.
@ COMMISSION_AGENT_MONTHLY
Monthly agent commission.
@ COMMISSION
Commission charge.
@ DIVIDEND
Dividend operation.
@ COMMISSION_AGENT_DAILY
Daily agent commission.
@ COMMISSION_MONTHLY
Monthly commission.
@ SELL_CANCELED
Canceled sell deal.
@ COMMISSION_DAILY
Daily commission.
@ BALANCE
Balance operation.
@ INTEREST
Interest rate charge.
@ TAX
Tax charge.
@ CREDIT
Credit operation.
@ DIVIDEND_FRANKED
Franked dividend.
@ BUY_CANCELED
Canceled buy deal.
PositionType
Position type.
Definition objects.hpp:221
SymbolChartMode
Symbol chart price base.
Definition objects.hpp:212
TickFlag operator|(TickFlag a, TickFlag b)
Overload for TickFlag bitwise combination.
Definition objects.hpp:240
DayOfWeek
Days of the week.
Definition objects.hpp:177
AccountStopoutMode
Stop-out calculation mode.
Definition objects.hpp:200
OptionMode
Option style.
Definition objects.hpp:194
TradeRetcode
Return codes from the trade server.
Definition objects.hpp:245
@ NO_CHANGES
No changes in request.
@ TIMEOUT
Request canceled by timeout.
@ FROZEN
Order or position frozen.
@ INVALID_ORDER
Incorrect or prohibited order type.
@ LIMIT_POSITIONS
The number of open positions has reached the limit.
@ ONLY_REAL
Operation is allowed only for live accounts.
@ SHORT_ONLY
The request is rejected, only short positions are allowed.
@ CANCEL
Request canceled by trader.
@ INVALID_CLOSE_VOLUME
A volume to close exceeds the current position volume.
@ CLOSE_ONLY
The request is rejected, only position closing is allowed.
@ DONE
Request completed.
@ INVALID_VOLUME
Invalid volume in the request.
@ REJECT_CANCEL
The pending order is currently being activated, cancel is rejected.
@ FIFO_CLOSE
Position closing is allowed only by FIFO rule.
@ LIMIT_VOLUME
The volume for the symbol has reached the limit.
@ INVALID_FILL
Invalid order filling type.
@ TOO_MANY_REQUESTS
Too many frequent requests.
@ LIMIT_ORDERS
The number of pending orders has reached the limit.
@ PRICE_OFF
There are no quotes to process the request.
@ REJECT
Request rejected.
@ DONE_PARTIAL
Only part of the request completed.
@ ORDER_CHANGED
Order state changed.
@ CLIENT_DISABLES_AT
Autotrading disabled by client terminal.
@ MARKET_CLOSED
Market is closed.
@ PRICE_CHANGED
Prices changed.
@ INVALID_STOPS
Invalid stops in the request.
@ LOCKED
Request locked for processing.
@ CLOSE_ORDER_EXIST
A close order already exists for the specified position.
@ TRADE_DISABLED
Trade is disabled.
@ ERROR
Request processing error.
@ POSITION_CLOSED
Position with the specified ticket is already closed.
@ LONG_ONLY
The request is rejected, only long positions are allowed.
@ INVALID
Invalid request.
@ INVALID_EXPIRATION
Invalid order expiration date in the request.
@ SERVER_DISABLES_AT
Autotrading disabled by server.
@ NO_MONEY
There is not enough money to request.
@ CONNECTION
No connection with the trade server.
@ INVALID_PRICE
Invalid price in the request.
OrderType
Order types for market and pending orders.
Definition objects.hpp:45
@ BUY_LIMIT
Buy Limit pending order.
@ BUY_STOP_LIMIT
Buy Stop Limit pending order.
@ BUY_STOP
Buy Stop pending order.
@ CLOSE_BY
Order to close a position by an opposite one.
@ SELL
Market Sell order.
@ SELL_STOP_LIMIT
Sell Stop Limit pending order.
@ SELL_LIMIT
Sell Limit pending order.
@ BUY
Market Buy order.
@ SELL_STOP
Sell Stop pending order.
OptionRight
Option right type.
Definition objects.hpp:191
OrderReason
Reason or source for the order placement.
Definition objects.hpp:80
@ TP
Triggered by Take Profit.
@ SL
Triggered by Stop Loss.
@ SO
Triggered by Stop Out.
@ EXPERT
Placed by Expert Advisor (script)
@ WEB
Placed via web platform.
@ MOBILE
Placed via mobile app.
@ CLIENT
Manually placed by terminal.
AccountTradeMode
Account trade mode (Demo/Real).
Definition objects.hpp:197
constexpr auto operator+(EnumClass a) noexcept
Unary + operator to extract the underlying integer value of a scoped enum.
Definition objects.hpp:651
OrderTime
Order expiration time flags.
Definition objects.hpp:218
SymbolCalcMode
Mode of symbol margin and profit calculation.
Definition objects.hpp:137
@ SERV_COLLATERAL
Collateral.
@ EXCH_OPTIONS
Exchange Options.
@ FOREX_NO_LEVERAGE
Forex without leverage.
@ FUTURES
Futures mode.
@ EXCH_BONDS
Exchange Bonds.
@ EXCH_FUTURES
Exchange Futures.
@ EXCH_STOCKS
Exchange Stocks.
@ CFDINDEX
CFD Index mode.
@ EXCH_STOCKS_MOEX
MOEX Stocks.
@ EXCH_OPTIONS_MARGIN
Exchange Options Margin.
@ CFDLEVERAGE
CFD Leverage mode.
@ EXCH_BONDS_MOEX
MOEX Bonds.
@ FOREX
Forex mode.
SymbolTradeMode
Allowed trade modes for a symbol.
Definition objects.hpp:155
@ DISABLED
Trading disabled.
@ CLOSEONLY
Only closing allowed.
@ LONGONLY
Long only allowed (Note: likely maps to LONGONLY)
@ SHORTONLY
Short only allowed.
@ FULL
No restrictions.
SymbolSwapMode
Swap calculation modes.
Definition objects.hpp:164
@ REOPEN_BID
Reopen bid.
@ CURRENCY_DEPOSIT
Swaps in deposit currency.
@ INTEREST_OPEN
Interest open.
@ CURRENCY_MARGIN
Swaps in margin currency.
@ REOPEN_CURRENT
Reopen current.
@ POINTS
Swaps in points.
@ INTEREST_CURRENT
Interest current.
@ CURRENCY_SYMBOL
Swaps in symbol base currency.
DealReason
Reason for the deal execution.
Definition objects.hpp:113
@ VMARGIN
Variation margin.
@ ROLLOVER
Rollover deal.
SymbolType
Asset classes / Symbol types.
Definition objects.hpp:308
@ OPTIONS
Options contracts.
@ COMMODITIES
Commodities.
@ ETFS
Exchange-Traded Funds.
@ STOCKS
Stocks and shares.
@ INDICES
Market indices.
@ UNKNOWN
Unknown or unsupported type.
@ CRYPTO
Cryptocurrencies.
ReturnCode
Internal library return codes.
Definition objects.hpp:289
@ INTERNAL_FAIL
Internal Failure.
@ INTERNAL_FAIL_CONNECT
Internal Connection Failure.
@ INVALID_PARAMS
Invalid Parameters.
@ INTERNAL_FAIL_RECEIVE
Internal Receive Failure.
@ UNSUPPORTED
Unsupported Operation.
@ INVALID_VERSION
Version Mismatch.
@ AUTH_FAILED
Authentication Failed.
@ NOT_FOUND
Not Found.
@ INTERNAL_FAIL_INIT
Internal Initialization Failure.
@ INTERNAL_FAIL_TIMEOUT
Internal Timeout.
@ FAIL
Generic Failure.
@ AUTO_TRADING_DISABLED
AutoTrading Disabled.
@ INTERNAL_FAIL_SEND
Internal Send Failure.
@ NO_MEMORY
Memory Allocation Error.
BookType
Order book entry type.
Definition objects.hpp:206
DealEntry
Deal entry direction.
Definition objects.hpp:215
SymbolGTCMode
Expiration modes for Good-Till-Canceled orders.
Definition objects.hpp:188
SymbolExecution
Symbol execution mode.
Definition objects.hpp:209
Information about the trading account.
Definition objects.hpp:348
double margin_level
Margin level percentage.
Definition objects.hpp:365
double equity
Account equity.
Definition objects.hpp:362
bool trade_allowed
True if trading allowed for account.
Definition objects.hpp:354
std::string currency
Account currency.
Definition objects.hpp:375
double margin_free
Free margin.
Definition objects.hpp:364
bool trade_expert
True if EAs are allowed to trade.
Definition objects.hpp:355
int64_t leverage
Account leverage.
Definition objects.hpp:351
double margin
Used margin.
Definition objects.hpp:363
double profit
Current floating profit.
Definition objects.hpp:361
double assets
Current assets.
Definition objects.hpp:370
double margin_initial
Initial margin requirement.
Definition objects.hpp:368
double credit
Account credit.
Definition objects.hpp:360
int32_t margin_mode
Margin calculation mode (Hedging/Netting)
Definition objects.hpp:356
int32_t currency_digits
Digits of account currency.
Definition objects.hpp:357
int32_t limit_orders
Max allowed pending orders.
Definition objects.hpp:352
double commission_blocked
Blocked commission.
Definition objects.hpp:372
std::string name
Client name.
Definition objects.hpp:373
double margin_so_so
Stop-out level.
Definition objects.hpp:367
int32_t margin_so_mode
Margin stop-out mode.
Definition objects.hpp:353
int32_t trade_mode
Account trade mode (Demo, Real, Contest)
Definition objects.hpp:350
std::string server
Trade server name.
Definition objects.hpp:374
double margin_maintenance
Maintenance margin requirement.
Definition objects.hpp:369
double margin_so_call
Margin call level.
Definition objects.hpp:366
int64_t login
Account login number.
Definition objects.hpp:349
bool fifo_close
True if FIFO closing is required.
Definition objects.hpp:358
double liabilities
Current liabilities.
Definition objects.hpp:371
std::string company
Broker company name.
Definition objects.hpp:376
double balance
Account balance.
Definition objects.hpp:359
Represents an entry in the Depth of Market (Order Book).
Definition objects.hpp:507
uint64_t volume
Volume.
Definition objects.hpp:510
int32_t type
Order type from BookType enumeration.
Definition objects.hpp:508
double volume_real
Volume with greater accuracy.
Definition objects.hpp:511
double price
Price.
Definition objects.hpp:509
Results of an order check (validation) operation.
Definition objects.hpp:536
double equity
Equity after the execution of the deal.
Definition objects.hpp:539
double balance
Balance after the execution of the deal.
Definition objects.hpp:538
double profit
Floating profit.
Definition objects.hpp:540
double margin_free
Free margin.
Definition objects.hpp:542
double margin
Margin requirements.
Definition objects.hpp:541
int32_t retcode
Reply code.
Definition objects.hpp:537
double margin_level
Margin level.
Definition objects.hpp:543
std::string comment
Comment to the reply code (description of the error)
Definition objects.hpp:544
TradeRequest request
The request that was checked.
Definition objects.hpp:545
Results of a sent order.
Definition objects.hpp:549
double volume
Deal volume, confirmed by broker.
Definition objects.hpp:553
double price
Deal price, confirmed by broker.
Definition objects.hpp:554
TradeRequest request
The original request.
Definition objects.hpp:560
int64_t request_id
Request ID set by the terminal during the dispatch.
Definition objects.hpp:558
int32_t retcode
Operation return code.
Definition objects.hpp:550
int32_t retcode_external
Return code of an external trading system.
Definition objects.hpp:559
std::string comment
Broker comment or description of return code.
Definition objects.hpp:557
double ask
Current Ask price.
Definition objects.hpp:556
int64_t deal
Deal ticket, if it is performed.
Definition objects.hpp:551
int64_t order
Order ticket, if it is placed.
Definition objects.hpp:552
double bid
Current Bid price.
Definition objects.hpp:555
Represents a bar of historical data (OHLCV).
Definition objects.hpp:494
uint64_t real_volume
Trade volume.
Definition objects.hpp:502
double close
Close price.
Definition objects.hpp:499
int64_t time
Period start time.
Definition objects.hpp:495
uint64_t tick_volume
Tick volume.
Definition objects.hpp:500
double high
The highest price of the period.
Definition objects.hpp:497
double low
The lowest price of the period.
Definition objects.hpp:498
double open
Open price.
Definition objects.hpp:496
int32_t spread
Spread.
Definition objects.hpp:501
Comprehensive information about a specific financial instrument (Symbol).
Definition objects.hpp:380
double last
Price of the last deal.
Definition objects.hpp:418
double price_greeks_gamma
Option Gamma.
Definition objects.hpp:459
double session_interest
Open interest.
Definition objects.hpp:444
int32_t swap_mode
Swap calculation mode.
Definition objects.hpp:403
double trade_face_value
Face value.
Definition objects.hpp:432
double price_theoretical
Theoretical price.
Definition objects.hpp:456
int32_t trade_mode
Trade mode.
Definition objects.hpp:397
int64_t volumelow
Min volume of the day.
Definition objects.hpp:390
double session_aw
Average weighted session price.
Definition objects.hpp:449
double asklow
Min Ask of the day.
Definition objects.hpp:417
double trade_tick_size
Minimal price change.
Definition objects.hpp:429
double price_greeks_theta
Option Theta.
Definition objects.hpp:458
std::string description
Symbol description.
Definition objects.hpp:470
double price_greeks_rho
Option Rho.
Definition objects.hpp:461
std::string path
Path in symbol tree.
Definition objects.hpp:476
int32_t option_right
Option right (Call/Put)
Definition objects.hpp:411
double session_buy_orders_volume
Volume of buy orders.
Definition objects.hpp:445
double bidhigh
Max Bid of the day.
Definition objects.hpp:413
double bidlow
Min Bid of the day.
Definition objects.hpp:414
double session_turnover
Turnover of the current session.
Definition objects.hpp:443
std::string page
Web page.
Definition objects.hpp:475
double session_price_limit_min
Min price limit.
Definition objects.hpp:451
double session_price_settlement
Settlement price.
Definition objects.hpp:450
int32_t spread
Spread value in points.
Definition objects.hpp:393
double price_volatility
Price volatility.
Definition objects.hpp:455
int32_t digits
Digits after decimal point.
Definition objects.hpp:392
double volumelow_real
Min volume (double)
Definition objects.hpp:423
std::string exchange
Exchange name.
Definition objects.hpp:471
std::string isin
ISIN code.
Definition objects.hpp:473
double session_sell_orders_volume
Volume of sell orders.
Definition objects.hpp:446
double volume_real
Last deal volume (double)
Definition objects.hpp:421
double volume_limit
Max cumulative volume allowed.
Definition objects.hpp:437
double trade_tick_value
Calculated tick value.
Definition objects.hpp:426
double trade_tick_value_profit
Calculated tick value for profit.
Definition objects.hpp:427
int32_t expiration_mode
Flags of allowed order expiration modes.
Definition objects.hpp:406
int64_t session_sell_orders
Number of sell orders in current session.
Definition objects.hpp:387
double option_strike
Option strike price.
Definition objects.hpp:424
double trade_accrued_interest
Accrued interest.
Definition objects.hpp:431
bool spread_float
Is spread floating.
Definition objects.hpp:394
int64_t expiration_time
Symbol expiration date.
Definition objects.hpp:399
int64_t volumehigh
Max volume of the day.
Definition objects.hpp:389
double session_volume
Volume of the current session.
Definition objects.hpp:442
double margin_hedged
Contract size or margin for hedged positions.
Definition objects.hpp:453
double price_sensitivity
Sensitivity.
Definition objects.hpp:463
double volumehigh_real
Max volume (double)
Definition objects.hpp:422
double volume_max
Maximal volume for a deal.
Definition objects.hpp:435
std::string currency_base
Base currency.
Definition objects.hpp:466
double price_greeks_vega
Option Vega.
Definition objects.hpp:460
double ask
Current Ask price.
Definition objects.hpp:415
double price_greeks_omega
Option Omega.
Definition objects.hpp:462
double trade_tick_value_loss
Calculated tick value for loss.
Definition objects.hpp:428
int64_t time
Time of the last quote.
Definition objects.hpp:391
std::string name
Symbol name.
Definition objects.hpp:474
bool custom
Is custom symbol.
Definition objects.hpp:381
int32_t trade_calc_mode
Calculation mode.
Definition objects.hpp:396
int32_t order_gtc_mode
Expiration of Stop Loss and Take Profit.
Definition objects.hpp:409
double price_change
Price change percentage.
Definition objects.hpp:454
double margin_initial
Initial margin requirement.
Definition objects.hpp:440
std::string basis
Underlying asset name.
Definition objects.hpp:464
int64_t session_deals
Number of deals in current session.
Definition objects.hpp:385
double lasthigh
Max Last of the day.
Definition objects.hpp:419
int32_t order_mode
Flags of allowed order types.
Definition objects.hpp:408
int32_t trade_freeze_level
Distance to freeze trade operations.
Definition objects.hpp:401
double lastlow
Min Last of the day.
Definition objects.hpp:420
double bid
Current Bid price.
Definition objects.hpp:412
int32_t trade_exemode
Trade execution mode.
Definition objects.hpp:402
double point
Symbol point value.
Definition objects.hpp:425
std::string currency_margin
Margin currency.
Definition objects.hpp:468
int32_t ticks_bookdepth
Maximal depth of Depth of Market.
Definition objects.hpp:395
double price_greeks_delta
Option Delta.
Definition objects.hpp:457
double volume_step
Minimal volume change step.
Definition objects.hpp:436
int32_t option_mode
Option type.
Definition objects.hpp:410
int64_t volume
Last deal volume.
Definition objects.hpp:388
int32_t filling_mode
Flags of allowed order filling modes.
Definition objects.hpp:407
bool select
Is symbol selected in Market Watch.
Definition objects.hpp:383
bool margin_hedged_use_leg
Calculation of hedged margin using larger leg.
Definition objects.hpp:405
double session_close
Session close price.
Definition objects.hpp:448
std::string currency_profit
Profit currency.
Definition objects.hpp:467
int32_t chart_mode
Price type used for bars generation.
Definition objects.hpp:382
bool visible
Is symbol visible in Market Watch.
Definition objects.hpp:384
int64_t start_time
Symbol trading start date.
Definition objects.hpp:398
double swap_short
Swap for sell positions.
Definition objects.hpp:439
std::string bank
Feeder/Bank name.
Definition objects.hpp:469
double session_open
Session open price.
Definition objects.hpp:447
double trade_contract_size
Trade contract size.
Definition objects.hpp:430
double swap_long
Swap for buy positions.
Definition objects.hpp:438
double volume_min
Minimal volume for a deal.
Definition objects.hpp:434
int64_t session_buy_orders
Number of buy orders in current session.
Definition objects.hpp:386
double session_price_limit_max
Max price limit.
Definition objects.hpp:452
std::string category
Symbol category.
Definition objects.hpp:465
int32_t trade_stops_level
Minimal indention in points for stops.
Definition objects.hpp:400
double askhigh
Max Ask of the day.
Definition objects.hpp:416
double trade_liquidity_rate
Liquidity rate.
Definition objects.hpp:433
int32_t swap_rollover3days
Day of triple swap.
Definition objects.hpp:404
std::string formula
Pricing formula.
Definition objects.hpp:472
double margin_maintenance
Maintenance margin requirement.
Definition objects.hpp:441
Information regarding the terminal and connection status.
Definition objects.hpp:322
std::string company
Broker company name.
Definition objects.hpp:339
std::string name
Terminal name.
Definition objects.hpp:340
std::string commondata_path
Path to common data folder.
Definition objects.hpp:344
std::string path
Path to terminal installation.
Definition objects.hpp:342
int32_t codepage
Codepage number.
Definition objects.hpp:335
std::string data_path
Path to terminal data folder.
Definition objects.hpp:343
bool mqid
MetaQuotes ID availability.
Definition objects.hpp:332
bool ftp_enabled
True if FTP publishing is enabled.
Definition objects.hpp:330
double community_balance
MQL5 community balance.
Definition objects.hpp:337
int32_t maxbars
Max bars on chart.
Definition objects.hpp:334
bool email_enabled
True if email sending is enabled.
Definition objects.hpp:329
bool community_account
True if logged into MQL5 community.
Definition objects.hpp:323
bool connected
True if connected to trade server.
Definition objects.hpp:325
std::string language
Language.
Definition objects.hpp:341
bool dlls_allowed
True if DLLs are allowed.
Definition objects.hpp:326
int32_t build
Terminal build number.
Definition objects.hpp:333
int32_t ping_last
Last ping value in microseconds.
Definition objects.hpp:336
bool notifications_enabled
True if smartphone notifications are enabled.
Definition objects.hpp:331
bool community_connection
True if connected to MQL5 community.
Definition objects.hpp:324
double retransmission
Retransmission percentage.
Definition objects.hpp:338
bool trade_allowed
True if trading is allowed.
Definition objects.hpp:327
bool tradeapi_disabled
True if Trade API is disabled.
Definition objects.hpp:328
Represents a single tick (price update).
Definition objects.hpp:482
int64_t volume
Volume for the current Last price.
Definition objects.hpp:487
uint32_t flags
Tick flags (TickFlag enum)
Definition objects.hpp:489
int64_t time
Time of the last prices update.
Definition objects.hpp:483
int64_t time_msc
Time of a price last update in milliseconds.
Definition objects.hpp:488
double last
Price of the last deal (Last)
Definition objects.hpp:486
double bid
Current Bid price.
Definition objects.hpp:484
double volume_real
Volume for the current Last price with greater accuracy.
Definition objects.hpp:490
double ask
Current Ask price.
Definition objects.hpp:485
Represents a historical deal (execution).
Definition objects.hpp:615
double swap
Swap.
Definition objects.hpp:628
int32_t reason
Reason for deal execution.
Definition objects.hpp:624
int64_t ticket
Deal ticket.
Definition objects.hpp:616
std::string comment
Deal comment.
Definition objects.hpp:632
int64_t time_msc
Deal time in msc.
Definition objects.hpp:619
double commission
Commission.
Definition objects.hpp:627
int32_t entry
Deal entry direction.
Definition objects.hpp:621
double volume
Deal volume.
Definition objects.hpp:625
int64_t time
Deal time.
Definition objects.hpp:618
double price
Deal price.
Definition objects.hpp:626
int64_t order
Order ticket that generated the deal.
Definition objects.hpp:617
int64_t position_id
Position identifier.
Definition objects.hpp:623
std::string external_id
External system ID.
Definition objects.hpp:633
int64_t magic
Expert Advisor ID.
Definition objects.hpp:622
double profit
Profit.
Definition objects.hpp:629
int32_t type
Deal type.
Definition objects.hpp:620
double fee
Fee.
Definition objects.hpp:630
std::string symbol
Symbol name.
Definition objects.hpp:631
Represents an active or historical order.
Definition objects.hpp:564
int32_t reason
Reason for order placement.
Definition objects.hpp:578
double volume_initial
Initial volume.
Definition objects.hpp:579
int64_t position_by_id
Identifier of opposite position.
Definition objects.hpp:577
double price_stoplimit
StopLimit price.
Definition objects.hpp:585
int64_t magic
Expert Advisor ID.
Definition objects.hpp:575
int32_t type_time
Order lifetime.
Definition objects.hpp:572
std::string symbol
Symbol name.
Definition objects.hpp:586
int64_t time_done
Order execution/cancellation time.
Definition objects.hpp:568
int64_t ticket
Order ticket.
Definition objects.hpp:565
double sl
Stop Loss price.
Definition objects.hpp:582
double price_open
Price specified in the order.
Definition objects.hpp:581
int32_t type_filling
Order filling type.
Definition objects.hpp:573
int32_t type
Order type.
Definition objects.hpp:571
int64_t time_done_msc
Order execution/cancellation time in msc.
Definition objects.hpp:569
double tp
Take Profit price.
Definition objects.hpp:583
double volume_current
Current volume.
Definition objects.hpp:580
int64_t time_setup
Order setup time.
Definition objects.hpp:566
int64_t time_expiration
Order expiration time.
Definition objects.hpp:570
std::string external_id
External system ID.
Definition objects.hpp:588
int32_t state
Order state.
Definition objects.hpp:574
int64_t time_setup_msc
Order setup time in msc.
Definition objects.hpp:567
int64_t position_id
Position identifier.
Definition objects.hpp:576
double price_current
Current price of the symbol.
Definition objects.hpp:584
std::string comment
Order comment.
Definition objects.hpp:587
Represents an open position.
Definition objects.hpp:592
int32_t type
Position type.
Definition objects.hpp:598
double price_open
Position open price.
Definition objects.hpp:603
std::string external_id
External system ID.
Definition objects.hpp:611
double price_current
Current symbol price.
Definition objects.hpp:606
int64_t time_update
Position last update time.
Definition objects.hpp:596
int64_t magic
Expert Advisor ID.
Definition objects.hpp:599
double swap
Accumulated swap.
Definition objects.hpp:607
double profit
Current floating profit.
Definition objects.hpp:608
double tp
Take Profit price.
Definition objects.hpp:605
std::string comment
Position comment.
Definition objects.hpp:610
int32_t reason
Reason for position opening.
Definition objects.hpp:601
double sl
Stop Loss price.
Definition objects.hpp:604
int64_t time
Position open time.
Definition objects.hpp:594
int64_t time_msc
Position open time in msc.
Definition objects.hpp:595
std::string symbol
Symbol name.
Definition objects.hpp:609
double volume
Position volume.
Definition objects.hpp:602
int64_t ticket
Position ticket.
Definition objects.hpp:593
int64_t time_update_msc
Position last update time in msc.
Definition objects.hpp:597
int64_t identifier
Position identifier.
Definition objects.hpp:600
Structure to send trade requests to the server.
Definition objects.hpp:515
int64_t deviation
Maximal possible deviation from the requested price.
Definition objects.hpp:525
int64_t order
Order ticket.
Definition objects.hpp:518
int32_t type_time
Order expiration type (OrderTime)
Definition objects.hpp:528
int32_t type
Order type (OrderType)
Definition objects.hpp:526
std::string comment
Order comment.
Definition objects.hpp:530
int32_t type_filling
Order execution type (OrderFilling)
Definition objects.hpp:527
double sl
Stop Loss level of the order.
Definition objects.hpp:523
std::string symbol
Trade symbol.
Definition objects.hpp:519
int64_t position_by
The ticket of an opposite position.
Definition objects.hpp:532
int64_t magic
Expert Advisor ID (magic number)
Definition objects.hpp:517
double price
Price.
Definition objects.hpp:521
int64_t position
Position ticket.
Definition objects.hpp:531
double tp
Take Profit level of the order.
Definition objects.hpp:524
int32_t action
Trade operation type (TradeAction)
Definition objects.hpp:516
double volume
Requested volume for a deal in lots.
Definition objects.hpp:520
double stoplimit
StopLimit level of the order.
Definition objects.hpp:522
int64_t expiration
Order expiration time.
Definition objects.hpp:529