How do you avoid (trap the error) "Index was out of range" for old symbols that aren't being updated anymore. I specified a date range in the control panel that was incompatible with data in NT.WL. Thanks...
CODE:
Please log in to see this code.
Size:
Color:
Not sure why you need to trap the error, but you can avoid it by just putting this at the top of the Execute method -
CODE:
Please log in to see this code.
Note though, that ATR is one of those "unstable indicators". See WealthScript Programming Guide: Indicators > Stability of Indicators
Size:
Color:
There's data for NT from '93-'02, but when I run the script with a date range after '02, I get the error. Checking Bars.Count < 20 isn't going to help. It's not a big deal, but when I run a backtest on 2400+ symbols, it spews out a bunch of these errors into the debug window.
Size:
Color:
Why doesn't it help? The problem is that you're trying to calculate an indicator on a series that doesn't have sufficient data. If you exit the script before the indicator is created, then you avoid the error.
Size:
Color: