MT5APIConfigHistory.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. //+------------------------------------------------------------------+
  2. //| MetaTrader 5 API Server |
  3. //| Copyright 2000-2019, MetaQuotes Software Corp. |
  4. //| http://www.metaquotes.net |
  5. //+------------------------------------------------------------------+
  6. #pragma once
  7. //+------------------------------------------------------------------+
  8. //| History synchronization config |
  9. //+------------------------------------------------------------------+
  10. class IMTConHistorySync
  11. {
  12. public:
  13. //--- mode enumeration
  14. enum EnHistoryMode
  15. {
  16. HISTORY_DISABLED =0,
  17. HISTORY_ENABLED =1,
  18. //--- enumeration borders
  19. HISTORY_FIRST =HISTORY_DISABLED,
  20. HISTORY_LAST =HISTORY_ENABLED,
  21. };
  22. //--- synchronization modex
  23. enum EnHistorySyncMode
  24. {
  25. MODE_REPLACE =0, // syncronization with full previous data replace
  26. MODE_MERGE =1, // syncronization with merge with previous data
  27. //--- enumeration borders
  28. MODE_FIRST =MODE_REPLACE,
  29. MODE_LAST =MODE_MERGE,
  30. };
  31. //--- server types
  32. enum EnHistorySyncServer
  33. {
  34. SERVER_MT4 =0, // MT4
  35. SERVER_MT5 =1, // MT5
  36. //--- enumeration borders
  37. SERVER_FIRST =SERVER_MT4,
  38. SERVER_LAST =SERVER_MT5,
  39. };
  40. //--- synchronization flags
  41. enum EnHistorySyncFlags
  42. {
  43. FLAG_SESSIONS =1, // check quote session due synchronization
  44. FLAG_SYNONYMS =2, // synchronize synonim symbols history
  45. //--- enumeration borders
  46. FLAG_NONE =0,
  47. FLAG_ALL =FLAG_SESSIONS|FLAG_SYNONYMS,
  48. };
  49. //--- synchronization data
  50. enum EnHistoryData
  51. {
  52. DATA_HISTORY_CHARTS=0, // charts only
  53. DATA_HISTORY_TICKS =1, // ticks only
  54. DATA_HISTORY_ALL =2, // charts and ticks
  55. //--- enumeration borders
  56. DATA_HISTORY_FIRST =DATA_HISTORY_CHARTS,
  57. DATA_HISTORY_LAST =DATA_HISTORY_ALL
  58. };
  59. //--- common methods
  60. virtual void Release(void)=0;
  61. virtual MTAPIRES Assign(const IMTConHistorySync* param)=0;
  62. virtual MTAPIRES Clear(void)=0;
  63. //--- server address
  64. virtual LPCWSTR Server(void) const=0;
  65. virtual MTAPIRES Server(LPCWSTR server)=0;
  66. //--- server type
  67. virtual UINT ServerType(void) const=0;
  68. virtual MTAPIRES ServerType(const UINT type)=0;
  69. //--- mode
  70. virtual UINT Mode(void) const=0;
  71. virtual MTAPIRES Mode(const UINT mode)=0;
  72. //--- synchronization mode
  73. virtual UINT ModeSync(void) const=0;
  74. virtual MTAPIRES ModeSync(const UINT type)=0;
  75. //--- time correction in minutes, 0 - autodetect
  76. virtual int TimeCorrection(void) const=0;
  77. virtual MTAPIRES TimeCorrection(const int correction)=0;
  78. //--- synchronized history start
  79. virtual INT64 From(void) const=0;
  80. virtual MTAPIRES From(const INT64 from)=0;
  81. //--- synchronized history finish
  82. virtual INT64 To(void) const=0;
  83. virtual MTAPIRES To(const INT64 to)=0;
  84. //--- synchronized symbols list
  85. virtual MTAPIRES SymbolAdd(LPCWSTR path)=0;
  86. virtual MTAPIRES SymbolUpdate(const UINT pos,LPCWSTR path)=0;
  87. virtual MTAPIRES SymbolShift(const UINT pos,const int shift)=0;
  88. virtual MTAPIRES SymbolDelete(const UINT pos)=0;
  89. virtual UINT SymbolTotal(void) const=0;
  90. virtual LPCWSTR SymbolNext(const UINT pos) const=0;
  91. //--- synchronization flags
  92. virtual UINT64 Flags(void) const=0;
  93. virtual MTAPIRES Flags(const UINT64 flags)=0;
  94. //--- synchronization data
  95. virtual UINT HistoryData(void) const=0;
  96. virtual MTAPIRES HistoryData(const UINT data)=0;
  97. };
  98. //+------------------------------------------------------------------+
  99. //| History config events notification interface |
  100. //+------------------------------------------------------------------+
  101. class IMTConHistorySyncSink
  102. {
  103. public:
  104. virtual void OnHistorySyncAdd(const IMTConHistorySync* /*config*/) { }
  105. virtual void OnHistorySyncUpdate(const IMTConHistorySync* /*config*/) { }
  106. virtual void OnHistorySyncDelete(const IMTConHistorySync* /*config*/) { }
  107. virtual void OnHistorySyncSync(void) { }
  108. };
  109. //+------------------------------------------------------------------+