I try to develop a multi instrument strategy (an indicator, in fact) but I am having the following problem that I don't understand :
I modified SampleMultiInstrument strategy by doing the following :
if (BarsInProgress != 0) return; tmp = ADX(BarsArray[1], 14)[0]; // Checks if the 14 period ADX on both instruments are trending (above a value of 30) if (ADX(14)[0] > 30 && ADX(BarsArray[1], 14)[0] > 30)
This result in the "Error on calling 'OnBarUpdate' method fro strategy 'SampleMultiInstrument': ADX[barsAgo] out of valid range 0 through -1 was 0"
PS1: I did other modifications : the contract is now "ES 06-09" with PeriodType.Second=30, and I renamed the indicator as the original is read only.
PS2: If I comment the "tmp = ADX(BarsArray[1], 14)[0];" line, then I don't get the error
Thank you for your help.
Comment