MT4 managerAPI 接口(头文件)

本文详细介绍了MT4 Manager API的功能及使用方法,包括各种配置结构、交易记录、符号信息等,为开发者提供了全面的API使用指南。

 以下是MT4官方managerAPI的头文件,具体是什么功能看方法名字还是比较好理解的,

可以直接保存为.h文件导入到自己工程中使用

//+------------------------------------------------------------------+
//|                                         MetaTrader 4 Manager API |
//|                   Copyright 2001-2015, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
//|                   DO NOT EDIT THIS FILE!!!                       |
//+------------------------------------------------------------------+
// NoStyler
#pragma once
//+------------------------------------------------------------------+
//|                        API Version                               |
//+------------------------------------------------------------------+
#define ManAPIProgramVersion  400
#define ManAPIProgramBuild    920
#define ManAPIVersion         MAKELONG(ManAPIProgramBuild,ManAPIProgramVersion)
//+------------------------------------------------------------------+
//| MSVS6 Compatibility                                              |
//+------------------------------------------------------------------+
#if _MSC_VER <= 1200
#define __time32_t time_t
#define __ptr32
#endif
//+------------------------------------------------------------------+
//|                   Server Configurations                          |
//+------------------------------------------------------------------+
//| Configuration types                                              |
//+------------------------------------------------------------------+
enum
  {
   CONFIG_ALL=0,                             // all configurations
   CONFIG_COMMON,                            // common configuration
   CONFIG_ACCESS,                            // IP access list configuration
   CONFIG_SERVERS,                           // data servers
   CONFIG_TIME,                              // working time configuration
   CONFIG_HOLIDAYS,                          // holidays configuration
   CONFIG_SYMBOLS,                           // symbols configuration
   CONFIG_SYMB_GROUPS,                       // securities configuration
   CONFIG_GROUPS,                            // groups configuration
   CONFIG_MANAGERS,                          // manager's rights configuration
   CONFIG_DATAFEEDS,                         // data feeds configuration
   CONFIG_BACKUP,                            // backups configuration
   CONFIG_LIVEUPDATE,                        // LiveUpdate configuration
   CONFIG_SYNC,                              // synchronization configuration
   CONFIG_PLUGINS,                           // plugins configuration
   CONFIG_GATEWAY_ACCOUNTS,                  // gateway accounts
   CONFIG_GATEWAY_MARKUPS,                   // gateway markups
   CONFIG_GATEWAY_RULES,                     // gateway rules
   CONFIG_END=255                            // last (unused)
  };
//+------------------------------------------------------------------+
//| Configuration structures                                         |
//+------------------------------------------------------------------+
//| Common configuration                                             |
//+------------------------------------------------------------------+
struct ConCommon
  {
   char              owner[128];            // servers owner (include version & build)
   char              name[32];              // server name
   ULONG             address;               // IP address assigned to the server
   int               port;                  // port
   DWORD             timeout;               // sockets timeout
   int               typeofdemo;            // demo-accounts type (DEMO_DISABLED, DEMO_PROLONG, DEMO_FIXED)
   int               timeofdemo;            // demo-account living time
   int               daylightcorrection;    // allow daylight correction
   char              internal[64];          // reserved
   int               timezone;              // time zone 0-GMT;-1=GMT-1;1=GMT+1;
   char              timesync[64];          // time synchronization server address
   //---
   int               minclient;             // minimal authorized client version
   int               minapi;                // minimal authorized client version
   DWORD             feeder_timeout;        // data feed switch timeout
   int               keepemails;            // internal mail keep period
   int               endhour,endminute;     // end of day time-hour & minute
   //---
   int               optimization_time;     // optimization start time (minutes)
   int               optimization_lasttime; // optimization last time
   int               optimization_counter;  // internal variable
   int               optimization_unused[8];// reserved for future use
   //---
   int               antiflood;             // enable antiflood control
   int               floodcontrol;          // max. antiflood connections
   //---
   int               liveupdate_mode;       // LiveUpdate mode (LIVE_UPDATE_NO,LIVE_UPDATE_ALL,LIVE_UPDATE_NO_SERVER)
   //---
   int               lastorder;             // last order's ticket     (read only)
   int               lastlogin;             // last account's number   (read only)
   int               lostlogin;             // lost commission's login (read only)
   //---
   int               rollovers_mode;        // rollover mode (ROLLOVER_NORMAL,ROLLOVER_REOPEN_BY_CLOSE_PRICE,ROLLOVER_REOPEN_BY_BID)
   //---
   char              path_database[256];    // path to databases
   char              path_history[256];     // path to history bases
   char              path_log[256];         // path to log
   //--- overnigths
   __time32_t        overnight_last_day;    // day of last overnight
   __time32_t        overnight_last_time;   // time of last overnight
   __time32_t        overnight_prev_time;   // time of время next to last overnight
   //--- month reports
   __time32_t        overmonth_last_month;  // month of last report
   //--- performance base
   char              adapters[256];         // network adapters list (read-only)
   ULONG             bind_adresses[8];      // array of avaible IP addresses
   short             server_version;        // server version
   short             server_build;          // server build
   ULONG             web_adresses[8];       // web services access list (comma separated IP addresses)
   int               statement_mode;        // statement generation time (STATEMENT_END_DAY,STATEMENT_START_DAY)
   int               monthly_state_mode;    // monthly statement generation day (MONTHLY_STATEMENT_END_MONTH,MONTHLY_STATEMENT_START_MONTH)
   int               keepticks;             // ticks keep period
   int               statement_weekend;     // generate statements at weekends
   __time32_t        last_activate;         // last activation datetime
   __time32_t        stop_last;             // last stop datetime
   int               stop_delay;            // last stop delay
   int               stop_reason;           // last stop reason STOP_REASON_NONE, STOP_REASON_RESTART, STOP_REASON_SHUTDOWN, STOP_REASON_LIVEUPDATE
   char              account_url[128];      // account allocation URL
   int               reserved[16];
  };
