Show all relevant code.
The only other piece of code I'm using is this:
CVector<datetime> m_times;
And does seem to be the initialisation that is causing the problem. How should I be initialising this code?
Thanks.
As far as I could gather from the source code you need to use a class derived from CObject. So your best choice would be to define a datetime wrapper.
See how CString does it in String.mqh, you'd go something like this:
class CDatetime : public CObject { protected: datetime m_datetime; public: CDatetime(datetime dt=0); ~CDatetime(void); ... } CVector<CDatetime> m_times;
Another approach could be to use ArrayInt.mqh but you'd have to cast its elements into datetime here and there. This is no issue as datetime and int have the same size.
#include <Arrays\ArrayInt.mqh>
CArrayInt v;
As far as I could gather from the source code you need to use a class derived from CObject. So your best choice would be to define a datetime wrapper.
See how CString does it in String.mqh, you'd go something like this:
Another approach could be to use ArrayInt.mqh but you'd have to cast its elements into datetime here and there. This is no issue as datetime and int have the same size.
Thanks
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I'm using this code:
from the end of this article: https://www.mql5.com/en/forum/34637
But when I compile it I'm getting the error:
The original code compiles ok and the only thing I've changed is the objvector text to CVector and I don't understand why? I've even tried inserting the code in a seperate file and including it but will no avail. Could this be a bug?
Any help appreciated.