Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

out of bounds error daily bar data
 Post subject: out of bounds error daily bar data Post rating: 0   New post Posted: Wed 06 Nov, 2019, 09:12 

User rating: 0
Joined: Mon 04 Nov, 2019, 21:12
Posts: 10
Location: Switzerland,
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


 
 Post subject: Re: out of bounds error daily bar data Post rating: 0   New post Posted: Fri 20 Dec, 2019, 16:13 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
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 216 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 

Jump to:  

  © 1998-2024 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com