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.

inputs indicator array doesn't agree with startIndex / endIndex
 Post subject: inputs indicator array doesn't agree with startIndex / endIndex Post rating: 0   New post Posted: Thu 27 Sep, 2012, 13:41 
User avatar

User rating: 70
Joined: Sat 22 Sep, 2012, 17:43
Posts: 118
Location: Brazil, Fortaleza, Ceará
I use the inputs array from startIndex to endIndex to determine outputs, the problem I observe here causes an ArrayIndexOutOfBoundsException,
under what circumstances does this / is this supposed to happen?

iconsole() output


call to onBar (EUR/USD / 10 Secs) ==============================================================>

(JUST IN): Sun 04 Mar 2012 22:14:40.000 GMT
<---- bidBar.getTime()
bid: 4 Mar 2012 22:14:40 GMT / Open 1.31921 / High 1.31921 / Low 1.31921 / Close 1.31921 / Volume: 0.0
ask: 4 Mar 2012 22:14:40 GMT / Open 1.31934 / High 1.31934 / Low 1.31934 / Close 1.31934 / Volume: 0.0

(CURRENT): Sun 04 Mar 2012 22:14:50.000 GMT
<---- getStartTimeOfCurrentBar(instrument, period)
bid: 4 Mar 2012 22:14:50 GMT / Open 1.31921 / High 1.31921 / Low 1.31921 / Close 1.31921 / Volume: 0.0
ask: 4 Mar 2012 22:14:50 GMT / Open 1.31934 / High 1.31934 / Low 1.31934 / Close 1.31934 / Volume: 0.0

call to calculate(int startIndex, int endIndex) 0 3999 ==================================================>

INPUT LENGTH DOES NOT AGREE WITH INDICES.

inputs array length: 3995
<---------------------- this is an array of IBars not doubles

startIndex IBAR - 1329182400000 [2012-02-14 01:20:00.000+0000] O: 1.31676 C: 1.31642 H: 1.3168 L: 1.31642 V: 332.09

inputs.length-1 IBAR - 1330899000000[2012-03-04 22:10:00.000+0000] O: 1.31922 C: 1.31921 H: 1.31922 L: 1.31921 V: 1.5

ERROR Indicators - 3999
<--------- attempt to output endIndex IBAR causes this
java.lang.ArrayIndexOutOfBoundsException: 3999

Error in indicator: java.lang.ArrayIndexOutOfBoundsException: 3999 @ calculate(myIndicator.java:44)
3999: java.lang.ArrayIndexOutOfBoundsException: 3999


all calls to calculate return as follows (lookback = 0, lookforward = 0):

result.setFirstValueIndex(startIndex);
result.setLastValueIndex(endIndex);
result.setNumberOfElements((endIndex - startIndex) + 1);


The context of this all is the Historical tester run during:

2012-09-27 13:52:15.199 INFO testgui - DATE FROM: 04/03/2012 22:10:00 GMT
2012-09-27 13:52:15.199 INFO testgui - DATE TO: 10/04/2012 22:00:00 GMT


 
 Post subject: Re: inputs indicator array doesn't agree with startIndex / endIndex Post rating: 0   New post Posted: Mon 01 Oct, 2012, 14:06 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Please provide an example indicator which replicates the issue. Also please provide more precise Historical Tester settings and also the strategy that you launch in the Historical Tester.


 

Jump to:  

cron
  © 1998-2025 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