//--- deno-accounts type
enum { DEMO_DISABLED, DEMO_PROLONG, DEMO_FIXED };
//--- rollover mode
enum { ROLLOVER_NORMAL, ROLLOVER_REOPEN_BY_CLOSE_PRICE, ROLLOVER_REOPEN_BY_BID };
//--- LiveUpdate mode
enum { LIVE_UPDATE_NO=0, LIVE_UPDATE_RELEASE=1, LIVE_UPDATE_NO_SERVER=2, LIVE_UPDATE_BETA=3 };
//--- statement mode
enum { STATEMENT_END_DAY, STATEMENT_START_DAY };
//--- monthly statement mode
enum { MONTHLY_STATEMENT_END_MONTH, MONTHLY_STATEMENT_START_MONTH };
//--- server stop reason
enum { STOP_REASON_NONE, STOP_REASON_RESTART, STOP_REASON_SHUTDOWN, STOP_REASON_LIVEUPDATE };
//+------------------------------------------------------------------+
//| Access configuration                                             |
//+------------------------------------------------------------------+
struct ConAccess
  {
   int               action;                // type of action (FW_BLOCK,FW_PERMIT)
   unsigned long     from,to;               // from, to addresses
   char              comment[64];           // comment
   int               reserved[17];          // reserved
  };
//--- access action
enum { FW_BLOCK,FW_PERMIT };
//+------------------------------------------------------------------+
//| Data Servers configuration                                       |
//+------------------------------------------------------------------+
struct ConDataServer
  {
   char              server[64];             // server address (server:ip)
   ULONG             ip;                     // server IP
   char              description[64];        // server description
   int               isproxy;                // can server be proxy?
   int               priority;               // priority: 0-7 base, 255-idle
   UINT              loading;                // server loading (UINT_MAX-server does not inform its loading)
   ULONG             ip_internal;            // internal IP address
   int               reserved[2];            // reserved
   ConDataServer* __ptr32 next;                   // internal (not used)
  };
//+------------------------------------------------------------------+
//| Time configuration                                               |
//+------------------------------------------------------------------+
struct ConTime
  {
   int               days[7][24];           // server's accessebility (7 days-24 hours, 0-denied, 1-allowed)
   int               dayscontrol;           // internal variable
   int               reserved[3];           // reserved
  };
