MQL4 - How do I retrieve all values from only one dimension in a 3D Array
MQL4 - How do I retrieve all values from only one dimension in a 3D Array
Loading saved threads...
Jesse Arnold · External communityPost link
External question — Stack Overflow Stack Exchange
Author: Jesse Arnold
Original post: https://stackoverflow.com/questions/72706666
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
As the title suggests, how do I retrieve all values from a single dimension in a multi-dimensional array?
int size = ArraySize(AllLetterPrices);
for(int i=size-1;i>=0;i--)
{
Print(AllLetterPrices[i,Arr_ObjectTRUEPRICE,0]);
}
This returns Array Out Of Range.
The index dimension of the Array is dynamic, whereas the second two dimensions are static as follows :
AllLetterPrices[index,0,0];
AllLetterPrices[index,1,0];
Quote
Report
PaulB · External communityPost link
External answer — Stack Overflow Stack Exchange
Author: PaulB
Original post: https://stackoverflow.com/a/72712742
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
Use the following and remember that
ArraySize()
returns the total number of ALL elements of the array so you cannot use it as you have to count the size of only the first element. Use
ArrayRange()
instead.
int size = ArrayRange(AllLetterPrices,0);
for(int i=size-1; i>=0; i--)
{
Print(AllLetterPrices[i][Arr_ObjectTRUEPRICE][0]);
}
Quote
Report
Post Reply
Checking account access…