Hello,
I want to build a strategy with the BBANDS indicator on a 10 Pip RangeBarChart, but I don´t know, how to get the values of the indicator.
With the RSI indicator I did it this way and it worked fine:
Object[] rsiObjectsFeed = indicators.calculateIndicator(feedDescriptor, new OfferSide[]{myOfferSide}, "RSI",
new AppliedPrice[]{AppliedPrice.CLOSE}, new Object[]{rsiTimePeriod}, candlesBefore, feedData.getTime(), candlesAfter);
double[] rsi = (double[]) rsiObjectsFeed[0];
console.getOut().println("rsi value: " + rsi[0]);
I tried to do it the similar way with the BBANDS indicator.
Object[] bbandsUniversal = indicators.calculateIndicator(
feedDescriptor, new OfferSide[] {myOfferSide}, "BBANDS",
new IIndicators.AppliedPrice[] {IIndicators.AppliedPrice.CLOSE}, new Object[]{timePeriod, nbDevUp, nbDevDn, MaType.SMA.ordinal()},0);
double[][] bbands = {(double[]) bbandsUniversal[0], (double[]) bbandsUniversal[1], (double[]) bbandsUniversal[2]};
console.getOut().println("upperbbands value: " + bbands[0]);
console.getOut().println("midllebbands value: " + bbands[1]);
console.getOut().println("lowerbbands value: " + bbands[2]);
Compilation is successful, but it doesn´t work. There are no values shown in the message tab.
How can I convert the "Object[] bbandsUniversal" into a double type, so I get the values of the different Bands?