BBSTRADER 2.4.0
Loading...
Searching...
No Matches
MT5 Namespace Reference

Namespace containing MetaTrader 5 (MT5) client definitions and wrapper classes. More...

Classes

struct  AccountInfo
 Information about the trading account. More...
 
struct  BookInfo
 Represents an entry in the Depth of Market (Order Book). More...
 
class  MetaTraderClient
 A client class that abstracts MetaTrader 5 functionality using injected handlers. More...
 
struct  OrderCheckResult
 Results of an order check (validation) operation. More...
 
struct  OrderSentResult
 Results of a sent order. More...
 
struct  RateInfo
 Represents a bar of historical data (OHLCV). More...
 
struct  SymbolInfo
 Comprehensive information about a specific financial instrument (Symbol). More...
 
struct  TerminalInfo
 Information regarding the terminal and connection status. More...
 
struct  TickInfo
 Represents a single tick (price update). More...
 
struct  TradeDeal
 Represents a historical deal (execution). More...
 
struct  TradeOrder
 Represents an active or historical order. More...
 
struct  TradePosition
 Represents an open position. More...
 
struct  TradeRequest
 Structure to send trade requests to the server. More...
 

Concepts

concept  IsScopedEnum
 Concept to check if a type is a scoped enumeration (Legacy fallback).
 

Typedefs

using str = const std::string
 Alias for const std::string to simplify function signatures.
 
using VersionInfo = std::tuple< int32_t, int32_t, std::string >
 Tuple representing version info: <major version, minor version, build date string>.
 
using LastErrorResult = std::tuple< int32_t, std::string >
 Tuple representing the last error: <error code, error description>.
 
using DealsData = std::optional< std::vector< TradeDeal > >
 Optional vector of TradeDeal objects.
 
using SymbolsData = std::optional< std::vector< SymbolInfo > >
 Optional vector of SymbolInfo objects.
 
using BookData = std::optional< std::vector< BookInfo > >
 Optional vector of BookInfo (Market Depth) objects.
 
using OrdersData = std::optional< std::vector< TradeOrder > >
 Optional vector of TradeOrder objects.
 
using PositionsData = std::optional< std::vector< TradePosition > >
 Optional vector of TradePosition objects.
 
using RateInfoType = std::optional< py::array_t< RateInfo > >
 Optional Numpy array of RateInfo structures (OHLCV data).
 
using TickInfoType = std::optional< py::array_t< TickInfo > >
 Optional Numpy array of TickInfo structures.
 
using DateTime = std::chrono::system_clock::time_point
 System clock time point for date/time operations.
 
using InitializeAuto = std::function< bool()>
 Callback to initialize the MT5 terminal automatically.
 
using InitializeWithPath = std::function< bool(str &)>
 Callback to initialize the MT5 terminal with a specific path.
 
using InitializeFull = std::function< bool(str &, uint64_t, str &, str &, uint32_t, bool)>
 Callback to initialize the MT5 terminal with full configuration options.
 
using Login = std::function< bool(uint64_t, str &, str &, uint32_t)>
 Callback to login to an account.
 
using Shutdown = std::function< void()>
 Callback to shut down the initialized terminal.
 
using GetVersion = std::function< std::optional< VersionInfo >()>
 Callback to retrieve the terminal version.
 
using GetLastError = std::function< std::optional< LastErrorResult >()>
 Callback to retrieve the last error code and description.
 
using GetTerminalInfo = std::function< std::optional< TerminalInfo >()>
 Callback to retrieve static terminal information.
 
using GetAccountInfo = std::function< std::optional< AccountInfo >()>
 Callback to retrieve account information.
 
using GetSymbolInfo = std::function< std::optional< SymbolInfo >(str &)>
 Callback to retrieve information for a specific symbol.
 
using GetTickInfo = std::function< std::optional< TickInfo >(str &)>
 Callback to retrieve the last tick for a specific symbol.
 
using GetTotalSymbols = std::function< std::optional< int32_t >()>
 Callback to get the total count of available symbols.
 
using GetSymbolsAll = std::function< SymbolsData()>
 Callback to retrieve all available symbols.
 
using SelectSymbol = std::function< bool(str &, bool)>
 Callback to select or deselect a symbol in Market Watch.
 
