today I want to write a few words about getting indicators values for testing strategy.
Recently I had need to get ema value. But for my surprise following code didn't give me values, which I've seen on the screen:
double ema = indicators.ema(instrument, period, side, AppliedPrice.CLOSE, emaTimePeriod, 1);
And in order for getting proper indicator value I've found another fragment of code which gave me proper result:
double ema89 = indicators.ma(inst, Period.TEN_MINS, OfferSide.BID, IIndicators.AppliedPrice.CLOSE, 89, maType, indFilter, 1, prevBar.getTime(), 0);
with following variables declared:
private static final IIndicators.MaType maType = IIndicators.MaType.EMA;
private static final Filter indFilter = Filter.ALL_FLATS;