Hi I'm working on a mql5 program and need arrays like std::vector of c++
for example in my c++ code i have something like this:
how can i implement this in mql5 ?
thanks for reply it helped but not completly.
the problem remains is that in vector as i represented in my example every dimension can have its own data type even class objects but here for a 2d array all dim's are same data type.?
any idea?
thanks for reply it helped but not completly.
the problem remains is that in vector as i represented in my example every dimension can have its own data type even class objects but here for a 2d array all dim's are same data type.?
any idea?
Your question is unclear. You can use a dynamic array in mql5, but only the first dimension can be dynamic.
How is it related to "data type" ?
Your question is unclear. You can use a dynamic array in mql5, but only the first dimension can be dynamic.
How is it related to "data type" ?
If you look at my code example of c++ and explain me how to do something like this in mql5 its my answer.(many thanks)
class Neuron { public: double n1; }; struct Layer{ Neuron neurons[]; }; class net{ private: Layer m_layers[]; //m_layers[layer_num][neuronum] public: net() { ArrayResize(m_layers,5); ArrayResize(m_layers[0].neurons,5); } double Get(int l, int n) { return(m_layers[l].neurons[n].n1); } void Set(int l, int n, double val) { m_layers[l].neurons[n].n1=val; } }; net * mynet; //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { mynet = new net(); mynet.Set(0,3,3.14); Print(mynet.Get(0,3)); }Something similar to this... I think . Regards Uwe
Something similar to this... I think . Regards Uwe
thanks thats what exactly I looking for
and one more question : what performance comparition is in using c++ dll's instead of using fully mql5 EA's?
Regarding perfomance that is difficult to judge.
You could use GetTickCount to measure the running time of a complex part of code.
As with most systems the input/output of data is limiting factor for the design.
Interesting read for multi tasking:
https://www.mql5.com/en/articles/197
Regards Uwe

- 2011.03.02
- Andrew
- www.mql5.com
I landed on this thread late in the game, so I am sure this has been resolved.
The OP did say "like std::vector of c++," so the answers were correct.
But for posterity, this article describes when a linked list (e.g. CList) might be a better choice than a dynamic array (CDynamicArray).
https://stackoverflow.com/questions/393556/when-to-use-a-linked-list-over-an-array-array-list
I landed on this thread late in the game, so I am sure this has been resolved.
The OP did say "like std::vector of c++," so the answers were correct.
But for posterity, this article describes when a linked list (e.g. CList) might be a better choice than a dynamic array (CDynamicArray).
https://stackoverflow.com/questions/393556/when-to-use-a-linked-list-over-an-array-array-list
This is a good article and is why I have found CArrayObj to be much more efficient than CList in most cases as . This is how I use it.
objvector<MyClass*> my_class_vector;

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi I'm working on a mql5 program and need arrays like std::vector of c++
for example in my c++ code i have something like this:
how can i implement this in mql5 ?