using GetSymbolsByGroup = std::function< SymbolsData(str &)>
 Callback to retrieve symbols belonging to a specific group.
 
using SubscribeBook = std::function< bool(str &)>
 Callback to subscribe to the Market Book (Depth of Market) for a symbol.
 
using UnsubscribeBook = std::function< bool(str &)>
 Callback to unsubscribe from the Market Book for a symbol.
 
using GetBookInfo = std::function< BookData(str &)>
 Callback to get the current Market Book state for a symbol.
 
using GetRatesByDate = std::function< RateInfoType(str &, int32_t, int64_t, int32_t)>
 Callback to get rates starting from a specific date.
 
using GetRatesByPos = std::function< RateInfoType(str &, int32_t, int32_t, int32_t)>
 Callback to get rates starting from a specific index position.
 
using GetRatesByRange = std::function< RateInfoType(str &, int32_t, int64_t, int64_t)>
 Callback to get rates within a time range.
 
using GetTicksByDate = std::function< TickInfoType(str &, int64_t, int32_t, int32_t)>
 Callback to get ticks starting from a specific date.
 
using GetTicksByRange = std::function< TickInfoType(str &, int64_t, int64_t, int32_t)>
 Callback to get ticks within a time range.
 
using GetOrdersAll = std::function< OrdersData()>
 Callback to retrieve all current trade orders.
 
using GetOrdersBySymbol = std::function< OrdersData(str &)>
 Callback to retrieve trade orders filtered by symbol.
 
using GetOrdersByGroup = std::function< OrdersData(str &)>
 Callback to retrieve trade orders filtered by a specific group.
 
using GetOrderByTicket = std::function< std::optional< TradeOrder >(uint64_t)>
 Callback to retrieve a specific order by its unique ticket ID.
 
using GetTotalOrders = std::function< std::optional< int32_t >()>
 Callback to retrieve the total count of active orders.
 
using GetPositionsAll = std::function< PositionsData()>
 Callback to retrieve all active trade positions.
 
using GetPositionsBySymbol = std::function< PositionsData(str &)>
 Callback to retrieve active positions filtered by symbol.
 
using GetPositionsByGroup = std::function< PositionsData(str &)>
 Callback to retrieve active positions filtered by group.
 
using GetPositionByTicket = std::function< std::optional< TradePosition >(uint64_t)>
 Callback to retrieve a specific position by its unique ticket ID.
 
using GetTotalPositions = std::function< std::optional< int32_t >()>
 Callback to retrieve the total count of active positions.
 
using CalculateMargin = std::function< std::optional< double >(int32_t, str &, double, double)>
 Callback to calculate margin.
 
using CalculateProfit = std::function< std::optional< double >(int32_t, str &, double, double, double)>
 Callback to calculate profit.
 
using CheckOrder = std::function< std::optional< OrderCheckResult >(const TradeRequest &)>
 Callback to check an order request before sending.
 
using SendOrder = std::function< std::optional< OrderSentResult >(const TradeRequest &)>
 Callback to send an order to the market.
 
using GetHistoryOrdersByRange = std::function< OrdersData(int64_t, int64_t)>
 Callback to retrieve historical orders within a specific time range.
 
using GetHistoryOrdersByGroup = std::function< OrdersData(int64_t, int64_t, str &)>
 Callback to retrieve historical orders within a specific time range and filter.
 
using GetHistoryOrderByTicket = std::function< std::optional< TradeOrder >(uint64_t)>
 Callback to retrieve a specific historical order by its ticket ID.
 
using GetHistoryOrdersByPosId = std::function< OrdersData(uint64_t)>
 Callback to retrieve all historical orders associated with a specific Position ID.
 
using GetHistoryOrdersTotal = std::function< std::optional< int32_t >(int64_t, int64_t)>
 Callback to retrieve the total count of historical orders within a time range.
 
using GetHistoryDealsByRange = std::function< DealsData(int64_t, int64_t)>
 Callback to retrieve historical deals (executions) within a time range.
 
using GetHistoryDealsByGroup = std::function< DealsData(int64_t, int64_t, str &)>
 Callback to retrieve historical deals (executions) within a time range buy asset.
 
using GetHistoryDealsByTicket = std::function< DealsData(uint64_t)>
 Callback to retrieve historical deals associated with a specific Order Ticket.
 