//+------------------------------------------------------------------+
//| Backup configuration                                             |
//+------------------------------------------------------------------+
struct ConBackup
  {
   //---
   char              fullbackup_path[256];   // path to backup
   int               fullbackup_period;      // full backup's period-BACKUP_1HOUR, BACKUP_4HOURS, BACKUP_1DAY
   int               fullbackup_store;       // full backup's store time-BU_STORE_1MONTH, BU_STORE_3MONTHS, BU_STORE_6MONTHS,BU_STORE_1YEAR
   __time32_t        fullbackup_lasttime;    // full backup's last execution time
   short             fullbackup_shift;       // full backup timeshift (minutes)
   //---
   char              external_path[256];     // path to external processing directory
   //---
   int               archive_period;         // period of archive backup-ARC_BACKUP_5MIN, ARC_BACKUP_15MIN, ARC_BACKUP_30MIN, ARC_BACKUP_1HOUR
   int               archive_store;          // archive backup's store time-ARC_STORE_1WEEK, ARC_STORE_2WEEKS, ARC_STORE_1MONTH, ARC_STORE_3MONTH, ARC_STORE_6MONTH
   __time32_t        archive_lasttime;       // archive backup's last execution time
   //---
   char              export_securities[512]; // comma separated list of exported securities
   char              export_path[256];       // path to export script
   int               export_period;          // export period-enumeration EXPORT_1MIN, EXPORT_5MIN, EXPORT_15MIN, EXPORT_30MIN,EXPORT_1HOUR
   __time32_t        export_lasttime;        // export's last execution time
   //--- watch dog
   int               watch_role;             // server role { WATCH_STAND_ALONE, WATCH_MASTER, WATCH_SLAVE }
   char              watch_password[16];     // slave server password
   char              watch_opposite[24];     // opposite server IP address and port
   int               watch_ip;               // opposite server IP
   //--- 
   char              archive_shift;          // shift of archive backup time (in minutes)
   //---
   char              watch_state;            // watch dog state
   char              watch_failover;         // watch dog failover mode
   unsigned char     watch_timeout;          // watch dog timeout
   int               watch_login;            // watch dog login
   __time32_t        watch_timestamp;        // watch dog timestamp
  };
//--- server role
enum { WATCH_STAND_ALONE,WATCH_MASTER,WATCH_SLAVE };
//--- full backup execution periods: 1 hour, 4 hours, 1 day
enum { BACKUP_1HOUR,BACKUP_4HOURS,BACKUP_1DAY };
//--- full backup store period: 1 month, 3 months, 6 months, 1 year
enum { BU_STORE_1MONTH,BU_STORE_3MONTHS,BU_STORE_6MONTHS,BU_STORE_1YEAR };
//--- arc. backup execution periods: 5 min, 15 min, 30 min, 1 hour
enum { ARC_BACKUP_DISABLED,ARC_BACKUP_5MIN,ARC_BACKUP_15MIN,ARC_BACKUP_30MIN,ARC_BACKUP_1HOUR };
//--- arc. backup store period: 1 day, 3 days, 1 week, 2 weeks, 1 month,3 months, 6 months,1 year
enum { ARC_STORE_1DAY,ARC_STORE_3DAYS,ARC_STORE_1WEEK,ARC_STORE_2WEEKS,ARC_STORE_1MONTH,ARC_STORE_3MONTH,ARC_STORE_6MONTH };
//--- export execution period: 1 min, 5 min, 15 min, 30 min, 1 hour
enum { EXPORT_1MIN,EXPORT_5MIN,EXPORT_15MIN,EXPORT_30MIN,EXPORT_1HOUR };
//--- watchdog state
enum { WS_DISCONNECTED, WS_SYNCHRONIZING, WS_SYNCHRONIZED };
//--- watchdog failover mode
enum { FAILOVER_OFF, FAILOVER_MOST, FAILOVER_FULL };
//+------------------------------------------------------------------+
//| Datafeed configuration                                           |
//+------------------------------------------------------------------+
struct ConFeeder
  {
   char              name[64];              // name
   char              file[256];             // datafeed filename
   char              server[64];            // server address
   char              login[32];             // datafeed login
   char              pass[32];              // datafeed password
   char              keywords[256];         // keywords (news filtration)
   int               enable;                // enable feeder
   int               mode;                  // datafeed mode-enumeration FEED_QUOTES, FEED_NEWS, FEED_QUOTESNEWS
   int               timeout;               // max. freeze time (default ~120 sec.)
   int               timeout_reconnect;     // reconnect timeout before attemps_sleep connect attempts (default ~ 5  sec)
   int               timeout_sleep;         // reconnect timeout after attemps_sleep connect attempts  (default ~ 60 sec)
   int               attemps_sleep;         // reconnect count (see timeout_reconnect & timeout_sleep)
   int               news_langid;           // news language id
   int               unused[33];            // reserved
  };
