欢迎光临散文网 会员登陆 & 注册

期货量化软件:赫兹量化系统品种即时报价序列集合

2023-10-11 13:34 作者:大牛啊呢  | 我要投稿

即时报价数据类的集合

在 \MQL5\Include\DoEasy\Collections\ 中,创建一个名为 TickSeriesCollection.mqh 的新即时报价数据集合类文件。

该类是函数库所有对象的基准对象类的衍生类。

我们看一下类主体,并分析其变量和方法:

//+------------------------------------------------------------------+ //|                                         TickSeriesCollection.mqh | //|                        Copyright 2021, MetaQuotes Software Corp. | //|                             https://mql5.com/en/users/artmedia70 | //+------------------------------------------------------------------+ #property copyright "Copyright 2021, MetaQuotes Software Corp." #property link      "https://mql5.com/en/users/artmedia70" #property version   "1.00" //+------------------------------------------------------------------+ //| Include files                                                    | //+------------------------------------------------------------------+ #include "ListObj.mqh" #include "..\Objects\Ticks\TickSeries.mqh" #include "..\Objects\Symbols\Symbol.mqh" //+------------------------------------------------------------------+ //| Collection of symbol tick series                                 | //+------------------------------------------------------------------+ class CTickSeriesCollection : public CBaseObj  { private:   CListObj                m_list;                                   // List of used symbol tick series //--- Return the tick series index by symbol name   int                     IndexTickSeries(const string symbol); public: //--- Return (1) itself and (2) tick series collection list and (3) the number of tick series in the list   CTickSeriesCollection  *GetObject(void)                              { return &this;               }   CArrayObj              *GetList(void)                                { return &this.m_list;        }   int                     DataTotal(void)                        const { return this.m_list.Total(); } //--- Return the pointer to the tick series object (1) by symbol and (2) by index in the list   CTickSeries            *GetTickseries(const string symbol);   CTickSeries            *GetTickseries(const int index); //--- Create a collection list of symbol tick series   bool                    CreateCollection(const CArrayObj *list_symbols,const uint required=0); //--- Set the flag of using the tick series of (1) a specified symbol and (2) all symbols   void                    SetAvailableTickSeries(const string symbol,const bool flag=true);   void                    SetAvailableTickSeries(const bool flag=true); //--- Return the flag of using the tick series of (1) a specified symbol and (2) all symbols   bool                    IsAvailableTickSeries(const string symbol);   bool                    IsAvailableTickSeries(void); //--- Set the number of days of the tick history of (1) a specified symbol and (2) all symbols   bool                    SetRequiredUsedDays(const string symbol,const uint required=0);   bool                    SetRequiredUsedDays(const uint required=0); //--- Return the last tick object of a specified symbol (1) by index, (2) by time and (4) by time in milliseconds   CDataTick              *GetTick(const string symbol,const int index);   CDataTick              *GetTick(const string symbol,const datetime tick_time);   CDataTick              *GetTick(const string symbol,const long tick_time_msc); //--- Return the new tick flag of a specified symbol   bool                    IsNewTick(const string symbol); //--- Create a tick series of (1) a specified symbol and (2) all symbols   bool                    CreateTickSeries(const string symbol,const uint required=0);   bool                    CreateTickSeriesAll(const uint required=0); //--- Update (1) a tick series of a specified symbol and (2) all symbols   void                    Refresh(const string symbol);   void                    Refresh(void); //--- Display (1) the complete and (2) short collection description in the journal   void                    Print(void);   void                    PrintShort(void);   //--- Constructor                           CTickSeriesCollection();  }; //+------------------------------------------------------------------+

类的成员变量 m_list 属于 CListObj 类型 — 它是标准库 CArrayObj 类的衍生类,就像在函数库中创建的许多其他列表一样。 CListObj 类的唯一目的是实现标准库对象基类 CObject 类的 Type() 虚拟方法操作。 该方法应返回类的类型 ID。 在这种情况下,它是数组类型 ID。


期货量化软件:赫兹量化系统品种即时报价序列集合的评论 (共 条)

分享到微博请遵守国家法律