using GetHistoryDealsByPosId = std::function< DealsData(uint64_t)>
 Callback to retrieve historical deals associated with a specific Position ID.
 
using GetHistoryDealsTotal = std::function< std::optional< int32_t >(int64_t, int64_t)>
 Callback to retrieve the total count of historical deals within a time range.
 

Enumerations

enum class  Timeframe : int32_t {
  M1 = 1 , M2 = 2 , M3 = 3 , M4 = 4 ,
  M5 = 5 , M6 = 6 , M10 = 10 , M12 = 12 ,
  M15 = 15 , M20 = 20 , M30 = 30 , H1 = 1 | 0x4000 ,
  H2 = 2 | 0x4000 , H3 = 3 | 0x4000 , H4 = 4 | 0x4000 , H6 = 6 | 0x4000 ,
  H8 = 8 | 0x4000 , H12 = 12 | 0x4000 , D1 = 24 | 0x4000 , W1 = 1 | 0x8000 ,
  MN1 = 1 | 0xC000
}
 Standard chart timeframes. More...
 
enum class  OrderType : int32_t {
  BUY = 0 , SELL = 1 , BUY_LIMIT = 2 , SELL_LIMIT = 3 ,
  BUY_STOP = 4 , SELL_STOP = 5 , BUY_STOP_LIMIT = 6 , SELL_STOP_LIMIT = 7 ,
  CLOSE_BY = 8
}
 Order types for market and pending orders. More...
 
enum class  OrderState : int32_t {
  STARTED = 0 , PLACED = 1 , CANCELED = 2 , PARTIAL = 3 ,
  FILLED = 4 , REJECTED = 5 , EXPIRED = 6 , REQUEST_ADD = 7 ,
  REQUEST_MODIFY = 8 , REQUEST_CANCEL = 9
}
 States of an order. More...
 
enum class  OrderFilling : int32_t { FOK = 0 , IOC = 1 , RETURN = 2 , BOC = 3 }
 Order filling policies. More...
 
enum class  OrderReason : int32_t {
  CLIENT = 0 , MOBILE = 1 , WEB = 2 , EXPERT = 3 ,
  SL = 4 , TP = 5 , SO = 6
}
 Reason or source for the order placement. More...
 
enum class  DealType : int32_t {
  BUY = 0 , SELL = 1 , BALANCE = 2 , CREDIT = 3 ,
  CHARGE = 4 , CORRECTION = 5 , BONUS = 6 , COMMISSION = 7 ,
  COMMISSION_DAILY = 8 , COMMISSION_MONTHLY = 9 , COMMISSION_AGENT_DAILY = 10 , COMMISSION_AGENT_MONTHLY = 11 ,
  INTEREST = 12 , BUY_CANCELED = 13 , SELL_CANCELED = 14 , DIVIDEND = 15 ,
  DIVIDEND_FRANKED = 16 , TAX = 17
}
 Types of deals involved in trading. More...
 
enum class  DealReason : int32_t {
  CLIENT = 0 , MOBILE = 1 , WEB = 2 , EXPERT = 3 ,
  SL = 4 , TP = 5 , SO = 6 , ROLLOVER = 7 ,
  VMARGIN = 8 , SPLIT = 9
}
 Reason for the deal execution. More...
 
enum class  TradeAction : int32_t {
  DEAL = 1 , PENDING = 5 , SLTP = 6 , MODIFY = 7 ,
  REMOVE = 8 , CLOSE_BY = 10
}
 Types of trade actions in a request. More...
 
enum class  SymbolCalcMode : int32_t {
  FOREX = 0 , FUTURES = 1 , CFD = 2 , CFDINDEX = 3 ,
  CFDLEVERAGE = 4 , FOREX_NO_LEVERAGE = 5 , EXCH_STOCKS = 32 , EXCH_FUTURES = 33 ,
  EXCH_OPTIONS = 34 , EXCH_OPTIONS_MARGIN = 36 , EXCH_BONDS = 37 , EXCH_STOCKS_MOEX = 38 ,
  EXCH_BONDS_MOEX = 39 , SERV_COLLATERAL = 64
}
 Mode of symbol margin and profit calculation. More...
 
enum class  SymbolTradeMode : int32_t {
  DISABLED = 0 , LONGONLY = 1 , SHORTONLY = 2 , CLOSEONLY = 3 ,
  FULL = 4
}
 Allowed trade modes for a symbol. More...
 
