nested loops not working as expected

 

I have programmed a pair of nested loops to run through some pairs and some time periods. When I print out the results of loops, I see the pairs and periods are displayed correctly, but when I use 'close' data from the loops, I get invalid data. It seems to repeat the close info from the first pair. here is some pseudo code.

string pr [3] = {"EURUSD","GBPUSD","USDJPY};
string pd [2] = {"PERIOD_H4","PERIOD_D1"};

for (i=0;i<PAIRS;i++)
{
for (j=0;j<PERIODS;j++)
{

print (iClose(pr[i],pd[j],0);

}

}

Has anyone seen problems like this?

Thanks in advance.

Reason: