Home>

I'm in trouble because I can't understand the array at all.

How can I arrange the current candlestick, the candlestick one day ago, and the candlestick two days ago?
I'm trying it like this myself, but I don't understand the array well and it doesn't work very well.

int i;
double H [i] = [iHigh (NULL, PERIOD_D1, i)];
double L [i] = [iLow (NULL, PERIOD_D1, i)];
double O [i] = [iOpen (NULL, PERIOD_D1, i)];
double C [i] = [iClose (NULL, PERIOD_D1, i)];

Is it like this?

When writing solid

``````  double H ;
double L ;
double O ;
double C ;
H  = iHigh (NULL, PERIOD_D1, 0);// Currently
H  = iHigh (NULL, PERIOD_D1, 1);// 1 day ago
H  = iHigh (NULL, PERIOD_D1, 2);// 2 days ago
L  = iLow (NULL, PERIOD_D1, 0);// Currently
L  = iLow (NULL, PERIOD_D1, 1);// 1 day ago
L  = iLow (NULL, PERIOD_D1, 2);// 2 days ago
...``````

When initializing with a loop

``````  double H ;
double L ;
double O ;
double C ;
for (int i = 0;i<3;i ++)
{
H [i] = iHigh (NULL, PERIOD_D1, i);
L [i] = iLow (NULL, PERIOD_D1, i);
O [i] = iOpen (NULL, PERIOD_D1, i);
C [i] = iClose (NULL, PERIOD_D1, i);
}``````