Dukascopy Support Board
http://www.dukascopy.com/swiss/english/forex/jforex/forum/

out of bounds error daily bar data
http://www.dukascopy.com/swiss/english/forex/jforex/forum/viewtopic.php?f=65&t=57193
Page 1 of 1

Author:  EBMMLuke [ Wed 06 Nov, 2019, 09:12 ]
Post subject:  out of bounds error daily bar data

Hi folks!

I encountered the following strange behaviour:

I'd like to get daily bars to do some further calculation, independent from the actual time period shown in the chart. Therefore:
new InputParameterInfo("Bars", InputParameterInfo.Type.BAR){{
                    setPeriod(Period.Daily);}}


Doing some calculations:
for (int i = startIndex, j = 0; i <= endIndex; i++, j++) {
            outputs[0][j] = inputs[0][i].getHigh() - inputs[0][i].getLow();
        }


If the chart time period is set to "daily", it works like a charm. But as soon as I chose a different period, let's say "1h", a out of bounds exceptions for this particular code line is thrown:
outputs[0][j] = inputs[0][i].getHigh() - inputs[0][i].getLow();


I couldn't find a solution so far and there is no information about how "inputs" and "outputs" arrays are processed in JForex.
Any ideas?

Cheers, Luke

Author:  API Support [ Fri 20 Dec, 2019, 16:13 ]
Post subject:  Re: out of bounds error daily bar data

Hello.

Using different period for some of indicator inputs is rather difficult task.
It will be better to set calculation from custom data in indicator advanced settings

Image

Kind regards, Support Team.

Attachments:
screenshot.png [24.32 KiB]
Downloaded 220 times

  Page 1 of 1