Hello,
I'm trying to make Correlation indicator of two Intruments.
First one is static (for example EURUSD)
Second one is variable (for example GBPUSD).
When I put indicator everything is OK.
But when I change second Instrument, indicator stop working.
inputParameterInfos = new InputParameterInfo[]
{
new InputParameterInfo(myInstrument.toString(),
InputParameterInfo.Type.BAR) {{
setInstrument(myInstrument);
// setPeriod(myPeriod);
// setOfferSide(mySide);
}},
new InputParameterInfo(instrumentCorrelation.toString(),
InputParameterInfo.Type.BAR) {{
setInstrument(instrumentCorrelation);
// setPeriod(myPeriod);
// setOfferSide(mySide);
}},
};
optInputParameterInfos = new OptInputParameterInfo[]
{
new OptInputParameterInfo("Correlation Instrument", OptInputParameterInfo.Type.OTHER,
new IntegerListDescription(instrumentCorrelation.ordinal(), instrumentValues, instrumentNames))
};
public void setOptInputParameter(int index, Object value)
{
switch (index)
{
case 0:
OptInputDescription descr = optInputParameterInfos[index].getDescription();
int[] values = ((IntegerListDescription) descr).getValues();
int instr = -1;
for (int i = 0; i < values.length; i++)
{
if (values[i] == (Integer) value)
{
instr = values[i];
break;
}
}
if (instr < 0)
{
// value not found
instr = values[0];
}
if (instr >= 0)
{
inputParameterInfos[1].setInstrument(Instrument.values()[instr]);
}
else
{
inputParameterInfos[1].setInstrument(null);
}
writeMessage ("inputParameterInfos[1] " + inputParameterInfos[1].getInstrument().toString());
break;
default:
throw new ArrayIndexOutOfBoundsException(index);
}
}
Any ideas how to fix this?