enum class  SymbolSwapMode : int32_t {
  DISABLED = 0 , POINTS = 1 , CURRENCY_SYMBOL = 2 , CURRENCY_MARGIN = 3 ,
  CURRENCY_DEPOSIT = 4 , INTEREST_CURRENT = 5 , INTEREST_OPEN = 6 , REOPEN_CURRENT = 7 ,
  REOPEN_BID = 8
}
 Swap calculation modes. More...
 
enum class  DayOfWeek : int32_t {
  SUNDAY = 0 , MONDAY = 1 , TUESDAY = 2 , WEDNESDAY = 3 ,
  THURSDAY = 4 , FRIDAY = 5 , SATURDAY = 6
}
 Days of the week.
 
enum class  SymbolGTCMode : int32_t { GTC = 0 , DAILY = 1 , DAILY_NO_STOPS = 2 }
 Expiration modes for Good-Till-Canceled orders.
 
enum class  OptionRight : int32_t { CALL = 0 , PUT = 1 }
 Option right type.
 
enum class  OptionMode : int32_t { EUROPEAN = 0 , AMERICAN = 1 }
 Option style.
 
enum class  AccountTradeMode : int32_t { DEMO = 0 , CONTEST = 1 , REAL = 2 }
 Account trade mode (Demo/Real).
 
enum class  AccountStopoutMode : int32_t { PERCENT = 0 , MONEY = 1 }
 Stop-out calculation mode.
 
enum class  AccountMarginMode : int32_t { RETAIL_NETTING = 0 , EXCHANGE = 1 , RETAIL_HEDGING = 2 }
 Account margin calculation mode.
 
enum class  BookType : int32_t { SELL = 1 , BUY = 2 , SELL_MARKET = 3 , BUY_MARKET = 4 }
 Order book entry type.
 
enum class  SymbolExecution : int32_t { REQUEST = 0 , INSTANT = 1 , MARKET = 2 , EXCHANGE = 3 }
 Symbol execution mode.
 
enum class  SymbolChartMode : int32_t { BID = 0 , LAST = 1 }
 Symbol chart price base.
 
enum class  DealEntry : int32_t { IN = 0 , OUT = 1 , INOUT = 2 , OUT_BY = 3 }
 Deal entry direction.
 
enum class  OrderTime : int32_t { GTC = 0 , DAY = 1 , SPECIFIED = 2 , SPECIFIED_DAY = 3 }
 Order expiration time flags.
 
enum class  PositionType : int32_t { BUY = 0 , SELL = 1 }
 Position type.
 
enum class  PositionReason : int32_t { CLIENT = 0 , MOBILE = 1 , WEB = 2 , EXPERT = 3 }
 Reason for position creation.
 
enum class  CopyTicks : int32_t { ALL = -1 , INFO = 1 , TRADE = 2 }
 Flags for copying ticks.
 
enum class  TickFlag : int32_t {
  BID = 0x02 , ASK = 0x04 , LAST = 0x08 , VOLUME = 0x10 ,
  BUY = 0x20 , SELL = 0x40
}
 Flags describing tick content. More...
 
enum class  TradeRetcode : int32_t {
  REQUOTE = 10004 , REJECT = 10006 , CANCEL = 10007 , PLACED = 10008 ,
  DONE = 10009 , DONE_PARTIAL = 10010 , ERROR = 10011 , TIMEOUT = 10012 ,
  INVALID = 10013 , INVALID_VOLUME = 10014 , INVALID_PRICE = 10015 , INVALID_STOPS = 10016 ,
  TRADE_DISABLED = 10017 , MARKET_CLOSED = 10018 , NO_MONEY = 10019 , PRICE_CHANGED = 10020 ,
  PRICE_OFF = 10021 , INVALID_EXPIRATION = 10022 , ORDER_CHANGED = 10023 , TOO_MANY_REQUESTS = 10024 ,
  NO_CHANGES = 10025 , SERVER_DISABLES_AT = 10026 , CLIENT_DISABLES_AT = 10027 , LOCKED = 10028 ,
  FROZEN = 10029 , INVALID_FILL = 10030 , CONNECTION = 10031 , ONLY_REAL = 10032 ,
  LIMIT_ORDERS = 10033 , LIMIT_VOLUME = 10034 , INVALID_ORDER = 10035 , POSITION_CLOSED = 10036 ,
  INVALID_CLOSE_VOLUME = 10038 , CLOSE_ORDER_EXIST = 10039 , LIMIT_POSITIONS = 10040 , REJECT_CANCEL = 10041 ,
  LONG_ONLY = 10042 , SHORT_ONLY = 10043 , CLOSE_ONLY = 10044 , FIFO_CLOSE = 10045
}
 Return codes from the trade server. More...
 
