Dukascopy
 
 
Wiki JStore Search Login

NPException error
 Post subject: NPException error Post rating: 0   New post Posted: Wed 01 Oct, 2014, 20:14 
User avatar

User rating: 2
Joined: Fri 02 Mar, 2012, 22:08
Posts: 200
Location: New Zealand, Dunedin
Hi

I am getting the following error on three different strategies - all three did run cleaning in the past!

java.lang.Exception @ strategy-name.GetBars (...)

I have the following code..................

public List<IBar> GetBars()throws java.text.ParseException, JFException
{
long prevBarTime2 = myHistory.getPreviousBarStart(myPeriod,
myHistory.getLastTick(myInstrument).getTime());

List<IBar> bars = myHistory.getBars(myInstrument, myPeriod, OfferSide.BID,
com.dukascopy.api.Filter.WEEKENDS, 6, prevBarTime2, 0);

int last = bars.size() - 1;

return bars;
}

public double [][] IBarsToArray(List<IBar> inputBars)
{
double [][] ohlcvArray = new double[6][inputBars.size()];
for (int i = 0; i < inputBars.size(); i++){
ohlcvArray[0][i] = inputBars.get(i).getTime();
ohlcvArray[1][i] = inputBars.get(i).getOpen();
ohlcvArray[2][i] = inputBars.get(i).getHigh();
ohlcvArray[3][i] = inputBars.get(i).getLow();
ohlcvArray[4][i] = inputBars.get(i).getClose();
ohlcvArray[5][i] = inputBars.get(i).getVolume();

}
return ohlcvArray;

}

Any suggestions on how I track down this bug?

Bob M
Dunedin
New Zealand


 
 Post subject: Re: NPException error Post rating: 0   New post Posted: Fri 03 Oct, 2014, 13:28 
User avatar

User rating: 164
Joined: Mon 08 Oct, 2012, 10:35
Posts: 676
Location: NetherlandsNetherlands
Hi,

Normally a line number is also shown for an exception. Do you see the line number?


 
 Post subject: Re: NPException error Post rating: 0   New post Posted: Sat 04 Oct, 2014, 09:40 
User avatar

User rating: 2
Joined: Fri 02 Mar, 2012, 22:08
Posts: 200
Location: New Zealand, Dunedin
The line number refers to this line

long prevBarTime2 = myHistory.getPreviousBarStart(myPeriod,
myHistory.getLastTick(myInstrument).getTime());

Bob M


 
 Post subject: Re: NPException error Post rating: 0   New post Posted: Sun 05 Oct, 2014, 19:30 
User avatar

User rating: 164
Joined: Mon 08 Oct, 2012, 10:35
Posts: 676
Location: NetherlandsNetherlands
Without being too specific about your exact code, I can say that I've seen issues with some history.getXXXX functions when the Historical Tester was started on a weekend (when the market is closed). If you happen to run these strategies in the historical tester, maybe check what is the starting day of your tests. If it is a weekend, modify it for a weekday, and see if that solves the issue.

If this is irrelevant, I suggest to create a simplified strategy that replicates the issue. It will be much easier for Support as well, to pick the issue up with a strategy attached.


 

Jump to:  

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