ArrayIndexOutOfBoundsException Error happened often

I used one of my strategy for living account. I used "remote run" mode.
The strategy come from visual jforex. I tested it for last year history tick data.
Everything is OK so I remote run it in my living account.
At the beginning the strategy runs well. But after a few days, it stopped.
I just read the strategy log. it says "java.lang.ArrayIndexOutOfBoundsException: 0 @ com.dukascopy.visualforex.tradingwithea.Add130subtract90.CCI_block_126("

And I found the line:438. It is just a normal code as the following

if ((new Double(((double [])indicatorResult[0])[0])) == null) {
this._cci126 = Double.NaN;
} else {
this._cci126 = (((double [])indicatorResult[0])[0]);

I thought CCI is just a normal indicator. And I tried another indicators like RSI, ADX.

But still no good news. The strategy always run a few days then be stopped due to ArrayIndexOutOfBoundsException error.

Does anyone meet the same problem? Add your comment please. Thank you!

Translate to English Show original

orto leave comments

Answers: 1

Best Answer

This may happen if you run the above code when markets are closed. Solution is to add code that filters out trading on weekends.

Translate to English Show original
1 Mar. 2016 by

orto leave comments
Please log in or register to post answer.