enum class  ReturnCode : int32_t {
  OK = 1 , FAIL = -1 , INVALID_PARAMS = -2 , NO_MEMORY = -3 ,
  NOT_FOUND = -4 , INVALID_VERSION = -5 , AUTH_FAILED = -6 , UNSUPPORTED = -7 ,
  AUTO_TRADING_DISABLED = -8 , INTERNAL_FAIL = -10000 , INTERNAL_FAIL_SEND = -10001 , INTERNAL_FAIL_RECEIVE = -10002 ,
  INTERNAL_FAIL_INIT = -10003 , INTERNAL_FAIL_CONNECT = -10004 , INTERNAL_FAIL_TIMEOUT = -10005
}
 Internal library return codes. More...
 
enum class  SymbolType : int32_t {
  FOREX = 0 , FUTURES = 1 , STOCKS = 2 , BONDS = 3 ,
  CRYPTO = 4 , ETFS = 5 , INDICES = 6 , COMMODITIES = 7 ,
  OPTIONS = 8 , UNKNOWN = 9
}
 Asset classes / Symbol types. More...
 

Functions

TickFlag operator| (TickFlag a, TickFlag b)
 Overload for TickFlag bitwise combination.
 
template<IsScopedEnum EnumClass>
constexpr auto operator+ (EnumClass a) noexcept
 Unary + operator to extract the underlying integer value of a scoped enum.
 

Detailed Description

Namespace containing MetaTrader 5 (MT5) client definitions and wrapper classes.

Namespace containing MetaTrader 5 (MT5) data structures, enumerations, and helper concepts.

Enumeration Type Documentation

◆ DealReason

enum class MT5::DealReason : int32_t
strong

Reason for the deal execution.

Enumerator
CLIENT 

Manually executed.

MOBILE 

Executed via mobile.

WEB 

Executed via web.

EXPERT 

Executed by EA.

SL 

Executed by Stop Loss.

TP 

Executed by Take Profit.

SO 

Executed by Stop Out.

ROLLOVER 

Rollover deal.

VMARGIN 

Variation margin.

SPLIT 

Split.

◆ DealType

enum class MT5::DealType : int32_t
strong

Types of deals involved in trading.

Enumerator
BUY 

Buy deal.

SELL 

Sell deal.

BALANCE 

Balance operation.

CREDIT 

Credit operation.

CHARGE 

Additional charge.

CORRECTION 

Correction deal.

BONUS 

Bonus deposit.

COMMISSION 

Commission charge.

COMMISSION_DAILY 

Daily commission.

COMMISSION_MONTHLY 

Monthly commission.

COMMISSION_AGENT_DAILY 

Daily agent commission.

COMMISSION_AGENT_MONTHLY 

Monthly agent commission.

INTEREST 

Interest rate charge.

BUY_CANCELED 

Canceled buy deal.

SELL_CANCELED 

Canceled sell deal.

DIVIDEND 

Dividend operation.

DIVIDEND_FRANKED 

Franked dividend.

TAX 

Tax charge.

◆ OrderFilling

enum class MT5::OrderFilling : int32_t
strong

Order filling policies.

Enumerator
FOK 

Fill or Kill: Execute fully or cancel.

IOC 

Immediate or Cancel: Execute available, cancel remainder.

RETURN 

Return: Execute available, keep remainder (standard)

◆ OrderReason

enum class MT5::OrderReason : int32_t
strong

Reason or source for the order placement.

Enumerator
CLIENT 

Manually placed by terminal.

MOBILE 

Placed via mobile app.

WEB 

Placed via web platform.

EXPERT 

Placed by Expert Advisor (script)

SL 

Triggered by Stop Loss.

TP 

Triggered by Take Profit.

SO 

Triggered by Stop Out.

◆ OrderState

enum class MT5::OrderState : int32_t
strong

