Here is the exact exception message:
"
Error on calling 'OnBarUpdate' method for indicator 'aaMyIndicator' on bar 4685: Index was out of range.
Must be non-negative and less than the size of the collection. Parameter name: index
"
My indictor has CalculateOnBarClose=false (tick-by-tick updating in OnBarUpdate()).
I've structured my OnBarUpdate() code with a try/catch which surrounds all the code in OnBarUpdate(). This is the only try/catch in OnBarUpdate().
protected override void OnBarUpdate() { try { //A bunch of code but no other try/catch statements. } catch(Exception e) { Print("My Exception Handler."); Print(e.Message); } }
So can I conclude the code that caused the above exception was not inside OnBarUpdate()? And if this is correct, then what could cause this exception? I do call Update() in another area of the code. I assume Update() eventually causes an OnBarUpdate() event.
If the call to Update() is possibly a contributor to the above exception, are there some conditions that should be checked for before calling Update()?
thanks,
shawnj
Comment