//--- datafeed modes-receive quotes, receive news, receive quotes and news
enum { FEED_QUOTES=0, FEED_NEWS=1, FEED_QUOTESNEWS=2 };
//+------------------------------------------------------------------+
//| Security group configuration for client group                    |
//+------------------------------------------------------------------+
#define MAX_SEC_GROUPS       (32)
#define MAX_SEC_GROPS_MARGIN (128)
//---
struct ConGroupSec
  {
   int               show,trade;            // enable show and trade for this group of securites
   int               execution;             // dealing mode-EXECUTION_MANUAL,EXECUTION_AUTO,EXECUTION_ACTIVITY
   //--- comission settings
   double            comm_base;             // standart commission
   int               comm_type;             // commission type-COMM_TYPE_MONEY,COMM_TYPE_PIPS,COMM_TYPE_PERCENT
   int               comm_lots;             // commission lots mode-COMMISSION_PER_LOT,COMMISSION_PER_DEAL
   double            comm_agent;            // agent commission
   int               comm_agent_type;       // agent commission mode-COMM_TYPE_MONEY, COMM_TYPE_PIPS
   //---
   int               spread_diff;           // spread difference in compare with default security spread
   //---
   int               lot_min,lot_max;       // allowed minimal and maximal lot values
   int               lot_step;              // allowed step value (10 lot-1000, 1 lot-100, 0.1 lot-10)
   int               ie_deviation;          // maximum price deviation in Instant Execution mode
   int               confirmation;          // use confirmation in Request mode
   int               trade_rights;          // clients trade rights-bit mask see TRADE_DENY_NONE,TRADE_DENY_CLOSEBY,TRADE_DENY_MUCLOSEBY
   int               ie_quick_mode;         // do not resend request to the dealer when client uses deviation
   int               autocloseout_mode;     // auto close-out method { CLOSE_OUT_NONE, CLOSE_OUT_HIHI, CLOSE_OUT_LOLO, CLOSE_OUT_HILO, CLOSE_OUT_LOHI, CLOSE_OUT_LOHI, CLOSE_OUT_FIFO, CLOSE_OUT_LIFO, CLOSE_OUT_INTRDAY_FIFO }
   double            comm_tax;              // commission taxes
   int               comm_agent_lots;       // agent commission per lot/per deal { COMMISSION_PER_LOT,COMMISSION_PER_DEAL }
   int               freemargin_mode;       // "soft" margin check
   int               reserved[3];           // reserved
  };
//+------------------------------------------------------------------+
//| Special securities configurations for client group               |
//+------------------------------------------------------------------+
struct ConGroupMargin
  {
   char              symbol[12];            // security
   double            swap_long,swap_short;  // swap size for long and short positions
   double            margin_divider;        // margin divider
   int               reserved[7];
  };
//--- dealing mode
enum { EXECUTION_MANUAL, EXECUTION_AUTO, EXECUTION_ACTIVITY };
//--- commission type
enum { COMM_TYPE_MONEY, COMM_TYPE_PIPS, COMM_TYPE_PERCENT };
//--- comission lots mode
enum { COMMISSION_PER_LOT, COMMISSION_PER_DEAL };
//--- clients trade rights
enum { TRADE_DENY_NONE=0, TRADE_DENY_CLOSEBY=1, TRADE_DENY_MUCLOSEBY=2 };
//--- auto close-out method
enum { CLOSE_OUT_NONE, CLOSE_OUT_HIHI, CLOSE_OUT_LOLO, CLOSE_OUT_HILO, CLOSE_OUT_LOHI, CLOSE_OUT_FIFO, CLOSE_OUT_LIFO, CLOSE_OUT_INTRDAY_FIFO };
//+------------------------------------------------------------------+
//| Client group configuration                                       |
//+------------------------------------------------------------------+
struct ConGroup
  {
   //--- common settings
   char              group[16];                   // group name
   int               enable;                      // enable group
   int               timeout;                     // trade confirmation timeout (seconds)
   int               otp_mode;                    // one-time password mode
   //--- statements
   char              company[128];                // company name
   char              signature[128];              // statements signature
   char              support_page[128];           // company support page
   char              smtp_server[64];             // statements SMTP server
   char              smtp_login[32];              // statements SMTP login
   char              smtp_password[32];           // statements SMTP password
   char              support_email[64];           // support email
   char              templates[32];               // path to directory with custom templates
   int               copies;                      // copy statements on support email
   int               reports;                     // enable statements
   //--- default settings
   int               default_leverage;            // default leverage (user don't specify leverage himself)
   double            default_deposit;             // default deposit  (user don't specify balance  himself)
   //--- securities
   int               maxsecurities;               // maximum simultaneous securities
   ConGroupSec       secgroups[MAX_SEC_GROUPS];   // security group settings
   ConGroupMargin    secmargins[MAX_SEC_GROPS_MARGIN]; // special securities settings
   int               secmargins_total;            // count of special securities settings
   //--- margin & interest
   char              currency[12];                // deposit currency
   double            credit;                      // virtual credit
   int               margin_call;                 // margin call
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值