# Thread: Noob MQL4 help needed to understand this array

1. Newbie
Join Date
Oct 2008
Posts
13

## Need help to understand this array MQL4

Hi, coders

Would anyone care to educate me on arrays slightly
Or perhaps I'm having more trouble understanding this loop as it pertains to this array.

int i=Bars;

#property copyright "Unfinished POS by Agent86"
double v1[];

double v2[];

double val1;

double val2;

int start()

{

while(i>=0)

{

val1=iFractals(NULL, 0, MODE_UPPER,i);

if (val1 > 0)

{

v1[i]=High[i];

}

else

{

v1[i]=v1[i+1];

}

val2=iFractals(NULL, 0, MODE_LOWER,i);

if (val2 > 0)

{

v2[i]=Low[i];

}

else v2[i]=v2[i+1];

i--;

}

return(0);

}

It's a basic fractal, and yet I can't seem to refer to any elements in the array.

I want to be able to increment i++ somehow and Print (v1[i]); or print the previous value prior to the 0 or EMPTY_VALUE.
If I'm even going in the right direction with this.

I'm having trouble.
Print (v1[i]): always == 0 and prints 0
I sort of understand because it's actually looping down to -1 which == 0

How and where might I put the Print statements so I can see whats going on ?
I've tried multitudes or methods and re-initialized i=0 to attempt and alternate loop so that I might refer to v1[i] elements but all attempts have failed.

Basically I want to view the previous fractals or mark them as A high, B low etc. for possible future use in an ABCD scheme type of EA
For now, mainly I want to Print v1[i] so that I can see what it's doing.
Perhaps I might design something to select a Previous Fractal such as A_high and/or B_low or some such scheme.

Am I on the wrong track with this ?