States of an order.

Enumerator
STARTED 

Order checked, but not yet accepted by broker.

PLACED 

Order accepted.

CANCELED 

Order canceled by client.

PARTIAL 

Order partially executed.

FILLED 

Order fully executed.

REJECTED 

Order rejected.

EXPIRED 

Order expired.

REQUEST_ADD 

Order is being registered (internal)

REQUEST_MODIFY 

Order is being modified (internal)

REQUEST_CANCEL 

Order is being deleted (internal)

◆ OrderType

enum class MT5::OrderType : int32_t
strong

Order types for market and pending orders.

Enumerator
BUY 

Market Buy order.

SELL 

Market Sell order.

BUY_LIMIT 

Buy Limit pending order.

SELL_LIMIT 

Sell Limit pending order.

BUY_STOP 

Buy Stop pending order.

SELL_STOP 

Sell Stop pending order.

BUY_STOP_LIMIT 

Buy Stop Limit pending order.

SELL_STOP_LIMIT 

Sell Stop Limit pending order.

CLOSE_BY 

Order to close a position by an opposite one.

◆ ReturnCode

enum class MT5::ReturnCode : int32_t
strong

Internal library return codes.

Enumerator
OK 

Success.

FAIL 

Generic Failure.

INVALID_PARAMS 

Invalid Parameters.

NO_MEMORY 

Memory Allocation Error.

NOT_FOUND 

Not Found.

INVALID_VERSION 

Version Mismatch.

AUTH_FAILED 

Authentication Failed.

UNSUPPORTED 

Unsupported Operation.

AUTO_TRADING_DISABLED 

AutoTrading Disabled.

INTERNAL_FAIL 

Internal Failure.

INTERNAL_FAIL_SEND 

Internal Send Failure.

INTERNAL_FAIL_RECEIVE 

Internal Receive Failure.

INTERNAL_FAIL_INIT 

Internal Initialization Failure.

INTERNAL_FAIL_CONNECT 

Internal Connection Failure.

INTERNAL_FAIL_TIMEOUT 

Internal Timeout.

◆ SymbolCalcMode

enum class MT5::SymbolCalcMode : int32_t
strong

Mode of symbol margin and profit calculation.

Enumerator
FOREX 

Forex mode.

FUTURES 

Futures mode.

CFD 

CFD mode.

CFDINDEX 

CFD Index mode.

CFDLEVERAGE 

CFD Leverage mode.

FOREX_NO_LEVERAGE 

Forex without leverage.

EXCH_STOCKS 

Exchange Stocks.

EXCH_FUTURES 

Exchange Futures.

EXCH_OPTIONS 

Exchange Options.

EXCH_OPTIONS_MARGIN 

Exchange Options Margin.

EXCH_BONDS 

Exchange Bonds.

EXCH_STOCKS_MOEX 

MOEX Stocks.

EXCH_BONDS_MOEX 

MOEX Bonds.

SERV_COLLATERAL 

Collateral.

◆ SymbolSwapMode

enum class MT5::SymbolSwapMode : int32_t
strong

Swap calculation modes.

Enumerator
DISABLED 

No swaps.

POINTS 

Swaps in points.

CURRENCY_SYMBOL 

Swaps in symbol base currency.

CURRENCY_MARGIN 

Swaps in margin currency.

CURRENCY_DEPOSIT 

Swaps in deposit currency.

INTEREST_CURRENT 

Interest current.

INTEREST_OPEN 

Interest open.

REOPEN_CURRENT 

Reopen current.

REOPEN_BID 

Reopen bid.

◆ SymbolTradeMode

enum class MT5::SymbolTradeMode : int32_t
strong

Allowed trade modes for a symbol.

Enumerator
DISABLED 

Trading disabled.

LONGONLY 

Long only allowed (Note: likely maps to LONGONLY)

SHORTONLY 

Short only allowed.

CLOSEONLY 

Only closing allowed.

FULL 

No restrictions.

◆ SymbolType

enum class MT5::SymbolType : int32_t
strong

Asset classes / Symbol types.

Enumerator
FOREX 

Forex currency pairs.

FUTURES 

Futures contracts.

STOCKS 

Stocks and shares.

BONDS 

Bonds.

CRYPTO 

Cryptocurrencies.

ETFS 

Exchange-Traded Funds.

