rob:
the code above is an example of the variables I need to link in someway to avoid the time wasteful case statement below
Like
I need a GetIndexBuffer()want to optimize this code that passes in a buffer number num
Use a class to wrap the buffer arrays, each object holding one array.
Create an array of objects containing the buffer arrays.
Use the buffer_num to access the object array.
rob:
You can try the array-of-buffers solution (see IndBufArray.mqh) from the algotrading book.
the code above is an example of the variables I need to link in someway to avoid the time wasteful case statement below
Like
I need a GetIndexBuffer()
want to optimize this code that passes in a buffer number num
MQL5 Book: Multicurrency and multitimeframe indicators / Creating application programs
- www.mql5.com
Until now, we have considered indicators that work with quotes or ticks of the current chart symbol. However, sometimes it is necessary to analyze...
Dominik Egert #:
Use a class to wrap the buffer arrays, each object holding one array.
Create an array of objects containing the buffer arrays.
Use the buffer_num to access the object array.
Why I didn't think of this is beyond me!
It worked thanks
class CBufferObj : public CObject { public: int SymID; string sSymID; double buff[]; CBufferObj(int i, string sym) { SymID = i; sSymID = sym; } ~CBufferObj() {} }; class CCurrencyList: public CArrayObj { public: void CCurrencyList(); void ~CCurrencyList(); }; //+------------------------------------------------------------------+ //| Constructor | //+------------------------------------------------------------------+ void CCurrencyList::CCurrencyList() { for (int i = 0; i < ArraySize(sCurr); i++) { CBufferObj* b = new CBufferObj(i, sCurr[i]); this.Add(b); } }
Stanislav Korotky #:
You can try the array-of-buffers solution (see IndBufArray.mqh) from the algotrading book
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

the code above is an example of the variables I need to link in someway to avoid the time wasteful case statement below
Like
I need a GetIndexBuffer()want to optimize this code that passes in a buffer number num