Trying to understand CArrayObj, can someone explain what "objvector<objvector<MySymbol>> myMatrix;" does?
that's a template, in other languages it is called Generics.
let you create a class based on different types. the type becomes the typename and let you instead of hardcoding the type use a generic name like T for that.
template<typename T> class A{ T Value; A(){} }; A<int> aInt; aInt.Value=1; A<bool> aBool; aBool.Value=true;
it can be applied to function or class though my example only shows a class one.
read more here:
Documentation on MQL5: Language Basics / Object-Oriented Programming / Function templates
- www.mql5.com
Function templates - Object-Oriented Programming - Language Basics - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I found some enticing code at https://www.forexfactory.com/thread/672478-the-most-useful-mql-data-structure-object-vectors. I'm new to C++ syntax and OO coding, my way in being MQL4 (I know, I know, I need to move to MQL5 but first, so does my broker lol.)
These lines are stumping me:
I have no clue what the < and > operators are doing there in "objvector<objvector<MySymbol>> myMatrix;" and "objvector<MySymbol> *myVector = new objvector<MySymbol>;".
I'm not asking for a detailed explanation here (unless it's easy/trivial) but for any pointers I can get to explanations (link/book title/article title/whatever).
Can anyone help?