I have several for loops that look at the last 10 bars for a high/low pattern. One loop records a high values if high pattern found, another loop records the low value if pattern found.

This data is then put into a WMA function for the last x values.

However, I am getting Error 041:Inconsistent Series! error. I believe the issue is that the arrays are not populated with the same length nor at the same time.

I am not sure how to fix this error - any help would be appreciated.

Code snippet (for High):

if (Close[1] > Open[1] and Close[0] < Open[0]) {
double u11 = High[1];

for (qq=1;qq<=len; qq++)
if (qq <= ttfinal)
qqtot+= u11;
else
qqtot += (High[qq - (ttfinal -1)]);


vars u1 = series((qqtot/len));
qqtot = 0;
hcount +=1;
}
vars upp = series(WMA(u1,len));