The following box is keeps coming up as I run my Strategy.
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Unable to get Data on Demand for Symbol: .SPX
The strategy (below) doesn't call the ".SPX
CODE:
Please log in to see this code.
But I am plotting the relative strength of the stock to the S&P on the chart with this code.
CODE:
Please log in to see this code.
Since the error pops up at differant intervals, I think it might be a conflict with the data avaiable for some tickers. What do you think? If it is a error with an individual ticker is there away to right the code to skip the ticker when there is an error?
Thanks again for the help
Tobey
Size:
Color:
Check out
Index was out of range in Wealth-Lab 5 Wiki > Errors | Strategy (scroll down the page). Looks like, item #2 applies to your case.
However,
"Unable to get Data on Demand for Symbol: .SPX" means a connection/network/server returned error. Disable on demand update as it only slows your backtests, update your data, and find if some symbol has stopped trading or has 0 bars.
Size:
Color:
Hi Eugene,
Thanks!
I checked item #2 and made those changes. Things improved.
I also cut back on the number of bars in the data range to just the number of bars needed calculate the longest indcator.
Today I ran it in the stratogy monitor on 30min bars. It runs all the away through and gives a report in less than a half hour.
But the next time it runs it gives an error:
Exception of type "System.OutOfMemoryException" was thrown.
Unable to ge data on demand for Symbol: .SPX
This error locks up the program.
It's running on a new machine with Windows 7, 4megs of ram and dual 3.2 processor.
I hope it's not the machine. But could it be a Windows 7 Issue?
Thanks again for the help. When it runs it's great!
Tobey
Size:
Color:
Size:
Color:
Hi Eugene,
Thanks! I added Bars.Cache.Clear(); to the end of my strategy and it's working fine today.
So from now on every strategy will end with Bars.Cache.Clear();
I see this formula
Required RAM = Number of stocks * number of bars * number of data series (typically 6: DateTime + OHLCV) * 8 bytes.
So It's Megs / 48 (number of data series (typically 6: DateTime + OHLCV) * 8 bytes)
to get the total number of data bars memory can hold.
4megs 4,000,000 / 48 = 83,333 bars of Data
So then the best way to use them is to figure out how many to load to calculate longest indicator and divide that into total number data bars available to get the maxium number of stocks to screen.
So a 50 Day moving average would be
83,333 / 50 = 1,666 stocks that could be screened.
If I've got it right it should be easy to figure out how to avoid an out of memory error.
Thanks!
Tobey
Size:
Color: