
DoEasyライブラリでの価格(第65部): 板情報コレクションとMQL5.comシグナル操作クラス
内容
概念
任意の銘柄のDOMを使用する機能はすでに存在します。以前の記事では、DOM抽象注文オブジェクトとその子孫クラス、DOMスナップショットクラス、DOMスナップショットシリーズクラスを作成しました。次に行うのはDOMスナップショットシリーズオブジェクトの共通ストレージであるスナップショットシリーズコレクションクラスを作成することです。このクラスは、これらすべてのシリーズを保存し、コレクションリストに保存されているDOMスナップショットへの便利なアクセスと自動更新(新しいスナップショットの追加と古いスナップショットの削除)を備えて指定されたシリーズサイズをサポートすることになります。
DOMスナップショットシリーズコレクションクラスの作成とは別に、新しいライブラリセクション(他のライブラリクラス)も作成します。
を使用する機能から始めます。すなわち、MQL5.comシグナルサービスによってブロードキャストされた単一のシグナルのすべてのデータを格納するシグナルオブジェクトクラスを作成します。
ライブラリクラスの改善
ライブラリに新しいメッセージを追加しましょう。\MQL5\Include\DoEasy\Data.mqhに、新しいメッセージインデックスを追加します。
//--- CMBookSeries MSG_MBOOK_SERIES_TEXT_MBOOKSERIES, // DOM snapshot series MSG_MBOOK_SERIES_ERR_ADD_TO_LIST, // Error. Failed to add DOM snapshot series to the list //--- CMBookSeriesCollection MSG_MB_COLLECTION_TEXT_MBCOLLECTION, // DOM snapshot series collection //--- CMQLSignal MSG_SIGNAL_MQL5_TEXT_SIGNAL, // Signal MSG_SIGNAL_MQL5_TEXT_SIGNAL_MQL5, // MQL5.com Signals service signal MSG_SIGNAL_MQL5_TRADE_MODE, // Account type MSG_SIGNAL_MQL5_DATE_PUBLISHED, // Publication date MSG_SIGNAL_MQL5_DATE_STARTED, // Monitoring start date MSG_SIGNAL_MQL5_DATE_UPDATED, // Date of the latest update of the trading statistics MSG_SIGNAL_MQL5_ID, // ID MSG_SIGNAL_MQL5_LEVERAGE, // Trading account leverage MSG_SIGNAL_MQL5_PIPS, // Trading result in pips MSG_SIGNAL_MQL5_RATING, // Position in the signal rating MSG_SIGNAL_MQL5_SUBSCRIBERS, // Number of subscribers MSG_SIGNAL_MQL5_TRADES, // Number of trades MSG_SIGNAL_MQL5_SUBSCRIPTION_STATUS, // Status of account subscription to a signal MSG_SIGNAL_MQL5_EQUITY, // Account equity MSG_SIGNAL_MQL5_GAIN, // Account growth in % MSG_SIGNAL_MQL5_MAX_DRAWDOWN, // Maximum drawdown MSG_SIGNAL_MQL5_PRICE, // Signal subscription price MSG_SIGNAL_MQL5_ROI, // Signal ROI (Return on Investment) in % MSG_SIGNAL_MQL5_AUTHOR_LOGIN, // Author login MSG_SIGNAL_MQL5_BROKER, // Broker (company) name MSG_SIGNAL_MQL5_BROKER_SERVER, // Broker server MSG_SIGNAL_MQL5_NAME, // Name MSG_SIGNAL_MQL5_CURRENCY, // Account currency MSG_SIGNAL_MQL5_TEXT_GAIN, // Growth MSG_SIGNAL_MQL5_TEXT_DRAWDOWN, // Drawdown }; //+------------------------------------------------------------------+
また、新しく追加したインデックスに対応するメッセージテキストも追加します。
//--- CMBookSeries {"Серия снимков стакана цен","Series of shots of the Depth of Market"}, {"Ошибка. Не удалось добавить серию снимков стакана цен в список","Error. Failed to add a shots series of the Depth of Market to the list"}, //--- CMBookSeriesCollection {"Коллекция серий снимков стакана цен","Collection of series of the Depth of Market shot"}, //--- CMQLSignal {"Сигнал","Signal"}, {"Сигнал сервиса сигналов MQL5.com","Signal from MQL5.com signal service"}, {"Тип счета","Account type"}, {"Дата публикации","Publication date"}, {"Дата начала мониторинга","Monitoring starting date"}, {"Дата последнего обновления торговой статистики","The date of the last update of the signal's trading statistics"}, {"ID","ID"}, {"Плечо торгового счета","Account leverage"}, {"Результат торговли в пипсах","Profit in pips"}, {"Позиция в рейтинге сигналов","Position in rating"}, {"Количество подписчиков","Number of subscribers"}, {"Количество трейдов","Number of trades"}, {"Состояние подписки счёта на этот сигнал","Account subscription status for this signal"}, {"Средства на счете","Account equity"}, {"Прирост счета в процентах","Account gain"}, {"Максимальная просадка","Account maximum drawdown"}, {"Цена подписки на сигнал","Signal subscription price"}, {"Значение ROI (Return on Investment) сигнала в %","Return on Investment (%)"}, {"Логин автора","Author login"}, {"Наименование брокера (компании)","Broker name (company)"}, {"Сервер брокера","Broker server"}, {"Имя","Name"}, {"Валюта счета","Base currency"}, {"Прирост","Gain"}, {"Просадка","Drawdown"}, }; //+---------------------------------------------------------------------+
今日は新しいコレクションを開発するので、そのIDを設定する必要があります。\MQL5\Include\DoEasy\Defines.mqhのIDセクションにDOMスナップショットシリーズコレクションIDを追加します。
//--- Collection list IDs #define COLLECTION_HISTORY_ID (0x777A) // Historical collection list ID #define COLLECTION_MARKET_ID (0x777B) // Market collection list ID #define COLLECTION_EVENTS_ID (0x777C) // Event collection list ID #define COLLECTION_ACCOUNT_ID (0x777D) // Account collection list ID #define COLLECTION_SYMBOLS_ID (0x777E) // Symbol collection list ID #define COLLECTION_SERIES_ID (0x777F) // Timeseries collection list ID #define COLLECTION_BUFFERS_ID (0x7780) // Indicator buffer collection list ID #define COLLECTION_INDICATORS_ID (0x7781) // Indicator collection list ID #define COLLECTION_INDICATORS_DATA_ID (0x7782) // Indicator data collection list ID #define COLLECTION_TICKSERIES_ID (0x7783) // Tick series collection list ID #define COLLECTION_MBOOKSERIES_ID (0x7784) // DOM series collection list ID //--- Data parameters for file operations
DOMスナップショットシリーズオブジェクトクラスのファイルを改善しましょう。場合によっては、オブジェクトの説明を1回表示する必要や、すべてのDOMスナップショットシリーズの説明を一度に表示する必要があります。この場合、各シリーズの説明の前にハイフンを追加すると、リストはより視覚的に魅力的に見えます。DOMスナップショットシリーズクラスの\MQL5\Include\DoEasy\Objects\Book\MBookSeries.mqhファイルで、メソッドの説明に変更を追加します。
//--- Display (1) description and (2) short description of a DOM snapshot series void Print(const bool dash=false); void PrintShort(const bool dash=false); //--- Constructors
オブジェクトの説明の前にハイフンを表示する必要があることを示すフラグを使用するだけです。
メソッドの実装に同じ変更を追加します。
//+------------------------------------------------------------------+ //| Display the description of the DOM snapshot series in the journal| //+------------------------------------------------------------------+ void CMBookSeries::Print(const bool dash=false) { string txt= ( CMessage::Text(MSG_TICKSERIES_REQUIRED_HISTORY_DAYS)+(string)this.RequiredUsedDays()+", "+ CMessage::Text(MSG_LIB_TEXT_TS_ACTUAL_DEPTH)+(string)this.DataTotal() ); ::Print((dash ? "- " : ""),this.Header(),": ",txt); } //+------------------------------------------------------------------+ //| Display a short description of a DOM snapshot series | //+------------------------------------------------------------------+ void CMBookSeries::PrintShort(const bool dash=false) { ::Print((dash ? "- " : ""),this.Header()); } //+------------------------------------------------------------------+
デフォルトでは、フラグはfalseに設定されているため、オブジェクトの説明の前にハイフンは表示されません。
DOMコレクションクラス
DOMコレクションを作成するために必要なオブジェクトはすべてそろっています。つまり、ターミナルにはMqlBookInfo構造体で表されるDOM注文オブジェクトがあります。BookEventイベントが到着すると、OnBookEvent()ハンドラが呼び出されます。DOM変更イベントが発生した銘柄をパラメータとして指定します。現在のすべてのDOMデータをMqlBookInfo構造体配列に受け取ることができます。ライブラリ内のこのデータのコレクションは、DOM変更イベントを処理するときに取得した注文オブジェクトを特徴とするDOMスナップショットオブジェクトによって記述されます。DOMを変更するたびに、リストに追加する新しいスナップショットオブジェクトを作成します。このようなリストは、DOMスナップショットシリーズオブジェクトによって表されます。DOMイベントを受信するために、サブスクライブした銘柄ごとにこのようなリストを作成します。リストはリアルタイムで作成されます(残念ながら、ターミナルには銘柄のDOM変更履歴がありません)。その結果、既存のすべてのリストを1つのDOMコレクションオブジェクトに結合する必要があります。
銘柄DOMコレクションは、常に更新されるDOMスナップショットリストを格納することで、プログラムの実行中に各銘柄のDOM変更の履歴を作成できるようにします。コレクションリストに存在するスナップショットに関するデータの取得とともに各スナップショットからの任意の注文の取得が可能になります。必要なデータを検索し、指定された基準でリストを分類し、利用可能なコレクションリストを使用して統計調査を行うことができます。
\MQL5\Include\DoEasy\Collections\で、BookSeriesCollection.mqhに新しいクラスCMBookSeriesCollectionを作成します。
すべてのCBaseObjライブラリオブジェクトの基本オブジェクトのクラスを基本オブジェクトとして使用して、必要なすべてのファイルをクラスリストにインクルードします。
//+------------------------------------------------------------------+ //| BookSeriesCollection.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\Book\MBookSeries.mqh" #include "..\Objects\Symbols\Symbol.mqh" //+------------------------------------------------------------------+ //| Collection of symbol DOM series | //+------------------------------------------------------------------+ class CMBookSeriesCollection : public CBaseObj { }
クラス本体とそのメソッドを見て、メソッドの実装とその目的を分析しましょう。
//+------------------------------------------------------------------+ //| Collection of symbol DOM series | //+------------------------------------------------------------------+ class CMBookSeriesCollection : public CBaseObj { private: CListObj m_list; // List of used symbol DOM series //--- Return the DOM series index by a symbol name int IndexMBookSeries(const string symbol); public: //--- Return (1) itself, (2) DOM series collection list and (3) the number of DOM series in the list CMBookSeriesCollection *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 DOM series object (1) by symbol and (2) by index in the list CMBookSeries *GetMBookseries(const string symbol); CMBookSeries *GetMBookseries(const int index) { return this.m_list.At(index);} //--- Create symbol DOM series collection list bool CreateCollection(const CArrayObj *list_symbols,const uint required=0); //--- Set the flag of using the DOM series of (1) a specified symbol and (2) all symbols void SetAvailableMBookSeries(const string symbol,const bool flag=true); void SetAvailableMBookSeries(const bool flag=true); //--- Return the flag of using the DOM series of (1) a specified symbol and (2) all symbols bool IsAvailableMBookSeries(const string symbol); bool IsAvailableMBookSeries(void); //--- Set the number of DOM history days 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 DOM snapshot object of a specified symbol (1) by index and (2) by time in milliseconds CMBookSnapshot *GetMBook(const string symbol,const int index); CMBookSnapshot *GetMBook(const string symbol,const long time_msc); //--- Update the DOM series of a specified symbol bool Refresh(const string symbol,const long time_msc); //--- Display (1) the complete and (2) short collection description in the journal void Print(void); void PrintShort(void); //--- Constructor CMBookSeriesCollection(); }; //+------------------------------------------------------------------+
メソッドの説明により、コレクション自体がm_listで表されていることが明確になります。これは、CMBookSeriesクラスで表されるさまざまな銘柄のDOMのスナップショットのシリーズオブジェクトを格納するためのものです。これらは、CMBookSnapshotクラスによって表されるDOMスナップショットオブジェクトを特徴とする銘柄です。
クラスメソッドの実装について詳しく見ていきましょう。
クラスコンストラクタで、コレクションリストをクリアし、並び替え済みリストフラグをリストに設定し、DOMシリーズコレクションリストIDを割り当てます。
//+------------------------------------------------------------------+ //| Constructor | //+------------------------------------------------------------------+ CMBookSeriesCollection::CMBookSeriesCollection() { this.m_list.Clear(); this.m_list.Sort(); this.m_list.Type(COLLECTION_MBOOKSERIES_ID); } //+------------------------------------------------------------------+
デフォルトでは、すべてのシリーズリストは、コレクションリスト内でDOMスナップショットシリーズの銘柄名で並べ替えられます。
以下は、銘柄のDOMシリーズコレクションリストを作成するメソッドです。
//+------------------------------------------------------------------+ //| Create symbol DOM series collection list | //+------------------------------------------------------------------+ bool CMBookSeriesCollection::CreateCollection(const CArrayObj *list_symbols,const uint required=0) { //--- If an empty list of symbol objects is passed, exit if(list_symbols==NULL) return false; //--- Get the number of symbol objects in the passed list int total=list_symbols.Total(); //--- Clear the DOM series collection list this.m_list.Clear(); //--- In a loop by all symbol objects for(int i=0;i<total;i++) { //--- get the next symbol object CSymbol *symbol_obj=list_symbols.At(i); //--- if failed to get a symbol object, move on to the next one in the list if(symbol_obj==NULL) continue; //--- Create a new DOM series object CMBookSeries *bookseries=new CMBookSeries(symbol_obj.Name(),required); //--- If failed to create the DOM series object, move on to the next symbol in the list if(bookseries==NULL) continue; //--- Set the sorted list flag for the DOM series collection list this.m_list.Sort(); //--- If the object with the same symbol name is already present in the DOM series collection list, remove the DOM series object if(this.m_list.Search(bookseries)>WRONG_VALUE) delete bookseries; //--- otherwise, there is no object with such a symbol name in the collection yet else { //--- if failed to add the DOM series object to the collection list, remove the series object, //--- inform of that and return 'false' if(!this.m_list.Add(bookseries)) { delete bookseries; ::Print(DFUN,"\"",symbol_obj.Name(),"\": ",CMessage::Text(MSG_MBOOK_SERIES_ERR_ADD_TO_LIST)); return false; } } } //--- Collection created successfully, return 'true' return true; } //+------------------------------------------------------------------+
すべてのメソッドロジックは、そのコードに詳細に説明されています。簡単に説明すると、このメソッドは、プログラムで使用されているすべての銘柄のリストと、コレクションリストに保存できるDOMスナップショットの数を受け取ります。メソッドに渡されたリストの反復処理で、リストから次の銘柄オブジェクトを受け取り、銘柄によって新しいDOMスナップショットシリーズオブジェクトを作成してコレクションリストに追加します。その結果、さまざまな銘柄のDOMのスナップショットシリーズオブジェクトのリストが取得されます。これは、メソッドに渡されるリストに存在するオブジェクトです。作成された各スナップショットシリーズリストは、最初は空です。
リストコレクションで作成されたリストの内容は、指定された銘柄のDOMのスナップショットシリーズリストを更新するメソッドで入力されます。
//+------------------------------------------------------------------+ //| Update the snapshot series list of a specified symbol DOM | //+------------------------------------------------------------------+ bool CMBookSeriesCollection::Refresh(const string symbol,const long time_msc) { CMBookSeries *bookseries=this.GetMBookseries(symbol); if(bookseries==NULL) return false; return bookseries.Refresh(time_msc); } //+------------------------------------------------------------------+
OnBookEvent()ハンドラは銘柄ごとにアクティブ化されるため、更新メソッドは、コレクション全体ではなく、コレクション内の1つの銘柄に対してのみ使用されます。このメソッドは、DOM変更イベントが発生した銘柄の名前と、DOM変更イベントを登録した時刻(ミリ秒単位)を受け取ります。さらに、メソッドに渡された銘柄によってDOMスナップショットシリーズオブジェクトを受け取り、前回の記事で検討したDOMスナップショットシリーズオブジェクトのRefresh()メソッドの結果を返します。
以下は、銘柄名でDOMシリーズインデックスを返すメソッドです。
//+------------------------------------------------------------------+ //| Return the DOM series index by a symbol name | //+------------------------------------------------------------------+ int CMBookSeriesCollection::IndexMBookSeries(const string symbol) { const CMBookSeries *obj=new CMBookSeries(symbol==NULL || symbol=="" ? ::Symbol() : symbol); if(obj==NULL) return WRONG_VALUE; this.m_list.Sort(); int index=this.m_list.Search(obj); delete obj; return index; } //+------------------------------------------------------------------+
ここでは、入力で指定された銘柄を使用して新しい一時的なDOMスナップショットシリーズオブジェクトを作成します。並び替え済みリストフラグを設定(検索は並び替え済みリストでのみ実行されます)、リスト内の同じ銘柄を持つオブジェクトインデックスを取得します。必ず一時オブジェクトを削除し、取得したインデックスを返します。Search()メソッドは、指定された銘柄を持つDOMスナップショットシリーズオブジェクトがリストに存在する場合はそのインデックスを返し、それ以外の場合は-1を返します。
以下は、指定された銘柄DOMシリーズオブジェクトを返すメソッドです。
//+------------------------------------------------------------------+ //| Return the specified symbol DOM series object | //+------------------------------------------------------------------+ CMBookSeries *CMBookSeriesCollection::GetMBookseries(const string symbol) { int index=this.IndexMBookSeries(symbol); return this.m_list.At(index); } //+------------------------------------------------------------------+
ここでは、上記で指定されたメソッドを使用して、リスト内のDOMスナップショットシリーズオブジェクトのインデックスを銘柄で取得し、指定されたインデックスによってリスト内のオブジェクトへのポインタを返します。指定された銘柄を持つオブジェクトがリストに存在しない場合(インデックスは-1)、At()メソッドはNULLを返します。
DOMを使用する機能を使用するには、各銘柄のDOM変更イベントの受信にサブスクライブする必要があります。この機能は、銘柄オブジェクトクラスにすでに存在します。さらに、DOMスナップショットシリーズオブジェクトは、DOM変更イベントの処理を有効/無効にする必要があることを示すフラグを備えています。つまり、BookEventイベントへのサブスクリプションがアクティブな場合でも、フラグを使用してこの銘柄でのDOMの使用を一時的に無効にする場合があります。次のメソッドを使用して、BookEventイベントを銘柄で処理する必要があることを示すフラグを設定します。
//+------------------------------------------------------------------+ //| Set the flag of using a series | //| of a specified symbol's DOM | //+------------------------------------------------------------------+ void CMBookSeriesCollection::SetAvailableMBookSeries(const string symbol,const bool flag=true) { CMBookSeries *bookseries=this.GetMBookseries(symbol); if(bookseries==NULL) return; bookseries.SetAvailable(flag); } //+------------------------------------------------------------------+
ここで、指定された銘柄のDOMのシリーズオブジェクトを受け取り、そのメソッドに渡されるフラグを設定します。
デフォルトのフラグ値はtrueです。
プログラムが複数の銘柄で動作する場合、上記のDOMスナップショットシリーズフラグを管理する必要がありますが、プログラムで使用されるすべての銘柄のフラグ値を一度に定義するメソッドが役立ちます。
//+------------------------------------------------------------------+ //|Set the flag of using the DOM series for all symbols | //+------------------------------------------------------------------+ void CMBookSeriesCollection::SetAvailableMBookSeries(const bool flag=true) { for(int i=0;i<this.m_list.Total();i++) { CMBookSeries *bookseries=this.m_list.At(i); if(bookseries==NULL) continue; bookseries.SetAvailable(flag); } } //+------------------------------------------------------------------+
ここで、コレクション内のDOMスナップショットシリーズオブジェクトの総数によるループで、次のシリーズリストを取得し、そのメソッドに渡されるフラグを設定します。デフォルトのフラグ値はtrueです。
上記で検討したメソッドとは逆の方法で、指定した銘柄またはそれらすべてのシリーズリストを一度に操作するためのフラグの値が返されます。
以下は、指定された銘柄のDOMシリーズを使用するフラグを返すメソッドです。
//+------------------------------------------------------------------+ //|Return the flag of using the DOM series of a specified symbol | //+------------------------------------------------------------------+ bool CMBookSeriesCollection::IsAvailableMBookSeries(const string symbol) { CMBookSeries *bookseries=this.GetMBookseries(symbol); if(bookseries==NULL) return false; return bookseries.IsAvailable(); } //+------------------------------------------------------------------+
ここで、メソッドに渡された銘柄によってDOMスナップショットのオブジェクトシリーズを取得し、オブジェクトに指定されたフラグ値を返します。
以下は、すべての銘柄のDOMシリーズを使用するフラグを返すメソッドです。
//+------------------------------------------------------------------+ //| Return the flag of using the DOM series of all symbols | //+------------------------------------------------------------------+ bool CMBookSeriesCollection::IsAvailableMBookSeries(void) { bool res=true; int total=this.m_list.Total(); for(int i=0;i<total;i++) { CMBookSeries *bookseries=this.m_list.At(i); if(bookseries==NULL) continue; res &=bookseries.IsAvailable(); } return res; } //+------------------------------------------------------------------+
このメソッドは、銘柄の使用の必要性を示すフラグがDOMシリーズで使用されている銘柄ごとにアクティブ化されている場合にのみtrueを返します。ここで、すべてのコレクションシリーズオブジェクトによるループで、次のシリーズを取得し、変数にシリーズフラグ値を追加します。少なくとも1つの銘柄に対してフラグがfalseに設定されている場合、メソッドはfalseを返します。
以下は、指定された銘柄のDOM履歴内のスナップショットの数を設定するメソッドです。
//+------------------------------------------------------------------+ //| Set the number of snapshots in history | //| of a specified symbol's DOM | //+------------------------------------------------------------------+ bool CMBookSeriesCollection::SetRequiredUsedDays(const string symbol,const uint required=0) { CMBookSeries *bookseries=this.GetMBookseries(symbol); if(bookseries==NULL) return false; bookseries.SetRequiredUsedDays(required); return true; } //+------------------------------------------------------------------+
このメソッドは、各銘柄のDOMスナップショットの総数を制限し、古いデータに余分なメモリを費やさないようにするために使用されます。ここで、指定された銘柄のスナップショットシリーズリストを取得し、リスト内のスナップショットの最大数を設定します。スナップショットシリーズリストの取得に失敗した場合は、falseを返します。必要な数が正常に設定された場合は、trueを返します。
以下は、すべての銘柄のDOM履歴内のスナップショットの数を返すメソッドです。
//+------------------------------------------------------------------+ //|Set the number of snapshots in the DOM history of all symbols | //+------------------------------------------------------------------+ bool CMBookSeriesCollection::SetRequiredUsedDays(const uint required=0) { bool res=true; for(int i=0;i<this.m_list.Total();i++) { CMBookSeries *bookseries=this.m_list.At(i); if(bookseries==NULL) { res &=false; continue; } bookseries.SetRequiredUsedDays(required); } return res; } //+------------------------------------------------------------------+
このメソッドは、プログラムで使用されるすべての銘柄に対して、同じ数の必要なDOM履歴データを一度に設定します。
コレクション内のシリーズオブジェクトの総数によるループで、次のDOMスナップショットシリーズオブジェクトを受信し、指定された量のデータを設定します。シリーズの取得に失敗した場合、falseが結果に追加されます。したがって、少なくとも1つのシリーズが必要な量を設定できない場合、メソッドはfalseを返します。ループが完了すると、res変数で取得した結果を返します。
以下は、インデックスで指定された銘柄のDOMスナップショットオブジェクトを返すメソッドです。
//+------------------------------------------------------------------+ //|Return the DOM snapshot object of a specified symbol by index | //+------------------------------------------------------------------+ CMBookSnapshot *CMBookSeriesCollection::GetMBook(const string symbol,const int index) { CMBookSeries *bookseries=this.GetMBookseries(symbol); if(bookseries==NULL) return NULL; return bookseries.GetMBookByListIndex(index); } //+------------------------------------------------------------------+
ここでは、前の記事で説明されたCMBookSeriesクラスのGetMBookByListIndex()メソッドを使用して、指定された銘柄のDOMスナップショットシリーズオブジェクトを受け取り、指定されたインデックスによってDOMスナップショットオブジェクトへのポインタを返します。
以下は、指定された銘柄のDOMスナップショットオブジェクトをミリ秒単位の時間で返すメソッドです。
//+------------------------------------------------------------------+ //| Return the DOM snapshot object of a specified symbol | //| by time in milliseconds | //+------------------------------------------------------------------+ CMBookSnapshot *CMBookSeriesCollection::GetMBook(const string symbol,const long time_msc) { CMBookSeries *bookseries=this.GetMBookseries(symbol); if(bookseries==NULL) return NULL; return bookseries.GetMBook(time_msc); } //+------------------------------------------------------------------+
ここでは、前の記事で説明されたCMBookSeriesクラスのGetMBook()メソッドを使用して、指定された銘柄のDOMスナップショットシリーズオブジェクトを受け取り、指定されたインデックスによってDOMスナップショットオブジェクトへのポインタを返します。
このメソッドの際立った特徴は、DOMスナップショットオブジェクトへのポインタを取得するために、その正確な時間をミリ秒単位で知る必要があることです。
以下は、DOMスナップショットシリーズコレクションの完全な説明を操作ログに表示するメソッドです。
//+------------------------------------------------------------------+ //| Display complete collection description to the journal | //+------------------------------------------------------------------+ void CMBookSeriesCollection::Print(void) { ::Print(CMessage::Text(MSG_MB_COLLECTION_TEXT_MBCOLLECTION),":"); for(int i=0;i<this.m_list.Total();i++) { CMBookSeries *bookseries=this.m_list.At(i); if(bookseries==NULL) continue; bookseries.Print(true); } } //+------------------------------------------------------------------+
最初にヘッダーを表示し、次にループで、コレクションの後続の各DOMシリーズオブジェクトを取得し、完全な説明を表示します。スナップショットシリーズオブジェクトのPrint()メソッドでは、trueを渡して、メソッドが説明の前にハイフンを設定するようにします。
以下は、短いコレクションリストを操作ログに返すメソッドです。
//+------------------------------------------------------------------+ //| Display the short collection description in the journal | //+------------------------------------------------------------------+ void CMBookSeriesCollection::PrintShort(void) { ::Print(CMessage::Text(MSG_MB_COLLECTION_TEXT_MBCOLLECTION),":"); for(int i=0;i<this.m_list.Total();i++) { CMBookSeries *bookseries=this.m_list.At(i); if(bookseries==NULL) continue; bookseries.PrintShort(true); } } //+------------------------------------------------------------------+
このメソッドは、DOMシリーズオブジェクトの簡単な説明を表示するメソッドがコレクションシリーズの説明を表示するために使用されることを除いて、上記のメソッドと同じです。
\MQL5\Include\DoEasy\Engine.mqhにあるCEngineライブラリメインオブジェクトのクラスを改善しましょう。
DOMスナップショットシリーズコレクションクラスをファイルにインクルードします。
//+------------------------------------------------------------------+ //| Engine.mqh | //| Copyright 2020, MetaQuotes Software Corp. | //| https://MQL5.com/en/users/artmedia70 | //+------------------------------------------------------------------+ #property copyright "Copyright 2020, MetaQuotes Software Corp." #property link "https://MQL5.com/en/users/artmedia70" #property version "1.00" //+------------------------------------------------------------------+ //| Include files | //+------------------------------------------------------------------+ #include "Services\TimerCounter.mqh" #include "Collections\HistoryCollection.mqh" #include "Collections\MarketCollection.mqh" #include "Collections\EventsCollection.mqh" #include "Collections\AccountsCollection.mqh" #include "Collections\SymbolsCollection.mqh" #include "Collections\ResourceCollection.mqh" #include "Collections\TimeSeriesCollection.mqh" #include "Collections\BuffersCollection.mqh" #include "Collections\IndicatorsCollection.mqh" #include "Collections\TickSeriesCollection.mqh" #include "Collections\BookSeriesCollection.mqh" #include "TradingControl.mqh" //+------------------------------------------------------------------+
クラスオブジェクトリストで、新しいDOMスナップショットシリーズコレクションクラスオブジェクトを追加します。
//+------------------------------------------------------------------+ //| Library basis class | //+------------------------------------------------------------------+ class CEngine { private: CHistoryCollection m_history; // Collection of historical orders and deals CMarketCollection m_market; // Collection of market orders and deals CEventsCollection m_events; // Event collection CAccountsCollection m_accounts; // Account collection CSymbolsCollection m_symbols; // Symbol collection CTimeSeriesCollection m_time_series; // Timeseries collection CBuffersCollection m_buffers; // Collection of indicator buffers CIndicatorsCollection m_indicators; // Indicator collection CTickSeriesCollection m_tick_series; // Collection of tick series CMBookSeriesCollection m_book_series; // Collection of DOM series CResourceCollection m_resource; // Resource list CTradingControl m_trading; // Trading management object CPause m_pause; // Pause object CArrayObj m_list_counters; // List of timer counters int m_global_error; // Global error code bool m_first_start; // First launch flag bool m_is_hedge; // Hedge account flag bool m_is_tester; // Flag of working in the tester bool m_is_market_trade_event; // Account trading event flag bool m_is_history_trade_event; // Account history trading event flag bool m_is_account_event; // Account change event flag bool m_is_symbol_event; // Symbol change event flag ENUM_TRADE_EVENT m_last_trade_event; // Last account trading event int m_last_account_event; // Last event in the account properties int m_last_symbol_event; // Last event in the symbol properties ENUM_PROGRAM_TYPE m_program; // Program type string m_name; // Program name
新しいBookEventイベントハンドラを追加します。銘柄コレクションで使用される銘柄のリストを設定する方法では、ティックシリーズの日数を渡す以外に、DOMスナップショットの最大数を渡すようにします。
//--- (1) Timer, event handler (2) NewTick, (3) Calculate, (4) BookEvent, (4) Deinit void OnTimer(SDataCalculate &data_calculate); void OnTick(SDataCalculate &data_calculate,const uint required=0); int OnCalculate(SDataCalculate &data_calculate,const uint required=0); bool OnBookEvent(const string &symbol); void OnDeinit(void); //--- Set the list of used symbols in the symbol collection and create the collection of symbol timeseries bool SetUsedSymbols(const string &array_symbols[],const uint required_ticks=0,const uint required_books=0);
ティックシリーズのコレクションを操作するためのメソッドのリストで、ティックシリーズコレクションを使用するための新しいメソッドを追加し、DOMシリーズコレクションを使用するためのメソッドを記述します。
//--- Return (1) the tick series collection, (2) the list of tick series from the tick series collection CTickSeriesCollection *GetTickSeriesCollection(void) { return &this.m_tick_series; } CArrayObj *GetListTickSeries(void) { return this.m_tick_series.GetList(); } //--- Create (1) a specified tick series and (2) all tick series bool TickSeriesCreate(const string symbol,const uint required=0) { return this.m_tick_series.CreateTickSeries(symbol,required); } bool TickSeriesCreateAll(const uint required=0) { return this.m_tick_series.CreateTickSeriesAll(required); } //--- Update (1) a tick series of a specified symbol, (2) all symbols and (3) all symbols except the current one void TickSeriesRefresh(const string symbol) { this.m_tick_series.Refresh(symbol); } void TickSeriesRefreshAll(void) { this.m_tick_series.Refresh(); } void TickSeriesRefreshAllExceptCurrent(void) { this.m_tick_series.RefreshExpectCurrent(); } //--- Return (1) the DOM series collection and (2) the list of DOM series from the DOM series collection CMBookSeriesCollection *GetMBookSeriesCollection(void) { return &this.m_book_series; } CArrayObj *GetListMBookSeries(void) { return this.m_book_series.GetList(); } //--- Update the DOM series of a specified symbol void MBookSeriesRefresh(const string symbol,const long time_msc) { this.m_book_series.Refresh(symbol,time_msc); } //--- Return the DOM series of a specified symbol CMBookSeries *GetMBookSeries(const string symbol) { return this.m_book_series.GetMBookseries(symbol); }
これらのメソッドはすべて、同じ名前の対応するコレクションのメソッドを呼び出すだけです。
クラス本体の外部にライブラリのOnBookEvent()ハンドラを実装します。
//+------------------------------------------------------------------+ //| BookEvent event handler | //+------------------------------------------------------------------+ bool CEngine::OnBookEvent(const string &symbol) { CSymbol *sym=this.m_symbols.GetSymbolObjByName(symbol); if(sym==NULL || !sym.BookdepthSubscription()) return false; return this.m_book_series.Refresh(sym.Name(),sym.Time()); } //+------------------------------------------------------------------+
OnBookEvent()ハンドラは、単一の銘柄でのみDOM変更イベント中に常にアクティブ化されるため、ハンドラ自体の内部で銘柄を定義できます。
メソッドは、DOM変更イベントが発生した銘柄の名前を受け取ります。次に、銘柄コレクションクラスから適切な銘柄オブジェクトを受け取り、DOMスナップショットの適切なシリーズを更新するためのメソッドの結果を返します。さらに、Refresh()メソッドで新しく作成されたDOMスナップショットに設定する時間をミリ秒単位で指定します。
銘柄コレクションで使用される銘柄のリストを設定するメソッドを改善しましょう。
//+------------------------------------------------------------------+ //| Set the list of used symbols in the symbol collection | //| and create the collections of timeseries, tick series | //| and symbol DOM series | //+------------------------------------------------------------------+ bool CEngine::SetUsedSymbols(const string &array_symbols[],const uint required_ticks=0,const uint required_books=0) { bool res=this.m_symbols.SetUsedSymbols(array_symbols); CArrayObj *list=this.GetListAllUsedSymbols(); if(list==NULL) return false; res&=this.m_time_series.CreateCollection(list); res&=this.m_tick_series.CreateCollection(list,required_ticks); res&=this.m_book_series.CreateCollection(list,required_books); return res; } //+------------------------------------------------------------------+
これで、メソッドはティックシリーズの日数とシリーズ内のDOMスナップショットの最大数を受け取ります。
ここでは、すべての銘柄のDOMスナップショットシリーズコレクションの作成を追加しました。
これで、DOMシリーズを操作するためのクラスの改善は終わりです。
将来、さらに改善するためにこのトピックに戻る可能性がありますが、それでは他の必要なライブラリ機能を扱いましょう。
a0> MQL5.comシグナルサービス はコピー取引サービスで、プロバイダの取引を取引口座に自動的にコピーできます。
ここで、MQL5シグナルオブジェクトは、取引操作が公に送信されるように監視される取引口座、つまりシグナルソースです。
シグナルソースには、SignalBaseGetInteger()、SignalBaseGetDouble()、SignalBaseGetString()各関数を使用して取得できる独自のパラメータがあります。さらに、サブスクリプションパラメータ(特定の口座のシグナルコピー)があります。これらのパラメータは、SignalInfoGetDouble()、SignalInfoGetInteger()、SignalInfoGetString()各関数を使用して取得できます。
MQL5シグナルオブジェクトは、サブスクリプション用にターミナルで使用可能な1つのシグナルソースを記述します。1つの口座から1つのシグナルのみをサブスクライブすることは可能ですが、サブスクリプションに使用できるすべてのシグナル(MQL5シグナルオブジェクト)の完全なリストを、任意のプロパティで並べ替えたり、選択したシグナルを比較してサブスクライブしたりすることができます。これは、MQL5.comシグナルサービスの恩恵を受けたいと考えている人にとって非常に便利で便利な機能です。
MQL5シグナルオブジェクトクラス
\MQL5\Include\DoEasy\Defines.mqhファイルに、MQL5シグナルオブジェクトの整数、実数、文字列プロパティの列挙を追加します。
//+------------------------------------------------------------------+ //| Data for working with MQL5.com signals | //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| The list of possible signal events | //+------------------------------------------------------------------+ #define SIGNAL_MQL5_EVENTS_NEXT_CODE (MBOOK_ORD_EVENTS_NEXT_CODE+1) // The code of the next event after the last signal event code //+------------------------------------------------------------------+ //| MQL5 signal integer properties | //+------------------------------------------------------------------+ enum ENUM_SIGNAL_MQL5_PROP_INTEGER { SIGNAL_MQL5_PROP_TRADE_MODE = 0, // Account type SIGNAL_MQL5_PROP_DATE_PUBLISHED, // Signal publication date SIGNAL_MQL5_PROP_DATE_STARTED, // Start date of signal monitoring SIGNAL_MQL5_PROP_DATE_UPDATED, // Date of the latest update of the signal trading statistics SIGNAL_MQL5_PROP_ID, // Signal ID SIGNAL_MQL5_PROP_LEVERAGE, // Trading account leverage SIGNAL_MQL5_PROP_PIPS, // Trading result in pips SIGNAL_MQL5_PROP_RATING, // Position in the signal rating SIGNAL_MQL5_PROP_SUBSCRIBERS, // Number of subscribers SIGNAL_MQL5_PROP_TRADES, // Number of trades SIGNAL_MQL5_PROP_SUBSCRIPTION_STATUS, // Status of account subscription to a signal }; #define SIGNAL_MQL5_PROP_INTEGER_TOTAL (11) // Total number of integer properties #define SIGNAL_MQL5_PROP_INTEGER_SKIP (0) // Number of integer DOM properties not used in sorting //+------------------------------------------------------------------+ //| MQL5 signal real properties | //+------------------------------------------------------------------+ enum ENUM_SIGNAL_MQL5_PROP_DOUBLE { SIGNAL_MQL5_PROP_BALANCE = SIGNAL_MQL5_PROP_INTEGER_TOTAL, // Account balance SIGNAL_MQL5_PROP_EQUITY, // Account equity SIGNAL_MQL5_PROP_GAIN, // Account growth in % SIGNAL_MQL5_PROP_MAX_DRAWDOWN, // Maximum drawdown SIGNAL_MQL5_PROP_PRICE, // Signal subscription price SIGNAL_MQL5_PROP_ROI, // Signal's ROI (Return on Investment) in % }; #define SIGNAL_MQL5_PROP_DOUBLE_TOTAL (6) // Total number of real properties #define SIGNAL_MQL5_PROP_DOUBLE_SKIP (0) // Number of real properties not used in sorting //+------------------------------------------------------------------+ //| MQL5 signal string properties | //+------------------------------------------------------------------+ enum ENUM_SIGNAL_MQL5_PROP_STRING { SIGNAL_MQL5_PROP_AUTHOR_LOGIN = (SIGNAL_MQL5_PROP_INTEGER_TOTAL+SIGNAL_MQL5_PROP_DOUBLE_TOTAL), // Signal author's login SIGNAL_MQL5_PROP_BROKER, // Broker (company) name SIGNAL_MQL5_PROP_BROKER_SERVER, // Broker server SIGNAL_MQL5_PROP_NAME, // Signal name SIGNAL_MQL5_PROP_CURRENCY, // Signal account currency }; #define SIGNAL_MQL5_PROP_STRING_TOTAL (5) // Total number of string properties //+------------------------------------------------------------------+
可能なmql5シグナルイベントのリストについてはまだ紹介しませんが、代わりに、MQL5シグナルイベントコードの次のイベントのコードを指定する定数のみを紹介します。これはおそらくさらに変更します。
MQL5シグナルのプロパティで検索および並び替えできるようにするには、可能なすべての並び替え基準の列挙を定義します。
//+------------------------------------------------------------------+ //| Possible sorting criteria of MQL5 signals | //+------------------------------------------------------------------+ #define FIRST_SIGNAL_MQL5_DBL_PROP (SIGNAL_MQL5_PROP_INTEGER_TOTAL-SIGNAL_MQL5_PROP_INTEGER_SKIP) #define FIRST_SIGNAL_MQL5_STR_PROP (SIGNAL_MQL5_PROP_INTEGER_TOTAL-SIGNAL_MQL5_PROP_INTEGER_SKIP+SIGNAL_MQL5_PROP_DOUBLE_TOTAL-SIGNAL_MQL5_PROP_DOUBLE_SKIP) enum ENUM_SORT_SIGNAL_MQL5_MODE { //--- Sort by integer properties SORT_BY_SIGNAL_MQL5_TRADE_MODE = 0, // Sort by signal type SORT_BY_SIGNAL_MQL5_DATE_PUBLISHED, // Sort by signal publication date SORT_BY_SIGNAL_MQL5_DATE_STARTED, // Sort by signal monitoring start date SORT_BY_SIGNAL_MQL5_DATE_UPDATED, // Sort by date of the latest update of the signal trading statistics SORT_BY_SIGNAL_MQL5_ID, // Sort by signal ID SORT_BY_SIGNAL_MQL5_LEVERAGE, // Sort by trading account leverage SORT_BY_SIGNAL_MQL5_PIPS, // Sort by trading result in pips SORT_BY_SIGNAL_MQL5_RATING, // Sort by a position in the signal rating SORT_BY_SIGNAL_MQL5_SUBSCRIBERS, // Sort by the number of subscribers SORT_BY_SIGNAL_MQL5_TRADES, // Sort by the number of trades SORT_BY_SIGNAL_MQL5_SUBSCRIPTION_STATUS, // Sort by the status of account subscription to a signal //--- Sort by real properties SORT_BY_SIGNAL_MQL5_BALANCE = FIRST_SIGNAL_MQL5_DBL_PROP, // Sort by account balance SORT_BY_SIGNAL_MQL5_EQUITY, // Sort by account equity SORT_BY_SIGNAL_MQL5_GAIN, // Sort by account growth in % SORT_BY_SIGNAL_MQL5_MAX_DRAWDOWN, // Sort by maximum drawdown SORT_BY_SIGNAL_MQL5_PRICE, // Sort by signal subscription price SORT_BY_SIGNAL_MQL5_ROI, // Sort by ROI //--- Sort by string properties SORT_BY_SIGNAL_MQL5_AUTHOR_LOGIN = FIRST_SIGNAL_MQL5_STR_PROP, // Sort by signal author login SORT_BY_SIGNAL_MQL5_BROKER, // Sort by Broker (company) name SORT_BY_SIGNAL_MQL5_BROKER_SERVER, // Sort by broker server SORT_BY_SIGNAL_MQL5_NAME, // Sort by signal name SORT_BY_SIGNAL_MQL5_CURRENCY, // Sort by signal account currency }; //+------------------------------------------------------------------+
これは、新しいライブラリオブジェクトの新しいクラスを作成するために最も必要なパラメータのセットです。
\MQL5\Include\DoEasy\Objects\に、CMQLSignalクラスの新しいファイルMQLSignal.mqhを特徴とする新しいフォルダMQLSignalBase\を作成します。
すべてのCBaseObjライブラリオブジェクトの基本オブジェクトのクラスを基本クラスとして使用します。
//+------------------------------------------------------------------+ //| MQLSignal.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" #property strict // Necessary for mql4 //+------------------------------------------------------------------+ //| Include files | //+------------------------------------------------------------------+ #include "..\..\Objects\BaseObj.mqh" //+------------------------------------------------------------------+ //| Abstract MQL5 signal class | //+------------------------------------------------------------------+ class CMQLSignal : public CBaseObj { }
クラスの構成とそのメソッドの実装について考えてみましょう。
//+------------------------------------------------------------------+ //| MQLSignal.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" #property strict // Necessary for mql4 //+------------------------------------------------------------------+ //| Include files | //+------------------------------------------------------------------+ #include "..\..\Objects\BaseObj.mqh" //+------------------------------------------------------------------+ //| Abstract MQL5 signal class | //+------------------------------------------------------------------+ class CMQLSignal : public CBaseObj { private: long m_long_prop[SIGNAL_MQL5_PROP_INTEGER_TOTAL]; // Integer properties double m_double_prop[SIGNAL_MQL5_PROP_DOUBLE_TOTAL]; // Real properties string m_string_prop[SIGNAL_MQL5_PROP_STRING_TOTAL]; // String properties //--- Return the index of the array the (1) double and (2) string properties are actually located at int IndexProp(ENUM_SIGNAL_MQL5_PROP_DOUBLE property) const { return(int)property-SIGNAL_MQL5_PROP_INTEGER_TOTAL; } int IndexProp(ENUM_SIGNAL_MQL5_PROP_STRING property) const { return(int)property-SIGNAL_MQL5_PROP_INTEGER_TOTAL-SIGNAL_MQL5_PROP_DOUBLE_TOTAL; } public: //--- Set object's (1) integer, (2) real and (3) string properties void SetProperty(ENUM_SIGNAL_MQL5_PROP_INTEGER property,long value) { this.m_long_prop[property]=value; } void SetProperty(ENUM_SIGNAL_MQL5_PROP_DOUBLE property,double value) { this.m_double_prop[this.IndexProp(property)]=value; } void SetProperty(ENUM_SIGNAL_MQL5_PROP_STRING property,string value) { this.m_string_prop[this.IndexProp(property)]=value; } //--- Return object’s (1) integer, (2) real and (3) string property from the properties array long GetProperty(ENUM_SIGNAL_MQL5_PROP_INTEGER property) const { return this.m_long_prop[property]; } double GetProperty(ENUM_SIGNAL_MQL5_PROP_DOUBLE property) const { return this.m_double_prop[this.IndexProp(property)]; } string GetProperty(ENUM_SIGNAL_MQL5_PROP_STRING property) const { return this.m_string_prop[this.IndexProp(property)]; } //--- Return itself CMQLSignal *GetObject(void) { return &this;} //--- Return the flag of the object supporting this property virtual bool SupportProperty(ENUM_SIGNAL_MQL5_PROP_INTEGER property) { return true; } virtual bool SupportProperty(ENUM_SIGNAL_MQL5_PROP_DOUBLE property) { return true; } virtual bool SupportProperty(ENUM_SIGNAL_MQL5_PROP_STRING property) { return true; } //--- Get description of (1) integer, (2) real and (3) string properties string GetPropertyDescription(ENUM_SIGNAL_MQL5_PROP_INTEGER property); string GetPropertyDescription(ENUM_SIGNAL_MQL5_PROP_DOUBLE property); string GetPropertyDescription(ENUM_SIGNAL_MQL5_PROP_STRING property); //--- Display the description of object properties in the journal (full_prop=true - all properties, false - supported ones only) void Print(const bool full_prop=false); //--- Display a short description of the object in the journal virtual void PrintShort(void); //--- Return the object short name virtual string Header(const bool shrt=false); //--- Compare CMQLSignal objects by a specified property (to sort the list by an MQL5 signal object) virtual int Compare(const CObject *node,const int mode=0) const; //--- Compare CMQLSignal objects by all properties (to search for equal MQL5 signal objects) bool IsEqual(CMQLSignal* compared_obj) const; //--- Constructors CMQLSignal(){;} CMQLSignal(const long signal_id); public: //+------------------------------------------------------------------+ //| Methods of simplified access to MQL5 signal object | //+------------------------------------------------------------------+ //--- Returns the dates of (1) publication, (2) monitoring start, (3) trading statistics last update, //--- (4) ID, (5) trading account leverage, (6) trading result in pips, (7) position in the signal rating, //--- (8) number of subscribers, (9) number of trades, (10) account type, (11) flag of the current account subscription to a signal datetime DatePublished(void) const { return (datetime)this.GetProperty(SIGNAL_MQL5_PROP_DATE_PUBLISHED); } datetime DateStarted(void) const { return (datetime)this.GetProperty(SIGNAL_MQL5_PROP_DATE_STARTED); } datetime DateUpdated(void) const { return (datetime)this.GetProperty(SIGNAL_MQL5_PROP_DATE_UPDATED); } long ID(void) const { return this.GetProperty(SIGNAL_MQL5_PROP_ID); } long Leverage(void) const { return this.GetProperty(SIGNAL_MQL5_PROP_LEVERAGE); } long Pips(void) const { return this.GetProperty(SIGNAL_MQL5_PROP_PIPS); } long Rating(void) const { return this.GetProperty(SIGNAL_MQL5_PROP_RATING); } long Subscribers(void) const { return this.GetProperty(SIGNAL_MQL5_PROP_SUBSCRIBERS); } long Trades(void) const { return this.GetProperty(SIGNAL_MQL5_PROP_TRADES); } long TradeMode(void) const { return (long)this.GetProperty(SIGNAL_MQL5_PROP_TRADE_MODE); } bool SubscriptionStatus(void)const { return (bool)this.GetProperty(SIGNAL_MQL5_PROP_SUBSCRIPTION_STATUS); } //--- Return (1) the account balance, (2) account funds, (3) account growth in %, //--- (4) maximum drawdown, (5) subscription price and (6) signal ROI value (Return on Investment) in % double Balance(void) const { return this.GetProperty(SIGNAL_MQL5_PROP_BALANCE); } double Equity(void) const { return this.GetProperty(SIGNAL_MQL5_PROP_EQUITY); } double Gain(void) const { return this.GetProperty(SIGNAL_MQL5_PROP_GAIN); } double MaxDrawdown(void) const { return this.GetProperty(SIGNAL_MQL5_PROP_MAX_DRAWDOWN); } double Price(void) const { return this.GetProperty(SIGNAL_MQL5_PROP_PRICE); } double ROI(void) const { return this.GetProperty(SIGNAL_MQL5_PROP_ROI); } //--- Return (1) signal author's login, (2) broker (company) name, //--- (3) broker server, (4) signal name and (5) signal account currency string AuthorLogin(void) const { return this.GetProperty(SIGNAL_MQL5_PROP_AUTHOR_LOGIN); } string Broker(void) const { return this.GetProperty(SIGNAL_MQL5_PROP_BROKER); } string BrokerServer(void) const { return this.GetProperty(SIGNAL_MQL5_PROP_BROKER_SERVER); } string Name(void) const { return this.GetProperty(SIGNAL_MQL5_PROP_NAME); } string Currency(void) const { return this.GetProperty(SIGNAL_MQL5_PROP_CURRENCY); } //--- Set the dates of (1) publication, (2) monitoring start, (3) trading statistics last update, //--- (4) ID, (5) trading account leverage, (6) trading result in pips, (7) position in the signal rating, //--- (8) number of subscribers, (9) number of trades, (10) account type, (11) flag of the current account subscription to a signal void SetDatePublished(const datetime date) { this.SetProperty(SIGNAL_MQL5_PROP_DATE_PUBLISHED,date); } void SetDateStarted(const datetime date) { this.SetProperty(SIGNAL_MQL5_PROP_DATE_STARTED,date); } void SetDateUpdated(const datetime date) { this.SetProperty(SIGNAL_MQL5_PROP_DATE_UPDATED,date); } void SetID(const long id) { this.SetProperty(SIGNAL_MQL5_PROP_ID,id); } void SetLeverage(const long value) { this.SetProperty(SIGNAL_MQL5_PROP_LEVERAGE,value); } void SetPips(const long value) { this.SetProperty(SIGNAL_MQL5_PROP_PIPS,value); } void SetRating(const long value) { this.SetProperty(SIGNAL_MQL5_PROP_RATING,value); } void SetSubscribers(const long value) { this.SetProperty(SIGNAL_MQL5_PROP_SUBSCRIBERS,value); } void SetTrades(const long value) { this.SetProperty(SIGNAL_MQL5_PROP_TRADES,value); } void SetTradeMode(const long mode) { this.SetProperty(SIGNAL_MQL5_PROP_TRADE_MODE,mode); } void SetSubscriptionStatus(const bool flag) { this.SetProperty(SIGNAL_MQL5_PROP_SUBSCRIPTION_STATUS,flag); } //--- Set (1) the account balance, (2) account funds, (3) account growth in %, //--- (4) maximum drawdown, (5) subscription price and (6) signal ROI value (Return on Investment) in % void SetBalance(const double value) { this.SetProperty(SIGNAL_MQL5_PROP_BALANCE,value); } void SetEquity(const double value) { this.SetProperty(SIGNAL_MQL5_PROP_EQUITY,value); } void SetGain(const double value) { this.SetProperty(SIGNAL_MQL5_PROP_GAIN,value); } void SetMaxDrawdown(const double value) { this.SetProperty(SIGNAL_MQL5_PROP_MAX_DRAWDOWN,value); } void SetPrice(const double value) { this.SetProperty(SIGNAL_MQL5_PROP_PRICE,value); } void SetROI(const double value) { this.SetProperty(SIGNAL_MQL5_PROP_ROI,value); } //--- Set (1) signal author's login, (2) broker (company) name, //--- (3) broker server, (4) signal name and (5) signal account currency void SetAuthorLogin(const string value) { this.SetProperty(SIGNAL_MQL5_PROP_AUTHOR_LOGIN,value); } void SetBroker(const string value) { this.SetProperty(SIGNAL_MQL5_PROP_BROKER,value); } void SetBrokerServer(const string value) { this.SetProperty(SIGNAL_MQL5_PROP_BROKER_SERVER,value); } void SetName(const string value) { this.SetProperty(SIGNAL_MQL5_PROP_NAME,value); } void SetCurrency(const string value) { this.SetProperty(SIGNAL_MQL5_PROP_CURRENCY,value); } //--- Return the account type name string TradeModeDescription(void); }; //+------------------------------------------------------------------+
整数、実数、文字列のオブジェクトプロパティを格納するための配列と、オブジェクトの実数インデックスと文字列プロパティを返すメソッドは、privateセクションで宣言されています。
クラスのpublicセクションには、オブジェクトプロパティの設定と受信、検索と並べ替え、オブジェクトの説明とクラスコンストラクターの表示の標準的なメソッドがあります。
publicセクションには、オブジェクトプロパティへの簡単なアクセスのためのメソッドもあります。メソッドにはわかりやすい名前が付いているため、ライブラリユーザーはすべてのオブジェクト列挙の名前を覚えなくても任意のプロパティにアクセスできます。
オブジェクトクラスの構成は、第1部で詳細に検討されました。クラスメソッドの実装を見てみましょう。
パラメトリッククラスコンストラクタはシグナルIDを受けとります。次に、すべてのオブジェクトプロパティに、適切な関数から取得した値が入力されます(このシグナルが選択されていることを考慮)。
//+------------------------------------------------------------------+ //| Parametric constructor | //+------------------------------------------------------------------+ CMQLSignal::CMQLSignal(const long signal_id) { this.m_long_prop[SIGNAL_MQL5_PROP_ID] = signal_id; this.m_long_prop[SIGNAL_MQL5_PROP_SUBSCRIPTION_STATUS] = false; this.m_long_prop[SIGNAL_MQL5_PROP_TRADE_MODE] = ::SignalBaseGetInteger(SIGNAL_BASE_TRADE_MODE); this.m_long_prop[SIGNAL_MQL5_PROP_DATE_PUBLISHED] = ::SignalBaseGetInteger(SIGNAL_BASE_DATE_PUBLISHED); this.m_long_prop[SIGNAL_MQL5_PROP_DATE_STARTED] = ::SignalBaseGetInteger(SIGNAL_BASE_DATE_STARTED); this.m_long_prop[SIGNAL_MQL5_PROP_DATE_UPDATED] = ::SignalBaseGetInteger(SIGNAL_BASE_DATE_UPDATED); this.m_long_prop[SIGNAL_MQL5_PROP_LEVERAGE] = ::SignalBaseGetInteger(SIGNAL_BASE_LEVERAGE); this.m_long_prop[SIGNAL_MQL5_PROP_PIPS] = ::SignalBaseGetInteger(SIGNAL_BASE_PIPS); this.m_long_prop[SIGNAL_MQL5_PROP_RATING] = ::SignalBaseGetInteger(SIGNAL_BASE_RATING); this.m_long_prop[SIGNAL_MQL5_PROP_SUBSCRIBERS] = ::SignalBaseGetInteger(SIGNAL_BASE_SUBSCRIBERS); this.m_long_prop[SIGNAL_MQL5_PROP_TRADES] = ::SignalBaseGetInteger(SIGNAL_BASE_TRADES); this.m_double_prop[this.IndexProp(SIGNAL_MQL5_PROP_BALANCE)] = ::SignalBaseGetDouble(SIGNAL_BASE_BALANCE); this.m_double_prop[this.IndexProp(SIGNAL_MQL5_PROP_EQUITY)] = ::SignalBaseGetDouble(SIGNAL_BASE_EQUITY); this.m_double_prop[this.IndexProp(SIGNAL_MQL5_PROP_GAIN)] = ::SignalBaseGetDouble(SIGNAL_BASE_GAIN); this.m_double_prop[this.IndexProp(SIGNAL_MQL5_PROP_MAX_DRAWDOWN)] = ::SignalBaseGetDouble(SIGNAL_BASE_MAX_DRAWDOWN); this.m_double_prop[this.IndexProp(SIGNAL_MQL5_PROP_PRICE)] = ::SignalBaseGetDouble(SIGNAL_BASE_PRICE); this.m_double_prop[this.IndexProp(SIGNAL_MQL5_PROP_ROI)] = ::SignalBaseGetDouble(SIGNAL_BASE_ROI); this.m_string_prop[this.IndexProp(SIGNAL_MQL5_PROP_AUTHOR_LOGIN)] = ::SignalBaseGetString(SIGNAL_BASE_AUTHOR_LOGIN); this.m_string_prop[this.IndexProp(SIGNAL_MQL5_PROP_BROKER)] = ::SignalBaseGetString(SIGNAL_BASE_BROKER); this.m_string_prop[this.IndexProp(SIGNAL_MQL5_PROP_BROKER_SERVER)]= ::SignalBaseGetString(SIGNAL_BASE_BROKER_SERVER); this.m_string_prop[this.IndexProp(SIGNAL_MQL5_PROP_NAME)] = ::SignalBaseGetString(SIGNAL_BASE_NAME); this.m_string_prop[this.IndexProp(SIGNAL_MQL5_PROP_CURRENCY)] = ::SignalBaseGetString(SIGNAL_BASE_CURRENCY); } //+------------------------------------------------------------------+
シグナルサブスクリプションフラグがfalseに設定されていると、選択したシグナルへのサブスクリプションが別のクラスから実行されます。
以下は、指定されたプロパティによってMQL5シグナルオブジェクトを比較するメソッドです。
//+----------------------------------------------------------------------+ //| Compare CMQLSignal objects with each other by the specified property | //+----------------------------------------------------------------------+ int CMQLSignal::Compare(const CObject *node,const int mode=0) const { const CMQLSignal *obj_compared=node; //--- compare integer properties of two objects if(mode<SIGNAL_MQL5_PROP_INTEGER_TOTAL) { long value_compared=obj_compared.GetProperty((ENUM_SIGNAL_MQL5_PROP_INTEGER)mode); long value_current=this.GetProperty((ENUM_SIGNAL_MQL5_PROP_INTEGER)mode); return(value_current>value_compared ? 1 : value_current<value_compared ? -1 : 0); } //--- compare real properties of two objects else if(mode<SIGNAL_MQL5_PROP_DOUBLE_TOTAL+SIGNAL_MQL5_PROP_INTEGER_TOTAL) { double value_compared=obj_compared.GetProperty((ENUM_SIGNAL_MQL5_PROP_DOUBLE)mode); double value_current=this.GetProperty((ENUM_SIGNAL_MQL5_PROP_DOUBLE)mode); return(value_current>value_compared ? 1 : value_current<value_compared ? -1 : 0); } //--- compare string properties of two objects else if(mode<SIGNAL_MQL5_PROP_DOUBLE_TOTAL+SIGNAL_MQL5_PROP_INTEGER_TOTAL+SIGNAL_MQL5_PROP_STRING_TOTAL) { string value_compared=obj_compared.GetProperty((ENUM_SIGNAL_MQL5_PROP_STRING)mode); string value_current=this.GetProperty((ENUM_SIGNAL_MQL5_PROP_STRING)mode); return(value_current>value_compared ? 1 : value_current<value_compared ? -1 : 0); } return 0; } //+------------------------------------------------------------------+
簡単に言うと、このメソッドは、比較対象のオブジェクトと、2つのオブジェクトを比較するためのプロパティを受け取ります。渡されたプロパティに応じて、2つのオブジェクトの整数、実数、または文字列のプロパティが比較されます。-1、1、0(より小さい、より大きい、等しい)のいずれか比較結果が返されます。
以下は、MQL5シグナルオブジェクトをすべてのプロパティで比較するメソッドです。
//+------------------------------------------------------------------+ //| Compare CMQLSignal objects by all properties | //+------------------------------------------------------------------+ bool CMQLSignal::IsEqual(CMQLSignal *compared_obj) const { int beg=0, end=SIGNAL_MQL5_PROP_INTEGER_TOTAL; for(int i=beg; i<end; i++) { ENUM_SIGNAL_MQL5_PROP_INTEGER prop=(ENUM_SIGNAL_MQL5_PROP_INTEGER)i; if(this.GetProperty(prop)!=compared_obj.GetProperty(prop)) return false; } beg=end; end+=SIGNAL_MQL5_PROP_DOUBLE_TOTAL; for(int i=beg; i<end; i++) { ENUM_SIGNAL_MQL5_PROP_DOUBLE prop=(ENUM_SIGNAL_MQL5_PROP_DOUBLE)i; if(this.GetProperty(prop)!=compared_obj.GetProperty(prop)) return false; } beg=end; end+=SIGNAL_MQL5_PROP_STRING_TOTAL; for(int i=beg; i<end; i++) { ENUM_SIGNAL_MQL5_PROP_STRING prop=(ENUM_SIGNAL_MQL5_PROP_STRING)i; if(this.GetProperty(prop)!=compared_obj.GetProperty(prop)) return false; } return true; } //+------------------------------------------------------------------+
3つのオブジェクトプロパティによる3つのループで、2つのオブジェクトの後続の各プロパティを比較し、2つのオブジェクトのプロパティが等しくない場合は、falseを返します。3つの配列内の2つのオブジェクトのすべてのプロパティを比較した後、等しくないプロパティが見つからない場合はtrueを返します。
以下は、指定された整数、実数、文字列オブジェクトプロパティの説明を返すメソッドです。
//+------------------------------------------------------------------+ //| Return description of object's integer property | //+------------------------------------------------------------------+ string CMQLSignal::GetPropertyDescription(ENUM_SIGNAL_MQL5_PROP_INTEGER property) { return ( property==SIGNAL_MQL5_PROP_TRADE_MODE ? CMessage::Text(MSG_SIGNAL_MQL5_TRADE_MODE)+ (!this.SupportProperty(property) ? ": "+CMessage::Text(MSG_LIB_PROP_NOT_SUPPORTED) : ": "+this.TradeModeDescription() ) : property==SIGNAL_MQL5_PROP_DATE_PUBLISHED ? CMessage::Text(MSG_SIGNAL_MQL5_DATE_PUBLISHED)+ (!this.SupportProperty(property) ? ": "+CMessage::Text(MSG_LIB_PROP_NOT_SUPPORTED) : ": "+::TimeToString(this.DatePublished()) ) : property==SIGNAL_MQL5_PROP_DATE_STARTED ? CMessage::Text(MSG_SIGNAL_MQL5_DATE_STARTED)+ (!this.SupportProperty(property) ? ": "+CMessage::Text(MSG_LIB_PROP_NOT_SUPPORTED) : ": "+::TimeToString(this.DateStarted()) ) : property==SIGNAL_MQL5_PROP_DATE_UPDATED ? CMessage::Text(MSG_SIGNAL_MQL5_DATE_UPDATED)+ (!this.SupportProperty(property) ? ": "+CMessage::Text(MSG_LIB_PROP_NOT_SUPPORTED) : ": "+::TimeToString(this.DateUpdated()) ) : property==SIGNAL_MQL5_PROP_ID ? CMessage::Text(MSG_SIGNAL_MQL5_ID)+ (!this.SupportProperty(property) ? ": "+CMessage::Text(MSG_LIB_PROP_NOT_SUPPORTED) : ": "+(string)this.GetProperty(property) ) : property==SIGNAL_MQL5_PROP_LEVERAGE ? CMessage::Text(MSG_SIGNAL_MQL5_LEVERAGE)+ (!this.SupportProperty(property) ? ": "+CMessage::Text(MSG_LIB_PROP_NOT_SUPPORTED) : ": "+(string)this.GetProperty(property) ) : property==SIGNAL_MQL5_PROP_PIPS ? CMessage::Text(MSG_SIGNAL_MQL5_PIPS)+ (!this.SupportProperty(property) ? ": "+CMessage::Text(MSG_LIB_PROP_NOT_SUPPORTED) : ": "+(string)this.GetProperty(property) ) : property==SIGNAL_MQL5_PROP_RATING ? CMessage::Text(MSG_SIGNAL_MQL5_RATING)+ (!this.SupportProperty(property) ? ": "+CMessage::Text(MSG_LIB_PROP_NOT_SUPPORTED) : ": "+(string)this.GetProperty(property) ) : property==SIGNAL_MQL5_PROP_SUBSCRIBERS ? CMessage::Text(MSG_SIGNAL_MQL5_SUBSCRIBERS)+ (!this.SupportProperty(property) ? ": "+CMessage::Text(MSG_LIB_PROP_NOT_SUPPORTED) : ": "+(string)this.GetProperty(property) ) : property==SIGNAL_MQL5_PROP_TRADES ? CMessage::Text(MSG_SIGNAL_MQL5_TRADES)+ (!this.SupportProperty(property) ? ": "+CMessage::Text(MSG_LIB_PROP_NOT_SUPPORTED) : ": "+(string)this.GetProperty(property) ) : property==SIGNAL_MQL5_PROP_SUBSCRIPTION_STATUS ? CMessage::Text(MSG_SIGNAL_MQL5_SUBSCRIPTION_STATUS)+ (!this.SupportProperty(property) ? ": "+CMessage::Text(MSG_LIB_PROP_NOT_SUPPORTED) : ": "+(this.GetProperty(property) ? CMessage::Text(MSG_LIB_TEXT_YES) : CMessage::Text(MSG_LIB_TEXT_NO)) ) : "" ); } //+------------------------------------------------------------------+ //| Return description of object's real property | //+------------------------------------------------------------------+ string CMQLSignal::GetPropertyDescription(ENUM_SIGNAL_MQL5_PROP_DOUBLE property) { return ( property==SIGNAL_MQL5_PROP_BALANCE ? CMessage::Text(MSG_ACC_PROP_BALANCE)+ (!this.SupportProperty(property) ? ": "+CMessage::Text(MSG_LIB_PROP_NOT_SUPPORTED) : ": "+::DoubleToString(this.GetProperty(property),2) ) : property==SIGNAL_MQL5_PROP_EQUITY ? CMessage::Text(MSG_SIGNAL_MQL5_EQUITY)+ (!this.SupportProperty(property) ? ": "+CMessage::Text(MSG_LIB_PROP_NOT_SUPPORTED) : ": "+::DoubleToString(this.GetProperty(property),2) ) : property==SIGNAL_MQL5_PROP_GAIN ? CMessage::Text(MSG_SIGNAL_MQL5_GAIN)+ (!this.SupportProperty(property) ? ": "+CMessage::Text(MSG_LIB_PROP_NOT_SUPPORTED) : ": "+::DoubleToString(this.GetProperty(property),2) ) : property==SIGNAL_MQL5_PROP_MAX_DRAWDOWN ? CMessage::Text(MSG_SIGNAL_MQL5_MAX_DRAWDOWN)+ (!this.SupportProperty(property) ? ": "+CMessage::Text(MSG_LIB_PROP_NOT_SUPPORTED) : ": "+::DoubleToString(this.GetProperty(property),2) ) : property==SIGNAL_MQL5_PROP_PRICE ? CMessage::Text(MSG_SIGNAL_MQL5_PRICE)+ (!this.SupportProperty(property) ? ": "+CMessage::Text(MSG_LIB_PROP_NOT_SUPPORTED) : ": "+::DoubleToString(this.GetProperty(property),2) ) : property==SIGNAL_MQL5_PROP_ROI ? CMessage::Text(MSG_SIGNAL_MQL5_ROI)+ (!this.SupportProperty(property) ? ": "+CMessage::Text(MSG_LIB_PROP_NOT_SUPPORTED) : ": "+::DoubleToString(this.GetProperty(property),2) ) : "" ); } //+------------------------------------------------------------------+ //| Return description of object's string property | //+------------------------------------------------------------------+ string CMQLSignal::GetPropertyDescription(ENUM_SIGNAL_MQL5_PROP_STRING property) { return ( property==SIGNAL_MQL5_PROP_AUTHOR_LOGIN ? CMessage::Text(MSG_SIGNAL_MQL5_AUTHOR_LOGIN)+": \""+this.GetProperty(property)+"\"" : property==SIGNAL_MQL5_PROP_BROKER ? CMessage::Text(MSG_SIGNAL_MQL5_BROKER)+": \""+this.GetProperty(property)+"\"" : property==SIGNAL_MQL5_PROP_BROKER_SERVER ? CMessage::Text(MSG_SIGNAL_MQL5_BROKER_SERVER)+": \""+this.GetProperty(property)+"\"" : property==SIGNAL_MQL5_PROP_NAME ? CMessage::Text(MSG_SIGNAL_MQL5_NAME)+": \""+this.GetProperty(property)+"\"" : property==SIGNAL_MQL5_PROP_CURRENCY ? CMessage::Text(MSG_SIGNAL_MQL5_CURRENCY)+": \""+this.GetProperty(property)+"\"" : "" ); } //+------------------------------------------------------------------+
メソッドに渡されたプロパティに応じて、説明と値を含む文字列が作成されて返されます。
以下は、操作ログにすべてのMQL5シグナルオブジェクトプロパティを表示するメソッドです。
//+------------------------------------------------------------------+ //| Display object properties in the journal | //+------------------------------------------------------------------+ void CMQLSignal::Print(const bool full_prop=false) { ::Print("============= ",CMessage::Text(MSG_LIB_PARAMS_LIST_BEG)," (",this.Header(),") ============="); int beg=0, end=SIGNAL_MQL5_PROP_INTEGER_TOTAL; for(int i=beg; i<end; i++) { ENUM_SIGNAL_MQL5_PROP_INTEGER prop=(ENUM_SIGNAL_MQL5_PROP_INTEGER)i; if(!full_prop && !this.SupportProperty(prop)) continue; ::Print(this.GetPropertyDescription(prop)); } ::Print("------"); beg=end; end+=SIGNAL_MQL5_PROP_DOUBLE_TOTAL; for(int i=beg; i<end; i++) { ENUM_SIGNAL_MQL5_PROP_DOUBLE prop=(ENUM_SIGNAL_MQL5_PROP_DOUBLE)i; if(!full_prop && !this.SupportProperty(prop)) continue; ::Print(this.GetPropertyDescription(prop)); } ::Print("------"); beg=end; end+=SIGNAL_MQL5_PROP_STRING_TOTAL; for(int i=beg; i<end; i++) { ENUM_SIGNAL_MQL5_PROP_STRING prop=(ENUM_SIGNAL_MQL5_PROP_STRING)i; if(!full_prop && !this.SupportProperty(prop)) continue; ::Print(this.GetPropertyDescription(prop)); } ::Print("============= ",CMessage::Text(MSG_LIB_PARAMS_LIST_END)," (",this.Header(),") =============\n"); } //+------------------------------------------------------------------+
後続の各オブジェクトプロパティの説明は、適切なGetPropertyDescription()メソッドを使用して、整数、実数、文字列のプロパティごとに3つのループで表示されます。
以下は、MQL5シグナルオブジェクトの短い名前を返すメソッドです。
//+------------------------------------------------------------------+ //| Return the object short name | //+------------------------------------------------------------------+ string CMQLSignal::Header(const bool shrt=false) { return(shrt ? CMessage::Text(MSG_SIGNAL_MQL5_TEXT_SIGNAL) : CMessage::Text(MSG_SIGNAL_MQL5_TEXT_SIGNAL_MQL5)); } //+------------------------------------------------------------------+
メソッドは、shortまたはlongの説明を指定するフラグを受け取ります。長い説明はデフォルトで表示されます。
MQL5.comシグナルサービスのシグナル
フラグがtrueの場合、簡単な説明が表示されます。
シグナル
以下は、操作ログに短いオブジェクトの説明を表示するメソッドです。
//+------------------------------------------------------------------+ //| Display a short description of the object in the journal | //+------------------------------------------------------------------+ void CMQLSignal::PrintShort(void) { ::Print ( this.Header(true), " \"",this.Name(),"\". ", CMessage::Text(MSG_SIGNAL_MQL5_AUTHOR_LOGIN),": ",this.AuthorLogin(), ", ID ",this.ID(), ", ",CMessage::Text(MSG_SIGNAL_MQL5_TEXT_GAIN),": ",::DoubleToString(this.Gain(),2), ", ",CMessage::Text(MSG_SIGNAL_MQL5_TEXT_DRAWDOWN),": ",::DoubleToString(this.MaxDrawdown(),2), ", ",CMessage::Text(MSG_LIB_TEXT_REQUEST_PRICE),": ",::DoubleToString(this.Price(),2) ); } //+------------------------------------------------------------------+
短いSignalヘッダーが最初に作成されます。ターミナル操作ログに表示されるいくつかのパラメータがそれに追加されます。
たとえば、次のようになります。
Signal "DemoForArticle". Author login: login, ID XXXXXX, Growth: XX.XX, Drawdown: XX.XX, Price: XX.XX
以下は、口座タイプ名を返すメソッドです。
//+------------------------------------------------------------------+ //| Return the account type name | //+------------------------------------------------------------------+ string CMQLSignal::TradeModeDescription(void) { return ( this.TradeMode()==0 ? CMessage::Text(MSG_ACC_TRADE_MODE_REAL) : this.TradeMode()==1 ? CMessage::Text(MSG_ACC_TRADE_MODE_DEMO) : this.TradeMode()==2 ? CMessage::Text(MSG_ACC_TRADE_MODE_CONTEST) : CMessage::Text(MSG_ACC_TRADE_MODE_UNKNOWN) ); } //+------------------------------------------------------------------+
シグナルソース口座に応じて、口座タイプ(リアル、デモ、コンテスト)の文字列が返されます。
これで、MQL5シグナルオブジェクトの作成は完了です。
検証
テストを実行するには、前の記事のEAを使用して、\MQL5\Experts\TestDoEasy\Part65\にTestDoEasyPart65.mq5として保存します。
DOMスナップショットシリーズコレクションクラスがメインライブラリオブジェクトから利用できるようになりましたが、MQL5シグナルオブジェクトはまだCEngineに接続されていません。したがって、DOMスナップショットシリーズオブジェクトクラスをインクルードする文字列
#include <DoEasy\Objects\Book\MBookSeries.mqh>
をMQL5シグナルオブジェクトのインクルードで置き換えましょう。
//+------------------------------------------------------------------+ //| TestDoEasyPart65.mq5 | //| 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" //--- includes #include <DoEasy\Engine.mqh> #include <DoEasy\Objects\MQLSignalBase\MQLSignal.mqh> //--- enums
EAグローバル変数のリストからDOMスナップショットシリーズオブジェクトの宣言を削除します。
//--- global variables CEngine engine; SDataButt butt_data[TOTAL_BUTT]; string prefix; double lot; double withdrawal=(InpWithdrawal<0.1 ? 0.1 : InpWithdrawal); ushort magic_number; uint stoploss; uint takeprofit; uint distance_pending; uint distance_stoplimit; uint distance_pending_request; uint bars_delay_pending_request; uint slippage; bool trailing_on; bool pressed_pending_buy; bool pressed_pending_buy_limit; bool pressed_pending_buy_stop; bool pressed_pending_buy_stoplimit; bool pressed_pending_close_buy; bool pressed_pending_close_buy2; bool pressed_pending_close_buy_by_sell; bool pressed_pending_sell; bool pressed_pending_sell_limit; bool pressed_pending_sell_stop; bool pressed_pending_sell_stoplimit; bool pressed_pending_close_sell; bool pressed_pending_close_sell2; bool pressed_pending_close_sell_by_buy; bool pressed_pending_delete_all; bool pressed_pending_close_all; bool pressed_pending_sl; bool pressed_pending_tp; double trailing_stop; double trailing_step; uint trailing_start; uint stoploss_to_modify; uint takeprofit_to_modify; int used_symbols_mode; string array_used_symbols[]; string array_used_periods[]; bool testing; uchar group1; uchar group2; double g_point; int g_digits; //--- CMBookSeries book_series; //+------------------------------------------------------------------+
MQL5ヘルプには、サブスクライバーの数がゼロ以外の収益性の高い無料シグナルのリストを受信する例があります。
void OnStart() { //--- request the total number of signals in the signal database int total=SignalBaseTotal(); //--- loop through all signals for(int i=0;i<total;i++) { //--- select a signal for further operation if(SignalBaseSelect(i)) { //--- receive signal properties long id =SignalBaseGetInteger(SIGNAL_BASE_ID); // signal ID long pips =SignalBaseGetInteger(SIGNAL_BASE_PIPS); // trading result in pips long subscr=SignalBaseGetInteger(SIGNAL_BASE_SUBSCRIBERS); // number of subscribers string name =SignalBaseGetString(SIGNAL_BASE_NAME); // signal name double price =SignalBaseGetDouble(SIGNAL_BASE_PRICE); // signal subscription price string curr =SignalBaseGetString(SIGNAL_BASE_CURRENCY); // signal currency //--- display all profitable free signals with a non-zero number of subscribers if(price==0.0 && pips>0 && subscr>0) PrintFormat("id=%d, name=\"%s\", currency=%s, pips=%d, subscribers=%d",id,name,curr,pips,subscr); } else PrintFormat("Signal selection error. Error code=%d",GetLastError()); } }
新しいMQL5シグナルオブジェクトを使用して同じことを行いましょう。EAのOnInit()ハンドラに次のコードブロックを追加します。
//+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- Calling the function displays the list of enumeration constants in the journal //--- (the list is set in the strings 22 and 25 of the DELib.mqh file) for checking the constants validity //EnumNumbersTest(); //--- Set EA global variables prefix=MQLInfoString(MQL_PROGRAM_NAME)+"_"; testing=engine.IsTester(); for(int i=0;i<TOTAL_BUTT;i++) { butt_data[i].name=prefix+EnumToString((ENUM_BUTTONS)i); butt_data[i].text=EnumToButtText((ENUM_BUTTONS)i); } lot=NormalizeLot(Symbol(),fmax(InpLots,MinimumLots(Symbol())*2.0)); magic_number=InpMagic; stoploss=InpStopLoss; takeprofit=InpTakeProfit; distance_pending=InpDistance; distance_stoplimit=InpDistanceSL; slippage=InpSlippage; trailing_stop=InpTrailingStop*Point(); trailing_step=InpTrailingStep*Point(); trailing_start=InpTrailingStart; stoploss_to_modify=InpStopLossModify; takeprofit_to_modify=InpTakeProfitModify; distance_pending_request=(InpDistancePReq<5 ? 5 : InpDistancePReq); bars_delay_pending_request=(InpBarsDelayPReq<1 ? 1 : InpBarsDelayPReq); g_point=SymbolInfoDouble(NULL,SYMBOL_POINT); g_digits=(int)SymbolInfoInteger(NULL,SYMBOL_DIGITS); //--- Initialize random group numbers group1=0; group2=0; srand(GetTickCount()); //--- Initialize DoEasy library OnInitDoEasy(); //--- Check and remove remaining EA graphical objects if(IsPresentObectByPrefix(prefix)) ObjectsDeleteAll(0,prefix); //--- Create the button panel if(!CreateButtons(InpButtShiftX,InpButtShiftY)) return INIT_FAILED; //--- Set trailing activation button status ButtonState(butt_data[TOTAL_BUTT-1].name,trailing_on); //--- Reset states of the buttons for working using pending requests for(int i=0;i<14;i++) { ButtonState(butt_data[i].name+"_PRICE",false); ButtonState(butt_data[i].name+"_TIME",false); } //--- Check playing a standard sound by macro substitution and a custom sound by description engine.PlaySoundByDescription(SND_OK); //--- Wait for 600 milliseconds engine.Pause(600); engine.PlaySoundByDescription(TextByLanguage("Звук упавшей монетки 2","Falling coin 2")); CArrayObj *list=new CArrayObj(); if(list!=NULL) { //--- request the total number of signals in the signal database int total=SignalBaseTotal(); //--- loop through all signals for(int i=0;i<total;i++) { //--- select a signal for further operation if(!SignalBaseSelect(i)) continue; long id=SignalBaseGetInteger(SIGNAL_BASE_ID); CMQLSignal *signal=new CMQLSignal(id); if(signal==NULL) continue; if(!list.Add(signal)) { delete signal; continue; } } //--- display all profitable free signals with a non-zero number of subscribers Print(""); static bool done=false; for(int i=0;i<list.Total();i++) { CMQLSignal *signal=list.At(i); if(signal==NULL) continue; if(signal.Price()>0 || signal.Subscribers()==0) continue; //--- The very first suitable signal is fully displayed in the journal if(!done) { signal.Print(); done=true; } //--- Short descriptions are displayed for the rest else signal.PrintShort(); } delete list; } //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+
一見すると、結果として得られるコードの量は、ヘルプのコードよりも多くなります。しかし、これは一時的な現象です... シグナルコレクションクラスの準備が整うとすぐに、はるかに簡潔になります。それまでの間、コードを使用して、MQL5シグナルオブジェクトが正しく機能するかどうかを確認します。
メインライブラリオブジェクトからDOMスナップショットシリーズコレクションクラスにアクセスできるようになったため、OnBookEvent()ハンドラにいくつかの変更が加えられました。次のようになります。
//+------------------------------------------------------------------+ //| OnBookEvent function | //+------------------------------------------------------------------+ void OnBookEvent(const string& symbol) { static bool first=true; //--- Leave if failed to update the symbol snapshot series if(!engine.OnBookEvent(symbol)) return; //--- Work by the current symbol if(symbol==Symbol()) { //--- Get the DOM snapshot series of the current symbol CMBookSeries *book_series=engine.GetMBookSeries(symbol); if(book_series==NULL) return; //--- Get the last DOM snapshot object from the DOM snapshot series object CMBookSnapshot *book=book_series.GetLastMBook(); if(book==NULL) return; //--- Get the very first and last DOM order objects from the DOM snapshot object CMarketBookOrd *ord_0=book.GetMBookByListIndex(0); CMarketBookOrd *ord_N=book.GetMBookByListIndex(book.DataTotal()-1); if(ord_0==NULL || ord_N==NULL) return; //--- Display the time of the current DOM snapshot in the chart comment, //--- the maximum number of displayed orders in DOM for a symbol, //--- the obtained number of orders in the current DOM snapshot, //--- the total number of DOM snapshots set in the series list and //--- the highest and lowest orders of the current DOM snapshot Comment ( DFUN,book.Symbol(),": ",TimeMSCtoString(book.Time()), //", symbol book size=",sym.TicksBookdepth(), ", last book data total: ",book.DataTotal(), ", series books total: ",book_series.DataTotal(), "\nMax: ",ord_N.Header(),"\nMin: ",ord_0.Header() ); //--- Display the first DOM snapshot in the journal if(first) { //--- series description book_series.Print(); //--- snapshot description book.Print(); first=false; } } } //+------------------------------------------------------------------+
OnInitDoEasy()関数にもいくつか修正を加えましょう。現在、使用されているすべての銘柄のティックシリーズの作成は、ライブラリメインオブジェクトの適切なメソッドへの直接アクセスとして実装されています。さらに、作成したDOMシリーズのチェックを追加しました。
//--- Check created timeseries - display descriptions of all created timeseries in the journal //--- (true - only created ones, false - created and declared ones) engine.GetTimeSeriesCollection().PrintShort(false); // Short descriptions //--- Create tick series of all used symbols engine.TickSeriesCreateAll(); //--- Check created tick series - display descriptions of all created tick series in the journal engine.GetTickSeriesCollection().Print(); //--- Check created DOM series - display descriptions of all created DOM series in the journal engine.GetMBookSeriesCollection().Print();
EAをコンパイルし、2つの銘柄の使用法と現在のチャート期間を設定で事前に設定して起動します。
作成されたDOMスナップショットコレクションのデータ、最初の適切なシグナルの完全なデータ、すべての有益な無料シグナルの短いデータは操作ログに表示されます。リストの最後には、スナップショットシリーズのデータと、現在のグラフで最初に取得されたDOMスナップショットが表示されます。
Account 8550475: Artyom Trishkin (MetaQuotes Software Corp.) 10428.13 USD, 1:100, Hedge, MetaTrader 5 demo --- Initializing "DoEasy" library --- Working with predefined symbol list. The number of used symbols: 2 "AUDUSD" "EURUSD" Working with the current timeframe only: H1 AUDUSD symbol timeseries: - Timeseries "AUDUSD" H1: Requested: 1000, Actual: 1000, Created: 1000, On the server: 5385 EURUSD symbol timeseries: - Timeseries "EURUSD" H1: Requested: 1000, Actual: 1000, Created: 1000, On the server: 6310 Tick series "AUDUSD": Requested number of days: 1, Historical data created: 294221 Tick series "EURUSD": Requested number of days: 1, Historical data created: 216048 DOM snapshot series collection: - "AUDUSD" DOM snapshot series: Requested number of days: 1, Actual history depth: 0 "EURUSD" DOM snapshot series: Requested number of days: 1, Actual history depth: 0 Subscribed to Depth of Market AUDUSD Subscribed to Depth of Market EURUSD Library initialization time: 00:00:25.015 ============= Beginning of parameter list (Signal from the MQL5.com Signal service) ============= Account type: Demo Publication date: 2018.06.04 16:45 Monitoring start date: 2018.06.04 16:45 Date of the latest update of the trading statistics: 2021.02.20 02:01 ID: 435626 Trading account leverage: 200 Trading result in pips: -72124 Position in the Rating of Signals: 12 Number of subscribers: 132 Number of trades: 7866 Status of account subscription to a signal: No ------ Account balance: 43144.27 Account equity: 43150.55 Account growth in %: 331.44 Maximum drawdown: 43.93 Signal subscription price: 0.00 Signal ROI (Return on Investment) in %: 331.51 ------ Author login: "robots4forex" Broker (company) name: "MetaQuotes Software Corp." Broker server: "MetaQuotes-Demo" Name: "Prospector Scalper EA" Account currency: "GBP" ============= End of parameter list (Signal from the MQL5.com Signal service) ============= Signal "ADS MT5". Author login: vluxus, ID 478235, Growth: 251.84, Drawdown: 40.26, Price: 0.00 Signal "Sparrow USD ForexClub c 01012019". Author login: Tradotrade, ID 519975, Growth: 12.45, Drawdown: 14.98, Price: 0.00 Signal "RAZRED v03". Author login: joaoluiz_sa, ID 545382, Growth: 96.17, Drawdown: 28.18, Price: 0.00 Signal "NRDemo". Author login: v3sare, ID 655353, Growth: 2.94, Drawdown: 25.37, Price: 0.00 Signal "Amega 1000085182". Author login: AmegaTrust, ID 722001, Growth: 1.92, Drawdown: 5.13, Price: 0.00 Signal "Wns My strategy". Author login: WaldeliN, ID 727851, Growth: 103.69, Drawdown: 47.01, Price: 0.00 Signal "Bk EA". Author login: worknet, ID 749557, Growth: 506.88, Drawdown: 59.78, Price: 0.00 Signal "ROBIN 24". Author login: juanca034, ID 752873, Growth: 926.29, Drawdown: 30.25, Price: 0.00 Signal "Deny Forex". Author login: deny.mendonca, ID 759729, Growth: 149.06, Drawdown: 39.24, Price: 0.00 Signal "T Strategy". Author login: tonarino210, ID 760343, Growth: 28.87, Drawdown: 20.37, Price: 0.00 Signal "IC MT5 Demo". Author login: InvestForce, ID 760539, Growth: 67.01, Drawdown: 35.99, Price: 0.00 Signal "Gridingale". Author login: Myxx, ID 766073, Growth: 21.10, Drawdown: 15.55, Price: 0.00 Signal "Marcos Monteiro". Author login: slovenwill, ID 783988, Growth: 85.08, Drawdown: 17.59, Price: 0.00 Signal "Multi currency trend". Author login: mj2019, ID 785447, Growth: 54.42, Drawdown: 18.52, Price: 0.00 Signal "W7 901074879 Campeonato MT5". Author login: dramos236, ID 787269, Growth: 91.99, Drawdown: 21.20, Price: 0.00 Signal "Ramon Fx". Author login: viniciusramon18, ID 788732, Growth: 54.31, Drawdown: 9.46, Price: 0.00 Signal "Douglas demo w7". Author login: douglas.o.carne, ID 792392, Growth: 219.94, Drawdown: 43.61, Price: 0.00 "Suelen" signal. Author login: suelenacca, ID 794655, Growth: 67.40, Drawdown: 20.97, Price: 0.00 Signal "Conquers". Author login: borgesti, ID 795133, Growth: 37.23, Drawdown: 11.09, Price: 0.00 Signal "Conta demo torneio". Author login: Tiagoximenes, ID 798798, Growth: 42.36, Drawdown: 17.94, Price: 0.00 Signal "Conta demo de mil". Author login: Tiagoximenes, ID 798802, Growth: 132.02, Drawdown: 27.87, Price: 0.00 Signal "The art of Forex". Author login: Myxx, ID 801685, Growth: 170.29, Drawdown: 40.95, Price: 0.00 Signal "BB29 ICM". Author login: desmondpylow, ID 806971, Growth: 2.28, Drawdown: 41.60, Price: 0.00 Signal "Prometheus". Author login: g0079, ID 808538, Growth: 91.44, Drawdown: 22.98, Price: 0.00 Signal "Prueba robot 2 0 automatico". Author login: richwolfcompany, ID 809986, Growth: 76.76, Drawdown: 44.45, Price: 0.00 Signal "Deep Takeover Hedge StressTest 5M Candle". Author login: johnnypasado, ID 811819, Growth: 10.08, Drawdown: 13.58, Price: 0.00 Signal "Campeonato". Author login: AndreAutotecnic, ID 812233, Growth: 87.47, Drawdown: 13.79, Price: 0.00 Signal "OPM PRO". Author login: herinata, ID 812856, Growth: 38.55, Drawdown: 32.35, Price: 0.00 Signal "Slowly but surely 2". Author login: gyurmanz, ID 815467, Growth: 53.73, Drawdown: 13.08, Price: 0.00 Signal "Beef Waves". Author login: vladimir0005, ID 819055, Growth: 50.46, Drawdown: 32.69, Price: 0.00 Signal "Adriano Garcia". Author login: agarcia_ag, ID 823082, Growth: 111.62, Drawdown: 36.00, Price: 0.00 Signal "Max ScalperSpeed MT5". Author login: paran1615, ID 824333, Growth: 74.51, Drawdown: 40.62, Price: 0.00 Signal "SyH". Author login: gtrader2017, ID 826520, Growth: 42.78, Drawdown: 36.81, Price: 0.00 Signal "ECmp5s free". Author login: VallaLorenzo, ID 830456, Growth: 146.90, Drawdown: 27.64, Price: 0.00 Signal "MaxScalperSpeed MT5". Author login: paran1615, ID 835890, Growth: 64.33, Drawdown: 35.14, Price: 0.00 Signal "YEARNSIGNALS". Author login: yearnsignal2k19, ID 837512, Growth: 11.10, Drawdown: 2.54, Price: 0.00 Signal "AGS test 2". Author login: alireza.akbari, ID 838427, Growth: 7.93, Drawdown: 10.89, Price: 0.00 Signal "Waldeli003". Author login: WaldeliN, ID 838605, Growth: 32.98, Drawdown: 5.54, Price: 0.00 Signal "Michele". Author login: michele-m-r, ID 843351, Growth: 49.27, Drawdown: 13.90, Price: 0.00 Signal "SNAILER". Author login: 8F117EE2, ID 843458, Growth: 83.65, Drawdown: 11.86, Price: 0.00 Signal "Juniornicks". Author login: juniornicks, ID 845611, Growth: 100.25, Drawdown: 43.93, Price: 0.00 Signal "Black Hunter". Author login: christianlara, ID 845761, Growth: 51.94, Drawdown: 24.44, Price: 0.00 Signal "Master dizicheh1". Author login: awdtghuoilp, ID 857594, Growth: 5.04, Drawdown: 37.93, Price: 0.00 Signal "EUROS". Author login: Marketsystem, ID 858449, Growth: 5.31, Drawdown: 2.94, Price: 0.00 Signal "Scalpers risk10 pairs7 leverage100". Author login: leron34, ID 861750, Growth: 27.98, Drawdown: 20.53, Price: 0.00 Signal "EUREKA". Author login: Edmed933, ID 861927, Growth: 59.89, Drawdown: 7.32, Price: 0.00 Signal "Nadando Com Tubaroes". Author login: jun152, ID 862191, Growth: 21.18, Drawdown: 5.45, Price: 0.00 Signal "Demo using a grid system". Author login: RyanAfriansyah, ID 865900, Growth: 20.56, Drawdown: 8.38, Price: 0.00 Signal "Pilares". Author login: ValterCezar, ID 866672, Growth: 29.87, Drawdown: 18.96, Price: 0.00 Signal "EUROUSD". Author login: fxtrader036, ID 866719, Growth: 303.28, Drawdown: 40.70, Price: 0.00 Signal "LanzPower 25 S". Author login: sirlanz, ID 868027, Growth: 36.64, Drawdown: 45.53, Price: 0.00 Signal "Amadeu Volpato Desafio Internacional". Author login: Amadeu1971, ID 868928, Growth: 19.79, Drawdown: 12.57, Price: 0.00 Signal "Fernando correia W7". Author login: nandooo_123-hotmail, ID 870169, Growth: 41.70, Drawdown: 25.16, Price: 0.00 Signal "MAK GO". Author login: 9489631, ID 870413, Growth: 469.22, Drawdown: 36.31, Price: 0.00 Signal "Adriano Garcia W7bt 4 Pilares". Author login: agarcia_ag, ID 871868, Growth: 42.84, Drawdown: 13.19, Price: 0.00 Signal "Albertofxsemstop". Author login: albertosuga, ID 871969, Growth: 27.84, Drawdown: 19.36, Price: 0.00 Signal "BetoSTCDemo". Author login: betoabcsp, ID 872141, Growth: 29.03, Drawdown: 18.07, Price: 0.00 Signal "DESAFIOSEMSTOPLOSSCDS". Author login: cdsantos42, ID 873575, Growth: 19.47, Drawdown: 13.24, Price: 0.00 Signal "MrGeek7421". Author login: KamranAhmadi, ID 873583, Growth: 86.74, Drawdown: 16.33, Price: 0.00 Signal "Douglastorneio2w7". Author login: douglas.o.carne, ID 876302, Growth: 18.13, Drawdown: 15.34, Price: 0.00 Signal "Douglasw7demo1". Author login: douglas.o.carne, ID 876303, Growth: 148.80, Drawdown: 26.47, Price: 0.00 Signal "Douglastorneio1w7". Author login: douglas.o.carne, ID 876932, Growth: 136.86, Drawdown: 41.86, Price: 0.00 Signal "Campeonato mundial sem stop". Author login: Lpontes835, ID 878082, Growth: 23.52, Drawdown: 14.93, Price: 0.00 Signal "ALPHA IA v3". Author login: avaalpha, ID 878517, Growth: 2.77, Drawdown: 0.77, Price: 0.00 Signal "Gold x10". Author login: DynamixFX, ID 878540, Growth: 6.47, Drawdown: 8.87, Price: 0.00 Signal "MultiBolbandsRealM5". Author login: 11BREATH11, ID 879072, Growth: 83.18, Drawdown: 20.09, Price: 0.00 Signal "Ticols Stable profit". Author login: ticols, ID 879609, Growth: -56.37, Drawdown: 68.68, Price: 0.00 Signal "EA SkyBot MultiPares CENT". Author login: 4PerformanceFx, ID 882222, Growth: 248.38, Drawdown: 41.29, Price: 0.00 Signal "Trader Unity M15 100 rec". Author login: crifalo, ID 882268, Growth: 24.36, Drawdown: 26.11, Price: 0.00 Signal "Mad Piper Bill Millin". Author login: DiXOVERS, ID 882495, Growth: 251.06, Drawdown: 38.78, Price: 0.00 Signal "ProfitGuy STAR M Demo". Author login: justbond, ID 882847, Growth: 27.45, Drawdown: 24.89, Price: 0.00 Signal "EA GrayRock". Author login: serggray, ID 883235, Growth: 49.42, Drawdown: 28.68, Price: 0.00 Signal "FX FLASH". Author login: tradedeal, ID 883322, Growth: 9.17, Drawdown: 2.88, Price: 0.00 Signal "Optimizer". Author login: alama1, ID 884765, Growth: 73.53, Drawdown: 28.58, Price: 0.00 Signal "NnaFX Demo 02". Author login: 12259468, ID 886070, Growth: 136.64, Drawdown: 30.54, Pric: 0.00 Signal "Phantom5000 DEMO". Author login: JosephSmith, ID 887046, Growth: 43.41, Drawdown: 17.73, Price: 0.00 Signal "Art of Forex MadCat The G". Author login: The_G, ID 888018, Growth: 215.67, Drawdown: 40.86, Price: 0.00 Signal "ICMarkets MT5 AK 05". Author login: A.Klimkovsky, ID 889370, Growth: 13.03, Drawdown: 8.55, Price: 0.00 Signal "ProfitGuy STAR G Demo". Author login: justbond, ID 890551, Growth: 58.84, Drawdown: 58.80, Price: 0.00 Signal "BetoSemStopDM". Author login: betoabcsp, ID 892251, Growth: 94.96, Drawdown: 6.30, Price: 0.00 Signal "Smart Grid 26980 Demo". Author login: tm3912, ID 892313, Growth: 86.30, Drawdown: 37.19, Price: 0.00 Signal "Rel Vigor PSar n Red Dragon n mad max". Author login: DynamixFX, ID 892523, Growth: 73.74, Drawdown: 38.55, Price: 0.00 Signal "SolangeL". Author login: Mulherdeletras1, ID 894019, Growth: 108.40, Drawdown: 20.84, Price: 0.00 Signal "Paulotbone 1". Author login: paulotbone, ID 894062, Growth: 35.14, Drawdown: 23.93, Price: 0.00 Signal "GOLD MASTER". Author login: THEICD, ID 894983, Growth: 218.90, Drawdown: 22.80, Price: 0.00 Signal "Fxfrance". Author login: fxfrance, ID 895838, Growth: 369.48, Drawdown: 41.48, Price: 0.00 Signal "Marcos Paulo Serigatti". Author login: mpm4rcos, ID 895960, Growth: 45.62, Drawdown: 18.21, Price: 0.00 Signal "Roma Forex Desafio 4 Pilares". Author login: Jhonesroma, ID 896016, Growth: 29.60, Drawdown: 43.45, Price: 0.00 Signal "BOSBM OTC Test 5W". Author login: houli, ID 896563, Growth: 144.65, Drawdown: 22.94, Price: 0.00 Signal "FSTickTrade". Author login: onlyforsignup, ID 897751, Growth: 24.68, Drawdown: 16.20, Price: 0.00 Signal "Sun AI". Author login: Myxx, ID 899179, Growth: 16.82, Drawdown: 21.07, Price: 0.00 Signal "Equinox Demo". Author login: Kratoner, ID 905773, Growth: 44.46, Drawdown: 20.55, Price: 0.00 Signal "STRAGA Tornado VM1". Author login: stragapede, ID 906398, Growth: 36.70, Drawdown: 26.00, Price: 0.00 Signal "DiegoT". Author login: DiegoTT, ID 910230, Growth: 28.20, Drawdown: 11.49, Price: 0.00 Signal "Breaking Bad". Author login: Myxx, ID 911569, Growth: 7.63, Drawdown: 8.42, Price: 0.00 Signal "TradesaovivoBr". Author login: dhyegorodrigo1988, ID 913924, Growth: 16.77, Drawdown: 5.60, Price: 0.00 Signal "VantageFX Sunphone Dragon". Author login: sunphone, ID 916421, Growth: 345.56, Drawdown: 36.04, Price: 0.00 Signal "BYQS121". Author login: kadirryildiz, ID 916600, Growth: 32.85, Drawdown: 4.18, Price: 0.00 Signal "FBSLevelUP". Author login: manoj, ID 919106, Growth: 15.29, Drawdown: 10.49, Price: 0.00 Signal "Omega". Author login: zyntherius74, ID 922043, Growth: 70.18, Drawdown: 25.42, Price: 0.00 Signal "Best Bingo". Author login: kalnov-an, ID 926010, Growth: 59.90, Drawdown: 20.63, Price: 0.00 Signal "LCF 1". Author login: yosuf, ID 931735, Growth: 22.42, Drawdown: 36.26, Price: 0.00 Signal "Bao365". Author login: bao365, ID 933208, Growth: 28.41, Drawdown: 11.49, Price: 0.00 The "EURUSD" DOM snapshot series: Requested number of days: 1, Actual history depth: 1 "EURUSD" DOM snapshot (2021.02.24 22:22:54.654): - Sell order: 1.21576 [250.00] - Sell order: 1.21567 [100.00] - Sell order: 1.21566 [50.00] - Sell order: 1.21565 [36.00] - Buy order: 1.21563 [36.00] - Buy order: 1.21561 [50.00] - Buy order: 1.21559 [100.00] - Buy order: 1.21555 [250.00]
次の段階
次の記事では、MQL5シグナルのコレクションを作成します。
ライブラリの現在のバージョンのすべてのファイルは、テストおよびダウンロードできるように、MQL5のテストEAファイルと一緒に以下に添付されています。
質問や提案はコメント欄にお願いします。
*連載のこれまでの記事:
DoEasyライブラリでの価格(第62部): ティックシリーズをリアルタイムで更新して板情報で作業するための準備
DoEasyライブラリでの価格(第63部): 板情報とその抽象リクエストクラス
DoEasyライブラリでの価格(第64部): 板情報、DOMスナップショットのクラスおよびスナップショットシリーズオブジェクト
MetaQuotes Ltdによってロシア語から翻訳されました。
元の記事: https://www.mql5.com/ru/articles/9095





- 無料取引アプリ
- 8千を超えるシグナルをコピー
- 金融ニュースで金融マーケットを探索