CHistoryOrderInfo: missing Select(void) and Select(ulong ticket) methods??? COrderInfo has them both...
Hmmm... In the meantime, to avoid messing with the Standard Library itself, I am thinking to derive the original CHistoryOrderInfo class into my own custom one, e.g. CHistoryOrderInfoExtra that provides this lacking functionality for selection by ticket -- seems like I can easily adapt the two COrderInfo::Select() for a quick fix-up job.
#include <Trade/HistoryOrderInfo.mqh> class CHistoryOrderInfoExtra : public CHistoryOrderInfo { protected: // NB: this piece of data is inherited from parent class // ulong m_ticket; // ticket of history order public: bool Select(void); bool Select(const ulong ticket); }; //+------------------------------------------------------------------+ //| Selecting an order to access | //+------------------------------------------------------------------+ bool CHistoryOrderInfoExtra::Select(void) { return (HistoryOrderSelect(m_ticket)); } //+------------------------------------------------------------------+ //| Selecting an order to access | //+------------------------------------------------------------------+ bool CHistoryOrderInfoExtra::Select(const ulong ticket) { if(HistoryOrderSelect(ticket)) { m_ticket = ticket; return (true); } m_ticket = ULONG_MAX; //--- return (false); }
Hmmm... In the meantime, to avoid messing with the Standard Library itself, I am thinking to derive the original CHistoryOrderInfo class into my own custom one, e.g. CHistoryOrderInfoExtra that provides this lacking functionality for selection by ticket -- seems like I can easily adapt the two COrderInfo::Select() for a quick fix-up job.
Welcome to the world of MetaQuotes, where you inherit the classes they built to add stuff they forgot and fix the problems (if possible) that they refuse to address.
Look at the example from here: https://www.mql5.com/en/docs/trading/historyselect
On the left side you see the all functions about orders, positions and deals. You have to understand the difference of them .

- www.mql5.com

- Free trading apps
- Free Forex VPS for 24 hours
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello all... I finally managed to get my head around the benefit of using these 4 classes of the Standard Library for working with active/historic orders, deals and positions -- CPositionInfo, CDealInfo, COrderInfo, CHistoryOrderInfo.
Not sure if this could be a bug in the header file HistoryOrderInfo.mqh, but class CHistoryOrderInfo lacks any methods for selecting orders from history by ticket number, as opposed to COrderInfo that includes them for active pending orders. This appears to render CHistoryOrderInfo fairly useless, and requires using the built-in MQL5 function HistoryOrderSelect() -- for example, this coding pattern is not possible: