The exception is: Object reference not set to an instance of an object.
I have no idea about the reason, could you please kindly give me some help?
The following is an example of error method, Exception occurs at the 2nd iteration of a following loop:
public void UpdateBuffers_RSIReversal()
{
try
{
bool tempIfRSICrossAbove = false;
bool tempIfRSICrossBelow = false;
int tempRSIstyle = myFullRSIstyles[ToSymbolsIndex(BarsInProgress)];
SWWriteLine("CP2:myRSILevels="+ myRSILevels[ToSymbolsIndex(BarsInProgress)].Length);
for (int j = 0; j <= myRSILevels[ToSymbolsIndex(BarsInProgress)].GetUpperBound(0); j++)
{
//!!!!!!!!Exception occurs at the 2nd iteration of this loop.
if (tempRSIstyle == (int)myEnumRSIstyles.RSIDefault)//i.e. myEnumRSIstyles == 0
{
tempIfRSICrossAbove = CrossAbove(RSI(BarsArray[BarsInProgress], myRSIPeriods[ToSymbolsIndex(BarsInProgress)], myRSISmoothPeriods[ToSymbolsIndex(BarsInProgress)]), myRSILevels[ToSymbolsIndex(BarsInProgress)][j], 1);
tempIfRSICrossBelow = CrossBelow(RSI(BarsArray[BarsInProgress], myRSIPeriods[ToSymbolsIndex(BarsInProgress)], myRSISmoothPeriods[ToSymbolsIndex(BarsInProgress)]), myRSILevels[ToSymbolsIndex(BarsInProgress)][j], 1);
}
if (tempRSIstyle == (int)myEnumRSIstyles.RSIAvg)//i.e. myEnumRSIstyles == 1
{
tempIfRSICrossAbove = CrossAbove(RSI(BarsArray[BarsInProgress], myRSIPeriods[ToSymbolsIndex(BarsInProgress)], myRSISmoothPeriods[ToSymbolsIndex(BarsInProgress)]).Avg, myRSILevels[ToSymbolsIndex(BarsInProgress)][j], 1);
tempIfRSICrossBelow = CrossBelow(RSI(BarsArray[BarsInProgress], myRSIPeriods[ToSymbolsIndex(BarsInProgress)], myRSISmoothPeriods[ToSymbolsIndex(BarsInProgress)]).Avg, myRSILevels[ToSymbolsIndex(BarsInProgress)][j], 1);
}
if (tempIfRSICrossAbove)
{
mySeriesRSICrossAboveOrBelow[BarsInProgress][j][0] = 1;
return;
}
if (tempIfRSICrossBelow)
{
mySeriesRSICrossAboveOrBelow[BarsInProgress][j][0] = -1;
return;
}
mySeriesRSICrossAboveOrBelow[BarsInProgress][j][0] = 0;
}
SWWriteLine("CP3");
}
catch (Exception e)
{ ReportExceptionInfo(e); }
}
Comment