# What am I doing wrong on iFractals?

No PC at hand? Communicate with friends using your mobile phone!
216
2010.02.13 21:35

I'm playing with Fractals and have the following snippet:

int Handle2 = iFractals(NULL, PERIOD_M15);
double FractBuffer[];

CopyBuffer(Handle2, 0, 0, 30, FractBuffer);
ArraySetAsSeries(FractBuffer, true);

double A1;
int x;
for(x=1;x<=10;x++)
{
double A1 = FractBuffer[x];

}

I am getting rubbish in A1 for all values of x

-Jerry

4098
2010.02.14 02:53
netconuk posted  :

I'm playing with Fractals and have the following snippet:

int Handle2 = iFractals(NULL, PERIOD_M15);
double FractBuffer[];

CopyBuffer(Handle2, 0, 0, 30, FractBuffer);
ArraySetAsSeries(FractBuffer, true);

double A1;
int x;
for(x=1;x<=10;x++)
{
double A1 = FractBuffer[x];

}

I am getting rubbish in A1 for all values of x

-Jerry

you probably get an empty value (fractals appear only on certain array indexes), please modify your code to confirm

```for(x=1;x<=10;x++)
{
double A1 = FractBuffer[x];
if (A1!=EMPTY_VALUE) Print("A1 ["+IntegerToString(x)+"] = " + DoubleToString(A1));
else Print("A1 ["+IntegerToString(x)+"] = EMPTY_VALUE");
}
```

empty value is equal to DBL_MAX and is displayed as

A1 [10] = 179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

216
2010.02.14 11:00
investeo:

you probably get an empty value (fractals appear only on certain array indexes), please modify your code to confirm

empty value is equal to DBL_MAX and is displayed as

A1 [10] = 179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

Thanks, that did help a lot (MT4 used to return zero for an empty one). However I'm only retreiving the top fractals. The bottom ones come out as empty.

-Jerry

216
2010.02.14 11:06
netconuk:

Thanks, that did help a lot (MT4 used to return zero for an empty one). However I'm only retreiving the top fractals. The bottom ones come out as empty.

-Jerry

I've just answered my own question. To help others who stumble on this:

CopyBuffer(Handle2, 0, 0, 30, FractBuffer); returns the upper ones

CopyBuffer(Handle2, 1, 0, 30, FractBuffer); returns the lower ones.

-Jerry