Discussion of article "Library for easy and quick development of MetaTrader programs (part XXI): Trading classes - Base cross-platform trading object" - page 2

Artyom Trishkin
Moderator
83157
Dima Diall :

Problem: the CEvent::GetPendReqID() method I need above is protected !! Any better ideas without me having to changw the DoEasy source code? In my humble opinion, these methods should be public ;-)

You need to watch the CEngine class - only it gives access to the library to user programs.

All other classes are for the needs of the library, and are not intended for users, with the exception of the library service functions that are available in the program after connecting the library to it.

Dima Diall
61
Dima Diall  
Artyom Trishkin:

You need to watch the CEngine class - only it gives access to the library to user programs.

All other classes are for the needs of the library, and are not intended for users, with the exception of the library service functions that are available in the program after connecting the library to it.

Can you please give me an example? I am looking at CEngine class and see that it is possible to extract a list of events, check their type etc... so I can access each event but don't find any obvious way to read specific event details packed in the magic number (groups & request ID) from the CEngine object  -- as I see it, I still need to read this information directly from the CEvent object instances as in my event handler example above in my robot's even-handler method, i.e. CEvent:GetPendReq()

class CEngine
  {
//...
//...
//--- Return (1) the list of order, deal and position events, (2) base trading event object by index and the (3) number of new trading events
   CArrayObj           *GetListAllOrdersEvents(void)                    { return this.m_events.GetList();                     }
   CEventBaseObj       *GetTradeEventByIndex(const int index)           { return this.m_events.GetTradeEventByIndex(index);   }
   int                  GetTradeEventsTotal(void)                 const { return this.m_events.GetTradeEventsTotal();         }
//--- Reset the last trading event
   void                 ResetLastTradeEvent(void)                       { this.m_events.ResetLastTradeEvent();                }
//--- Return the (1) last trading event, (2) the last event in the account properties and (3) the last event in symbol properties
   ENUM_TRADE_EVENT     LastTradeEvent(void)                      const { return this.m_last_trade_event;                     }
   int                  LastAccountEvent(void)                    const { return this.m_last_account_event;                   }
   int                  LastSymbolsEvent(void)                    const { return this.m_last_symbol_event;                    }
//--- Return the (1) hedge account, (2) working in the tester, (3) account event, (4) symbol event and (5) trading event flag
   bool                 IsHedge(void)                             const { return this.m_is_hedge;                             }
   bool                 IsTester(void)                            const { return this.m_is_tester;                            }
   bool                 IsAccountsEvent(void)                     const { return this.m_accounts.IsEvent();                   }
   bool                 IsSymbolsEvent(void)                      const { return this.m_symbols.IsEvent();                    }
   bool                 IsTradeEvent(void)                        const { return this.m_events.IsEvent();                     }
//...
//...
  };
Artyom Trishkin
Moderator
83157
Dima Diall :

Не могли бы вы привести мне пример? Я смотрю на класс CEngine и вижу, что можно извлечь список событий, проверить их тип и т. Д., Поэтому я могу получить доступ к каждому событию, но не нахожу очевидного способа прочитать конкретные детали события, упакованные в магическое число (группы и идентификатор запроса) из объекта CEngine   - как я вижу, мне все еще нужно читать эту информацию непосредственно из экземпляров объекта CEvent, как в моем примере обработчика событий выше в методе обработчика четных событий моего робота, то есть CEvent :: GetPendReqID ()

Wait a little, please. The next article in the ru-segment will be about advisors, and there I will try to explain.

Dima Diall
61
Dima Diall  
Artyom Trishkin:

Wait a little, please. The next article in the ru-segment will be about advisors, and there I will try to explain.

OK, cool - thank you...