Hi
I have the following code which causes the above error message from time to time:-
Any suggestions on recoding to remove error message
Bob M
public int getPipsAverage(long time, int numPer) {
try {
IHistory history = context.getHistory();
//
long firstBarTime = history.getPreviousBarStart(mPeriod, time);
List<IBar> bars = history.getBars(instrument, mPeriod, OfferSide.BID, history.getTimeForNBarsBack(mPeriod, firstBarTime, numPer), firstBarTime);
//
int diff = 0;
int count = 0;
for (IBar bar: bars) {
double high = bar.getHigh();
double low = bar.getLow();
int range = (int)Math.round(numberOfPips(high, low));
if (range > 0) {
diff = diff + range;
count = count + 1;
}
}
return diff / count;
//
} catch (JFException e) {
logger.error(e.getMessage());
return -1;
}
} // end getPipsAverage