INDICES 

Market indices.

COMMODITIES 

Commodities.

OPTIONS 

Options contracts.

UNKNOWN 

Unknown or unsupported type.

◆ TickFlag

enum class MT5::TickFlag : int32_t
strong

Flags describing tick content.

Enumerator
BID 

Tick changed Bid price.

ASK 

Tick changed Ask price.

LAST 

Tick changed Last price.

VOLUME 

Tick changed Volume.

BUY 

Tick is a result of a buy deal.

SELL 

Tick is a result of a sell deal.

◆ Timeframe

enum class MT5::Timeframe : int32_t
strong

Standard chart timeframes.

Enumerator
M1 

1 Minute

M2 

2 Minutes

M3 

3 Minutes

M4 

4 Minutes

M5 

5 Minutes

M6 

6 Minutes

M10 

10 Minutes

M12 

12 Minutes

M15 

15 Minutes

M20 

20 Minutes

M30 

30 Minutes

H1 

1 Hour

H2 

2 Hours

H3 

3 Hours

H4 

4 Hours

H6 

6 Hours

H8 

8 Hours

H12 

12 Hours

D1 

1 Day

W1 

1 Week

MN1 

1 Month

◆ TradeAction

enum class MT5::TradeAction : int32_t
strong

Types of trade actions in a request.

Enumerator
DEAL 

Place a market order (instant execution)

PENDING 

Place a pending order.

SLTP 

Modify Stop Loss / Take Profit.

MODIFY 

Modify pending order price/expiry.

REMOVE 

Remove pending order.

CLOSE_BY 

Close position by opposite position.

◆ TradeRetcode

enum class MT5::TradeRetcode : int32_t
strong

Return codes from the trade server.

Enumerator
REQUOTE 

Requote.

REJECT 

Request rejected.

CANCEL 

Request canceled by trader.

PLACED 

Order placed.

DONE 

Request completed.

DONE_PARTIAL 

Only part of the request completed.

ERROR 

Request processing error.

TIMEOUT 

Request canceled by timeout.

INVALID 

Invalid request.

INVALID_VOLUME 

Invalid volume in the request.

INVALID_PRICE 

Invalid price in the request.

INVALID_STOPS 

Invalid stops in the request.

TRADE_DISABLED 

Trade is disabled.

MARKET_CLOSED 

Market is closed.

NO_MONEY 

There is not enough money to request.

PRICE_CHANGED 

Prices changed.

PRICE_OFF 

There are no quotes to process the request.

INVALID_EXPIRATION 

Invalid order expiration date in the request.

ORDER_CHANGED 

Order state changed.

TOO_MANY_REQUESTS 

Too many frequent requests.

NO_CHANGES 

No changes in request.

SERVER_DISABLES_AT 

Autotrading disabled by server.

CLIENT_DISABLES_AT 

Autotrading disabled by client terminal.

LOCKED 

Request locked for processing.

FROZEN 

Order or position frozen.

INVALID_FILL 

Invalid order filling type.

CONNECTION 

No connection with the trade server.

ONLY_REAL 

Operation is allowed only for live accounts.

LIMIT_ORDERS 

The number of pending orders has reached the limit.

LIMIT_VOLUME 

The volume for the symbol has reached the limit.

INVALID_ORDER 

Incorrect or prohibited order type.

POSITION_CLOSED 

Position with the specified ticket is already closed.

INVALID_CLOSE_VOLUME 

A volume to close exceeds the current position volume.

CLOSE_ORDER_EXIST 

A close order already exists for the specified position.

LIMIT_POSITIONS 

The number of open positions has reached the limit.

REJECT_CANCEL 

The pending order is currently being activated, cancel is rejected.

LONG_ONLY 

The request is rejected, only long positions are allowed.

SHORT_ONLY 

The request is rejected, only short positions are allowed.

CLOSE_ONLY 

The request is rejected, only position closing is allowed.

FIFO_CLOSE 

Position closing is allowed only by FIFO rule.

Function Documentation

◆ operator+()

template<IsScopedEnum EnumClass>
constexpr auto MT5::operator+ ( EnumClass  a)
constexprnoexcept

Unary + operator to extract the underlying integer value of a scoped enum.

Template Parameters
EnumClassA scoped enumeration type.
Parameters
aThe enum value.
Returns
The underlying integer value.