Strange indicator values

Hi guys,

Ive experienced some strange behaviour. Sometime I got a strange value back from the used indicator within the EA Im writing. It`s not EMPTY_VALUE and not DBL_MAX.

BUY direction new ‘SL_FRACTALS’ tsl at -858993459

It’s probably uninitialized.

You need to make sure all buffer entries get a value, either valid price if there is a fractal on this bar or zero (or whatever your empty value is).

I`m using the build-in indicator, I thought it will be working as it should. How can I initialize the indicator buffers, this is being done in the indicator code, right?

return iFractals(symbol,timeframe,mode,shift);


(since Fractal values are not calculated but derived from price we can use == instead of the proper way to compare doubles, that is subtraction and <0.000001,)

Also you should write your thing in MQL5.

Currently I do the following to find the last fractals, I use this in a trailing stop loss.

double fractal;





while(fractal==EMPTY_VALUE || fractal==DBL_MAX || fractal==0);

–> Do you mean I can use the following?

–> while(iFractals(symbol,timeframe,mode,shift)==high/low[shift])

No… he’s talking about not using the == operator to compare doubles. Instead use

bool doubles_equal(double x, double y)
   return (fabs(x - y) < _Point);