CopyBuffer for array of struct

 

Hello!

I have a question. I have this array of a struct type, I would like to fill the data from an indicator buffers

I tried like this :

   for(int i = 0; i < array_size; i++)
     {
      CopyBuffer(handleHH,3,0,array_size,dir_primery[i].close);
      CopyBuffer(handleHH,2,0,array_size,dir_primery[i].open);
      CopyBuffer(handleHH,0,0,array_size,dir_primery[i].high);
      CopyBuffer(handleHH,1,0,array_size,dir_primery[i].low);


// This is How I did it in mql4
//      dir_primery[i].close = iCustom(_Symbol,_timeframe,"indicator",3,i);
//      dir_primery[i].open = iCustom(_Symbol,_timeframe,"indicator" ,2,i);
//      dir_primery[i].high = iCustom(_Symbol,_timeframe,"indicator" ,0,i);
//      dir_primery[i].low = iCustom(_Symbol,_timeframe,"indicator",1,i);
     }
  }

Like this I have an error that array should be a double type, not a struct type.

One way would be to declare 4 arrays for each buffer and then copy the values to my array of struct. Is it any other better/easier way ?

Thank you!