On a side note, is MarketInfo(_Symbol,MODE_ASK) the same as Ask in terms of lag/memory allocation/speed? I've heard MarketInfo(_Symbol,MODE_ASK) is a lot better because it auto updates more than just Ask. Is there any advantage to any of them?
1, The system reading out the characters of MarketInfo(_Symbol,MODE_ASK) make it slower than Ask or not? Any real RAM/latency advantage of either?
2. They both return the exact same values all the time. Is there absolutely any difference? Computer processing time affected at all?
ArrayBsearch
Searches for a specified value in a multidimensional numeric array sorted in the ascending order. The search is performed in the first dimension taking into account the AS_SERIES flag.
I need to be able to individually search every each individual one of the 5 dimensions in my 5 dimension array, not just the first. Was looking for some sort of "array dimension" parameter in ArrayBsearch(), couldn't find it. I feel creating a huge one with just from here to here is something and from there to there to be not exactly right for my task.
Anybody know how to do this? This even worth it? Sounds like its maybe just more lag. Going for best RAM usage and most latency free. https://www.mql5.com/en/forum/125291 suggests just copying the second dimension into a new one, searching , and such, which just sounds like not really the most latency efficient way. Ive got the following code but can't have it search in a specific dimension only. Any insight? Thanks a million in advanced.
1. Creating 5 single dimensional arrays the best way or
2, Use just one huge one or
3. Search multiple dimensions?
4. Copy paste second array into a new one and search new one? (sounds slow for RAM)
What's the most lag free way?
An array can have a maximum of 4 dimensions.
//+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { //--- int array1[2][3][5][8]; int i=1; for(int j=0;j<2;j++) for(int k=0;k<3;k++) for(int l=0;l<5;l++) for(int m=0;m<8;m++) array1[j][k][l][m]=i<<=1; int value1=4194304; if(ArrayFind(array1,value1)) Print("Value found!"); } //+------------------------------------------------------------------+ template<typename T1,typename T2> bool ArrayFind(const T1 &array[][][][],const T2 value) { int size[4]={0}; for(int i=0;i<4;i++) size[i]=ArrayRange(array,i); for(int i=0;i<size[0];i++) for(int j=0;j<size[1];j++) for(int k=0;k<size[2];k++) for(int l=0;l<size[3];l++) if(array[i][j][k][l]==(T1)value) return(true); return(false); }
Thanks!!
Saved me a lifetime of puzzle solving and then some; I would've never come up with that.
array1[j][k][l][m]=i<<=1;
Ive highlighted for reference:
int array1[2][3][5][8]; int i=1; for(int j=0;j<2;j++) for(int k=0;k<3;k++) for(int l=0;l<5;l++) for(int m=0;m<8;m++) array1[j][k][l][m]=i<<=1; int value1=4194304; if(ArrayFind(array1,value1)) Print("Value found!"); } //+------------------------------------------------------------------+ template<typename T1,typename T2> bool ArrayFind(const T1 &array[][][][],const T2 value) { int size[4]={0}; for(int i=0;i<4;i++) size[i]=ArrayRange(array,i); for(int i=0;i<size[0];i++) for(int j=0;j<size[1];j++) for(int k=0;k<size[2];k++) for(int l=0;l<size[3];l++) if(array[i][j][k][l]==(T1)value) return(true); return(false); }
1. How do I specify in which dimension to add value1?
2. How do I retrieve the actual values instead of a yes or no?
Thanks in advanced, its an impossible puzzle.
here go another 40 hours.
- Your original question was "I need to be able to individually search every each individual one of the 5 dimensions." You must already the value to be able to search.
- That many dimensions is probably faulty thinking.
What are the types of values you are storing?A car has 4 wheels and 1 engine. The engine has air filter and n cylinders. You wouldn't use a multi-dimension array for that. You would use multiple single-dimension arrays of each type. struct Wheel{ bool isFlat; ... } struct Cylinder{ bool compression; ... }; struct AirFilter{ ... }; struct Engine{ AirFilter filter; Cylinder cylinder[]; }; struct Car{ enum wheelOrder{WO_FL, WO_FR, WO_RL, WO,RR, WO_COUNT}; Wheel wheel[WO_COUNT]; Engine engine; } Car car; PrintFormat("Car's 2nd cylinder's compression is %i", car.engine.cylinder[1].compression); PrintFormat("Car's Left Rear wheel is flat: %i", car.wheel[WO_LR].isFlat);
- Your original question was "I need to be able to individually search every each individual one of the 5 dimensions." You must already the value to be able to search.
- That many dimensions is probably faulty thinking.
What are the types of values you are storing?A car has 4 wheels and 1 engine. The engine has air filter and n cylinders. You wouldn't use a multi-dimension array for that. You would use multiple single-dimension arrays of each type.
While I'm currently into storing previous indicator values, previous tick data , bids asks and order details like order opens, Id like to be able to master arrays for use with any type of data .
I'm almost there.
Is there any way to specify in what specific dimension to add value1 ? What dimension is it being added to in the example above? Can't figure it out.
Alert(array1[i][1]);
as per https://stackoverflow.com/questions/39672871/how-to-code-a-multidimensional-dynamic-array
yields invalid array access. I need to be able to retrieve the specific values in the specific dimensions . Any ideas?
- stackoverflow.com
nadiawicket: While I'm currently into storing previous indicator values, previous tick data , bids asks and order details like order opens, Id like to be able to master arrays for use with any type of data .
| You just described a one-dimension array of a struct (indicator, tick, market.) |
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
ArrayBsearch
Searches for a specified value in a multidimensional numeric array sorted in the ascending order. The search is performed in the first dimension taking into account the AS_SERIES flag.
I need to be able to individually search every each individual one of the 5 dimensions in my 5 dimension array, not just the first. Was looking for some sort of "array dimension" parameter in ArrayBsearch(), couldn't find it. I feel creating a huge one with just from here to here is something and from there to there to be not exactly right for my task.
Anybody know how to do this? This even worth it? Sounds like its maybe just more lag. Going for best RAM usage and most latency free. https://www.mql5.com/en/forum/125291 suggests just copying the second dimension into a new one, searching , and such, which just sounds like not really the most latency efficient way. Ive got the following code but can't have it search in a specific dimension only. Any insight? Thanks a million in advanced.
1. Creating 5 single dimensional arrays the best way or
2, Use just one huge one or
3. Search multiple dimensions?
4. Copy paste second array into a new one and search new one? (sounds slow for RAM)
What's the most lag free way?