Array of Mqlrates

 
Hi.

I have a question on mql5.

I need to create an array of multiple Mqlrates

for example

array [0] [mqlrates_1];
array [1] [mqlrates_2];

It would be a multidimensional array.

I've tried a lot, but still can't.

Thank you very much.
 
yodescilla:
Hi.

I have a question on mql5.

I need to create an array of multiple Mqlrates

for example

array [0] [mqlrates_1];
array [1] [mqlrates_2];

It would be a multidimensional array.

I've tried a lot, but still can't.

Thank you very much.

You probably want to store multiple timeframes data

//without having opened the editor yet 

//A . one array
MqlRates mydata[][9][1000];
/*
What the above means if mydata[x][y][z];
x->(Resizable dimension) symbols
y->(static 9 dimension) timeframes (9 timeframes)
z->(static 1000 data slots representing bars)
*/

//B . Mix and Match
  struct data_timeframe
  {
  ENUM_TIMEFRAMES TF;//which tf is this
  MqlRates BarData[];//Bar data array for this timeframe here 
  };
  struct data_asset
  {
  data_timeframe Timeframe[];//Array with timeframes stored
  string symbol;
  double point_size;
  int LotDigits;
  int PriceDigits;
  double minLot;
  double maxLot;
  };
  
  data_asset MyAssets[];
  //So if everything were loaded up correctly (not like now)
  //the below would give you the First Assets ,first timeframe's,first bars close price.
  MyAssets[0].Timeframe[0].BarData[0].close;
 
I tested it here but couldn't make it work. I ended up doing several CopyRates (12 in total), and allocating the values in different arrays.

But I want to improve my skills in mql5, so I will study your code and make it work.

Thank you so much for your attention.
Lorentzos Roussos:

You probably want to store multiple timeframes data

Reason: