Should I use a 2D Array for this?

 

Hi. I am trying to cycle through a period of chart timeframes, i.e. 15, 30, 60, 240, 1440, using the array period[] = { 15, 30, 60, .....}, but also want to make a calculation of:



for(int y=1;y<5,y++)

{

Difference = iHigh(Symbol(),period[x],y) - iOpen(Symbol(),period[x],y);

}

Where y is the bar shift. So basically im trying to find the value of 'Difference' for each bar shift for each timeframe. So i need the values of period[1] to cycle through the whole bar shift before moving onto the next period[2] and so on. But I need the values to be given in sets of timeframe. So I need a set of Difference for timeframe 15 which should include all bar shifts.



I was thinking that a 2D array would help here but i cant figure out how to implement it, because I am using 2 difference source types if you get my meaning. Surely its not possible? I was also thinking about using a calculation to get the 2D array to cycle through y for x=1. Somthing like [x,+y*5]?? This is of course wrong but maybe you no what im trying to do?