Dear dukascopy support
I've got some problems with my simple code. I try to get the newest value of fractal indicator of a completely bar. That means from bar #1 the first fix value of fractal indicator. At the picture it would be the value of the bar #4 (5th bar). But I get the value of bar #20 (21rst bar). Have a look at my pic.
here my code and some explications:
data for pic: 5min chart, EURJPY, ASK side, my time is GMT + 1
barCount = barsOnSides for fractal indicator, I tried with 2.
shift = it has to be >= barCount (I think it's because of the lookback function?)
private double getFractal(int shift, OfferSide offerSide, int lowOrHigh) throws JFException {
long time = history.getBar(instrument, selectedPeriod, offerSide, shift).getTime();
double fractal = 0;
if (lowOrHigh == 0) {
double[][] frac = indicators.fractal(this.instrument, this.selectedPeriod, offerSide, this.barCount, Filter.ALL_FLATS, 10 * this.barCount, time, 0);
Printer.println("frac.length= " + frac.length + "\nfrac[" + lowOrHigh + "].length= " + frac[lowOrHigh].length);
int i = 0;
while (Double.isNaN(frac[lowOrHigh][i]) && i < frac[lowOrHigh].length) {
Printer.println("in while(high), i= " + i);
i++;
}
fractal = frac[lowOrHigh][i];
}
if (lowOrHigh == 1) {
double[][] frac = indicators.fractal(this.instrument, this.selectedPeriod, offerSide, this.barCount, Filter.ALL_FLATS, 10 * this.barCount, time, 0);
Printer.println("frac.length= " + frac.length + "\nfrac[" + lowOrHigh + "].length= " + frac[lowOrHigh].length);
int i = 0;
while (Double.isNaN(frac[lowOrHigh][i]) && i < frac[lowOrHigh].length) {
Printer.println("in while(low), i= " + i);
i++;
}
fractal = frac[lowOrHigh][i];
}
Printer.println("fractal= " + fractal);
return fractal;
}
thank you for your help.
best regards,
bigtrader