forked from wlwqzww/MT4-Manager-API
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MT4ManagerAPI.h
1848 lines (1846 loc) · 101 KB
/
MT4ManagerAPI.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//+------------------------------------------------------------------+
//| MetaTrader 4 Manager API |
//| Copyright 2001-2017, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
//| DO NOT EDIT THIS FILE!!! |
//+------------------------------------------------------------------+
// NoStyler
#pragma once
//+------------------------------------------------------------------+
//| API Version |
//+------------------------------------------------------------------+
#define ManAPIProgramVersion 400
#define ManAPIProgramBuild 1090
#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[60]; // reserved
int timezone_real; // time zone with day light mode
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
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 level (percents)
int margin_mode; // margin mode-MARGIN_DONT_USE,MARGIN_USE_ALL,MARGIN_USE_PROFIT,MARGIN_USE_LOSS
int margin_stopout; // stop out level
double interestrate; // annual interest rate (percents)
int use_swap; // use rollovers & interestrate
//--- rights
int news; // news mode
int rights; // rights bit mask-ALLOW_FLAG_EMAIL
int check_ie_prices; // check IE prices on requests
int maxpositions; // maximum orders and open positions
int close_reopen; // partial close mode (if !=0 original position will be fully closed and remain position will be fully reopened)
int hedge_prohibited; // hedge prohibition flag
int close_fifo; // fifo rule
int hedge_largeleg; // use large leg margin for hedged positions
int unused_rights[2]; // reserved
char securities_hash[16]; // internal data
//---
int margin_type; // margin controlling type { MARGIN_TYPE_PERCENT, MARGIN_TYPE_CURRENCY }
//--- archives
int archive_period; // inactivity period after which account moves to archive base (in days)
int archive_max_balance; // maxumum balance of accounts to move in archive base
//---
int stopout_skip_hedged; // skip fully hedged accounts when checking for stopout
int archive_pending_period; // pendings clean period
//--- allowed news languages
UINT news_languages[8]; // LANGID array
UINT news_languages_total; // news languages total
//--- reserved
int reserved[17];
};
//--- margin calculation mode
enum { MARGIN_MODE_DONT_USE,MARGIN_MODE_USE_ALL,MARGIN_MODE_USE_PROFIT,MARGIN_MODE_USE_LOSS };
//--- margin controlling type
enum { MARGIN_TYPE_PERCENT, MARGIN_TYPE_CURRENCY };
//--- news mode-no news, only topics, full news (topic+body)
enum { NEWS_NO, NEWS_TOPICS, NEWS_FULL };
//--- group rights
enum
{
ALLOW_FLAG_EMAIL =1,
ALLOW_FLAG_TRAILING =2,
ALLOW_FLAG_ADVISOR =4,
ALLOW_FLAG_EXPIRATION =8,
ALLOW_FLAG_SIGNALS_ALL =16,
ALLOW_FLAG_SIGNALS_OWN =32,
ALLOW_FLAG_RISK_WARNING =64,
ALLOW_FLAG_FORCED_OTP_USAGE=128,
};
//--- group one-time password mode
enum
{
OTP_MODE_DISABLED =0,
OTP_MODE_TOTP_SHA256 =1,
};
//+------------------------------------------------------------------+
//| Hollidays configuration |
//+------------------------------------------------------------------+
struct ConHoliday
{
int year; // year
int month; // month
int day; // day
int from,to; // work time-from & to (minutes)
char symbol[32]; // security name or symbol's group name or "All"
char description[128]; // description
int enable; // enable
int reserved[13]; // reserved
ConHoliday * __ptr32 next; // internal data
};
//+------------------------------------------------------------------+
//| LiveUpdate configuration |
//+------------------------------------------------------------------+
#define LIVE_FILES_MAX (128)
//---
struct LiveInfoFile
{
char file[256]; // file name
int size; // file size
char hash[36]; // file hash
int reserved[10]; // reserved
};
//---
struct ConLiveUpdate
{
char company[128]; // company
char path[256]; // path to LiveUpdate
int version; // version
int build; // build
int maxconnect; // max. simultaneous connections
int connections; // current connections (read only)
int type; // type LIVE_UPDATE_*
int enable; // enable
int totalfiles; // total files count
LiveInfoFile files[LIVE_FILES_MAX]; // files' configurations
int reserved[16]; // reserved
ConLiveUpdate * __ptr32 next; // internal data
};
//--- LiveUpdate type
enum
{
LIVE_UPDATE_CLIENT,
LIVE_UPDATE_MANAGER,
LIVE_UPDATE_ADMIN,
LIVE_UPDATE_DATACENTER,
LIVE_UPDATE_CLIENT_PPC2002,
LIVE_UPDATE_CLIENT_PPC2003,
LIVE_UPDATE_MULTI,
LIVE_UPDATE_WD,
LIVE_UPDATE_CLIENT_PHONE,
LIVE_UPDATE_LAST
};
//+------------------------------------------------------------------+
//| Manager rights for security groups |
//+------------------------------------------------------------------+
struct ConManagerSec
{
int internal; // internal data
int enable; // enable
int minimum_lots; // min. lots
int maximum_lots; // max. lots
int unused[16]; // reserved
};
//+------------------------------------------------------------------+
//| Manager configuration |
//+------------------------------------------------------------------+
struct ConManager
{
int login; // login
//--- rights
int manager; // right to add & change client records
int money; // right to balance & credit management
int online; // right to see online users
int riskman; // right to use analyzer
int broker; // right to deal
int admin; // right to server administration
int logs; // right to see logs
int reports; // right to see reports
int trades; // right to add/modify/delete trades
int market_watch; // right to change spread, spread balance, stop levels, execution mode and send quotes
int email; // right to send internal mail
int user_details; // right to see clients private data-name,country,address,phone,email etc.
int see_trades; // right to see trades
int news; // right to send news
int plugins; // right to configure plugins
int server_reports; // right to receive server reports
int techsupport; // right to access to technical support page
int market; // right to access server applications market
int notifications; // right to push notifications
int unused[9];
//--- IP filtration
int ipfilter; // enable IP control
unsigned long ip_from,ip_to; // range of allowed IPs
//---
char mailbox[64]; // name of mailbox for internal mail
char groups[1024]; // comma separated list of managed groups (allowed '*' wildcard)
ConManagerSec secgroups[MAX_SEC_GROUPS]; // manager rights for security groups
DWORD exp_time; // internal data
char name[32]; // manager name (read only)
int info_depth; // maximum available data (in days)
//---
int reserved[22];
};
//+------------------------------------------------------------------+
//| Symbol configurations |
//+------------------------------------------------------------------+
//| Symbol sessions configurations |
//+------------------------------------------------------------------+
struct ConSession
{
short open_hour,open_min; // session open time: hour & minute
short close_hour,close_min; // session close time: hour & minute
int open,close; // internal data
short align[7]; // internal data
};
//---
struct ConSessions
{
//---
ConSession quote[3]; // quote sessions
ConSession trade[3]; // trade sessions
//---
int quote_overnight; // internal data
int trade_overnight; // internal data
int reserved[2]; // reserved
};
//+------------------------------------------------------------------+
//| Symbol configuration |
//+------------------------------------------------------------------+
#define MAX_SYMBOLS 1024
//---
struct ConSymbol
{
//--- common settings
char symbol[12]; // name
char description[64]; // description
char source[12]; // synonym
char currency[12]; // currency
int type; // security group (see ConSymbolGroup)
int digits; // security precision
int trade; // trade mode
//--- external settings
COLORREF background_color; // background color
int count; // symbols index
int count_original; // symbols index in market watch
int external_unused[7];
//--- sessions
int realtime; // allow real time quotes
__time32_t starting; // trades starting date (UNIX time)
__time32_t expiration; // trades end date (UNIX time)
ConSessions sessions[7]; // quote & trade sessions
//--- profits
int profit_mode; // profit calculation mode
int profit_reserved; // reserved
//--- filtration
int filter; // filter value
int filter_counter; // filtration parameter
double filter_limit; // max. permissible deviation from last quote (percents)
int filter_smoothing; // smoothing
float filter_reserved; // reserved
int logging; // enable to log quotes
//--- spread & swaps
int spread; // spread
int spread_balance; // spread balance
int exemode; // execution mode
int swap_enable; // enable swaps
int swap_type; // swap type
double swap_long,swap_short; // swaps values for long & short postions
int swap_rollover3days; // triple rollover day-0-Monday,1-Tuesday...4-Friday
double contract_size; // contract size
double tick_value; // one tick value
double tick_size; // one tick size
int stops_level; // stops deviation value
//---
int gtc_pendings; // GTC mode { ORDERS_DAILY, ORDERS_GTC, ORDERS_DAILY_NO_STOPS }
//--- margin calculation
int margin_mode; // margin calculation mode
double margin_initial; // initial margin
double margin_maintenance; // margin maintenance
double margin_hedged; // hedged margin
double margin_divider; // margin divider
//--- calclulated variables (internal data)
double point; // point size-(1/(10^digits)
double multiply; // multiply 10^digits
double bid_tickvalue; // tickvalue for bid
double ask_tickvalue; // tickvalue for ask
//---
int long_only; // allow only BUY positions
int instant_max_volume; // max. volume for Instant Execution
//---
char margin_currency[12]; // currency of margin requirments
int freeze_level; // modification freeze level
int margin_hedged_strong; // strong hedged margin mode
__time32_t value_date; // value date
int quotes_delay; // quotes delay after session start
int swap_openprice; // use open price at swaps calculation in SWAP_BY_INTEREST mode
int swap_variation_margin; // charge variation margin on rollover
//---
int unused[21]; // reserved
};
//+------------------------------------------------------------------+
//| Symbols enumeration |
//+------------------------------------------------------------------+
//--- symbol execution mode
enum { EXE_REQUEST,EXE_INSTANT,EXE_MARKET };
//--- trade mode
enum { TRADE_NO,TRADE_CLOSE,TRADE_FULL };
//--- swap type
enum { SWAP_BY_POINTS,SWAP_BY_DOLLARS,SWAP_BY_INTEREST,SWAP_BY_MARGIN_CURRENCY };
//--- profit calculation mode
enum { PROFIT_CALC_FOREX,PROFIT_CALC_CFD,PROFIT_CALC_FUTURES };
//--- margin calculation mode
enum { MARGIN_CALC_FOREX,MARGIN_CALC_CFD,MARGIN_CALC_FUTURES,MARGIN_CALC_CFDINDEX,MARGIN_CALC_CFDLEVERAGE };
//--- GTC mode
enum { ORDERS_DAILY, ORDERS_GTC, ORDERS_DAILY_NO_STOPS };
//+------------------------------------------------------------------+
//| Symbol groups |
//+------------------------------------------------------------------+
#define MAX_SEC_GROUP (32)
struct ConSymbolGroup
{
char name[16]; // group name
char description[64]; // group description
};
//+------------------------------------------------------------------+
//| Synchronization configuration |
//+------------------------------------------------------------------+
struct ConSync
{
char server[64]; // name (address
int unusedport; // port
char login[32]; // for future use-login
char password[32]; // for future use=password
int enable; // enable sychronization
int mode; // synchronization mode: HB_ADD,HB_UPDATE,HB_INSERT
__time32_t from,to; // synchronization range (<0-whole chart)
char securities[1024]; // symbols list
int timecorrection; // time correction in minutes
int reserved[13]; // reserved
ConSync * __ptr32 next; // internal (do not use)
};
//--- synchronization mode
enum { HB_ADD,HB_UPDATE,HB_INSERT,HB_DELETE,HB_LAST };
//+------------------------------------------------------------------+
//| Plugin configuration |
//+------------------------------------------------------------------+
//| Plugin description |
//+------------------------------------------------------------------+
struct PluginInfo
{
char name[128]; // plugin name
unsigned int version; // plugin version
char copyright[128]; // plugin copyright
int reserved[32]; // reserved
};
//+------------------------------------------------------------------+
//| Plugin configuration parameter |
//+------------------------------------------------------------------+
struct PluginCfg
{
char name[32]; // parameter name
char value[128]; // parameter value
int reserved[16]; // reserved
};
//+------------------------------------------------------------------+
//| Plugin configuration |
//+------------------------------------------------------------------+
struct ConPlugin
{
char file[256]; // plugin file name
PluginInfo info; // plugin description
int enabled; // plugin enabled/disabled
int configurable; // is plugin configurable
int manager_access; // plugin can be accessed from manager terminal
int reserved[62]; // reserved
};
//--- plugin with parameters
struct ConPluginParam
{
ConPlugin plugin; // plugin configuration
PluginCfg* __ptr32 params; // plugin parameters
int total; // total plugin parameters
};
//+------------------------------------------------------------------+
//| Gateway configuration |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| Gateway account configuration |
//+------------------------------------------------------------------+
struct ConGatewayAccount
{
int enable; // enable flag 0 - disabled, 1 - enabled
char name[64]; // public name
int id; // internal id
int type; // type (obsolete)
int login; // STP MT4 login
char address[64]; // MT4 server address
char password[64]; // STP MT4 password
int notify_logins[8]; // list of logins for internal email notification
int flags; // flag fields
int reserved[23]; // reserved
};
//--- gateway account flags
enum EnGatewayAccountFlags { GATEWAY_FLAG_NONE=0, GATEWAY_FLAG_QUOTES=1 };
//+------------------------------------------------------------------+
//| Gateway markup configuration |
//+------------------------------------------------------------------+
struct ConGatewayMarkup
{
int enable; // enable flag 0 - disabled, 1 - enabled
char source[128]; // source symbol\symbols mask\symbols group name
char symbol[12]; // local symbol name
char account_name[64]; // account name (obsolete)
int account_id; // account internal id (obsolete)
int bid_markup; // bid markup in pips
int ask_markup; // ask markup in pips
int reserved[16]; // reserved
};
//+------------------------------------------------------------------+
//| Gateway rules configuration |
//+------------------------------------------------------------------+
struct ConGatewayRule
{
int enable; // enable flag 0 - disabled, 1 - enabled
char name[64]; // public name
char request_symbol[128]; // symbol\symbols mask\symbols group name
char request_group[128]; // group name or group mask
int request_reserved[32]; // reserved
char exe_account_name[64]; // account name
int exe_account_id; // account internal id
int exe_max_deviation; // max. devation
int exe_max_profit_slippage; // max profit slippage in pips
int exe_max_profit_slippage_lots; // max profit slippage volume in lots
int exe_max_losing_slippage; // max losing slippage in pips
int exe_max_losing_slippage_lots; // max losing slippage volume in lots
int exe_account_pos; // account current position
int exe_volume_percent; // coverage percentage
int exe_reserved[26]; // reserved
};
//+------------------------------------------------------------------+
//| Result codes |
//+------------------------------------------------------------------+
enum
{
//--- common errors
RET_OK =0, // all OK
RET_OK_NONE, // all OK-no operation
RET_ERROR, // general error
RET_INVALID_DATA, // invalid data
RET_TECH_PROBLEM, // server technical problem
RET_OLD_VERSION, // old client terminal
RET_NO_CONNECT, // no connection
RET_NOT_ENOUGH_RIGHTS, // no enough rights
RET_TOO_FREQUENT, // too frequently access to server
RET_MALFUNCTION, // mulfunctional operation
RET_GENERATE_KEY, // need to send public key
RET_SECURITY_SESSION, // security session start
//--- account status
RET_ACCOUNT_DISABLED =64, // account blocked
RET_BAD_ACCOUNT_INFO, // bad account info
RET_PUBLIC_KEY_MISSING, // public key missing on external auth
//--- trade
RET_TRADE_TIMEOUT =128, // trade transatcion timeou expired
RET_TRADE_BAD_PRICES, // order has wrong prices
RET_TRADE_BAD_STOPS, // wrong stops level
RET_TRADE_BAD_VOLUME, // wrong lot size
RET_TRADE_MARKET_CLOSED, // market closed
RET_TRADE_DISABLE, // trade disabled
RET_TRADE_NO_MONEY, // no enough money for order execution
RET_TRADE_PRICE_CHANGED, // price changed
RET_TRADE_OFFQUOTES, // no quotes
RET_TRADE_BROKER_BUSY, // broker is busy
RET_TRADE_REQUOTE, // requote
RET_TRADE_ORDER_LOCKED, // order is proceed by dealer and cannot be changed
RET_TRADE_LONG_ONLY, // allowed only BUY orders
RET_TRADE_TOO_MANY_REQ, // too many requests from one client
//--- order status notification
RET_TRADE_ACCEPTED, // trade request accepted by server and placed in request queue
RET_TRADE_PROCESS, // trade request accepted by dealerd
RET_TRADE_USER_CANCEL, // trade request canceled by client
//--- additional return codes
RET_TRADE_MODIFY_DENIED, // trade modification denied
RET_TRADE_CONTEXT_BUSY, // trade context is busy (used in client terminal)
RET_TRADE_EXPIRATION_DENIED, // using expiration date denied
RET_TRADE_TOO_MANY_ORDERS, // too many orders
RET_TRADE_HEDGE_PROHIBITED, // hedge is prohibited
RET_TRADE_PROHIBITED_BY_FIFO // prohibited by fifo rule
};
//+------------------------------------------------------------------+
//| Pumping mode flags |
//+------------------------------------------------------------------+
enum
{
//--- user flags
CLIENT_FLAGS_HIDETICKS =1, // do not send ticks
CLIENT_FLAGS_HIDENEWS =2, // do not send news
CLIENT_FLAGS_HIDEMAIL =4, // do not send mails
CLIENT_FLAGS_SENDFULLNEWS=8, // send news body with news header in pumping mode
CLIENT_FLAGS_RESERVED =16, // reserved
//--- manager flags
CLIENT_FLAGS_HIDEONLINE =32, // do not send online users table
CLIENT_FLAGS_HIDEUSERS =64 // do not send users table
};
//+------------------------------------------------------------------+
//| Server datafeed descritopn |
//+------------------------------------------------------------------+
struct FeedDescription
{
int version; // data source version
char name[128]; // data source name
char copyright[128]; // copyright string
char web[128]; // data source web
char email[128]; // data source email
char server[128]; // feeder server
char username[32]; // default feeder name
char userpass[32]; // default feeder password
int modes; // feeder modes (enum FeederModes)
char description[512]; // feeder description
char module[32]; // datafeed name in license
int reserved[54]; // reserved
};
//--- feeder modes
enum FeederModes
{
modeOnlyQuotes =0, // only quotes feeder
modeOnlyNews =1, // only news feeder
modeQuotesAndNews =2, // quotes and news feeder
modeQuotesOrNews =3 // quotes or news feeder
};
//--- server datafeed
struct ServerFeed
{
char file[256]; // feeder file name
FeedDescription feed; // feeder description
};
//+------------------------------------------------------------------+
//| Charts |
//+------------------------------------------------------------------+
//| Request chart history struct |
//+------------------------------------------------------------------+
struct ChartInfo
{
char symbol[12]; // symbol
int period; // period (PERIOD_*)
__time32_t start; // start of chart block
__time32_t end; // end of chart block
__time32_t timesign; // timestamp of existing chart base
int mode; // request mode
};
//--- chart period
enum { PERIOD_M1=1, PERIOD_M5=5, PERIOD_M15=15, PERIOD_M30=30,
PERIOD_H1=60, PERIOD_H4=240, PERIOD_D1=1440, PERIOD_W1=10080,
PERIOD_MN1=43200 };
//--- request mode
enum { CHART_RANGE_IN,CHART_RANGE_OUT,CHART_RANGE_LAST };
//+------------------------------------------------------------------+
//| Rate the in chart base |
//+------------------------------------------------------------------+
#pragma pack(push,1)
struct RateInfoOld
{
__time32_t ctm; // rate time
int open; // open price: 11987=119.87
short high,low,close; // high,low,close shift from open
double vol; // volume
};
struct RateInfo
{
__time32_t ctm; // rate time
int open; // open price: 11987=119.87
int high,low,close; // high,low,close shift from open
double vol; // volume
};
#pragma pack(pop)
//+------------------------------------------------------------------+
//| Tick record in base |
//+------------------------------------------------------------------+
#pragma pack(push,1)
struct TickRecord
{
__time32_t ctm; // tick time
double bid,ask; // bid, ask
int datafeed; // index if datafeed
char flags; // TICK_FLAG_* flags
};
#pragma pack(pop)
//---
enum { TICK_FLAG_RAW=1, TICK_FLAG_NORMAL=2,TICK_FLAG_ALL=TICK_FLAG_RAW+TICK_FLAG_NORMAL };
//+------------------------------------------------------------------+
//| Tick request |
//+------------------------------------------------------------------+
#pragma pack(push,1)
struct TickRequest
{
char symbol[12]; // symbol
__time32_t from; // start of period
__time32_t to; // end of period
char flags; // TICK_FLAG_* flags
};
#pragma pack(pop)
//+------------------------------------------------------------------+
//| Performance information |
//+------------------------------------------------------------------+
#pragma pack(push,1)
struct PerformanceInfo
{
__time32_t ctm;
short users; // online users
short cpu; // processor loading (%)
int freemem; // free memory (Kb)
int network; // network activity (Kb/s)
int sockets; // all open sockets in system
};
#pragma pack(pop)
//+------------------------------------------------------------------+
//| Backup file information |
//+------------------------------------------------------------------+
struct BackupInfo
{
char file[256]; // file name
int size; // file size
__time32_t time; // file time
int reserved[6]; // reserved
};
//--- backup mode
enum
{
BACKUPS_ALL, // all backup
BACKUPS_PERIODICAL, // periodical backups
BACKUPS_STARTUP, // backups on startup
BACKUPS_DELETE // backups on delete
};
//+------------------------------------------------------------------+
//| Databases |
//+------------------------------------------------------------------+
//| Transaction types |
//+------------------------------------------------------------------+
enum { TRANS_ADD, TRANS_DELETE, TRANS_UPDATE, TRANS_CHANGE_GRP };
//+------------------------------------------------------------------+
//| User Record |
//+------------------------------------------------------------------+
#define PUBLIC_KEY_SIZE 272 // RSA key size // (((1024+64)/32)*4*2)
#define USER_COLOR_NONE (0xFF000000) // default user color
//---
struct UserRecord
{
//--- common settings
int login; // login
char group[16]; // group
char password[16]; // password
//--- access flags
int enable; // enable
int enable_change_password; // allow to change password
int enable_read_only; // allow to open/positions (TRUE-may not trade)
int enable_otp; // allow to use one-time password
int enable_reserved[2]; // for future use
//---
char password_investor[16]; // read-only mode password
char password_phone[32]; // phone password
char name[128]; // name
char country[32]; // country
char city[32]; // city
char state[32]; // state
char zipcode[16]; // zipcode
char address[96]; // address
char lead_source[32]; // lead source
char phone[32]; // phone
char email[48]; // email
char comment[64]; // comment
char id[32]; // SSN (IRD)
char status[16]; // status
__time32_t regdate; // registration date
__time32_t lastdate; // last coonection time
//--- trade settings
int leverage; // leverage
int agent_account; // agent account
__time32_t timestamp; // timestamp
int last_ip; // last visit ip
//--- trade data
double balance; // balance
double prevmonthbalance; // previous month balance
double prevbalance; // previous day balance
double credit; // credit
double interestrate; // accumulated interest rate
double taxes; // taxes
double prevmonthequity; // previous month equity
double prevequity; // previous day equity
double reserved2[2]; // for future use
//---
char otp_secret[32]; // one-time password secret
char secure_reserved[240]; // secure data reserved
int send_reports; // enable send reports by email
unsigned int mqid; // MQ client identificator
COLORREF user_color; // color got to client (used by MT Manager)
//---
char unused[40]; // for future use
char api_data[16]; // for API usage
};
//+------------------------------------------------------------------+
//| Users group operation |
//+------------------------------------------------------------------+
#pragma pack(push,1)
struct GroupCommandInfo
{
int len; // length of users list
char command; // group coommand
char newgroup[16]; // new group
int leverage; // new leverage
int reserved[8]; // reserved
};
#pragma pack(pop)
//--- group commands
enum { GROUP_DELETE,GROUP_ENABLE,GROUP_DISABLE,GROUP_LEVERAGE,GROUP_SETGROUP };
//+------------------------------------------------------------------+
//| Online user description |
//+------------------------------------------------------------------+
struct OnlineRecord