In a custom indicator, I am using (i) InputParameterInfo.Type.DOUBLE to allow user to choose the input price; and (ii) InputParameterInfo.Type.PRICE to access the OCHLV data as declared.
inputParameterInfos = new InputParameterInfo[] {
new InputParameterInfo("Input data", InputParameterInfo.Type.DOUBLE),
new InputParameterInfo("OCHLV Price", InputParameterInfo.Type.PRICE)
};
The problem arise when I use indicators.calculateIndicator(...) in my strategy to call this custom indicator (after registering it in runtime). Specifically,
what do I put for AppliedPriice in such a situation?
For example, using this doesn't work because AppliedPrice is expecting a second element in array.
Object[] objs = this.indicators.calculateIndicator(instrument,
period,
new OfferSide[]{OfferSide.BID},
"ABC",
new AppliedPrice[] {AppliedPrice.CLOSE},
new Integer[] {20},
Filter.WEEKENDS,
1,
bidBar.getTime(),
0);
I also tried this,
new AppliedPrice[] {AppliedPrice.CLOSE, null}
because if the indicator uses only InputParameterInfo.Type.PRICE, then we would input a null as the parameter for applied price.
In both cases, I am getting an
ArrayIndexOutOfBoundsException because AppliedPrice[] has only length=1 whereas inputParameterInfos is expecting an array of length=2.