I translated a code from wl4 to wl6 and I haven't errors when complile. However, when I run the strategy for all Symbols in Euro Stoxx (from MetaStock), I have a error for more than 200 stocks "Error processing symbol AALB.NA Index was out of range. Must be non-negative and less than the size of the collection.", but when I run the strategy for only one stock (for example AALB.NA that have error in the "backtest") it run ok.
Thanks and regards
Size:
Color:
When you see an error message, it's usually a good idea to browse our Knowledge Base (Wiki), Errors section:
Errors when working with Wealth-Lab.
From there you could find the following:
Errors | Strategy > (scroll down to) "Index was out of range"
To me it seems like #2 (live bug - workaround is available by following the link on the page.)
Size:
Color:
Can be the error (30248) Backtest broken with Index Out Of Range message with enabled Benchmark Buy&Hold and a DataSet symbol doesn't contain dates within backtest range ?Synchronization issue: enabled Benchmark Buy&Hold symbol breaks a multi-symbol backtest and generates an "Index Out Of Range" exception when backtested DataSet contains a symbol whose starting date doesn't fall in selected data loading range. (http://www2.wealth-lab.com/WL5WIKI/OpenIssues.ashx?NoRedirect=1#New_Existing_Issues_foundintroduced_in_GC_3)
But how can I solve the problem? I run your strategy “Bad History Data Check” and only have gaps between dates (pe Gap of 5 days in data at bar 5412 (4/26/2011 12:00:00 AM)).
In my test strategy I don’t call historical bars, only “Bar.Count-1”:
CODE:
Please log in to see this code.
If you could help me, here you are the data:
WealthLabDev Version 6.2.34.0
PC with Windows 7 Enterprise, Intel® core™2 processor, 2.00 GB of RAM, 32 BIT op system
daily data from MetaStock, stocks of Euro Stoxx, except BCP (311 stocks).
Thanks
Size:
Color:
Have you disabled Benchmark Buy&Hold symbol in Wealth-Lab's Preferences dialog?
Size:
Color:
Yes, all options are disable in the Backtest Settings in WL's Preferences
Size:
Color:
I'm always suspicious of the translator, so please try running a Strategy that hasn't been translated, like "Glitch Index" on the DataSet and range. Is there a problem there?
If not, this strategy would be pretty simple to whip for you in native C#.
Size:
Color:
OK fine, then we may exclude Benchmark B&H.
The code is very simple but maybe you're not familiar with C# yet if you're trying to use WSTL? In any case, the translation result is valid.
I guess that your strategy accesses the data at an invalid bar number or the data that does not exist. Right after the opening parenthesis of void Execute(), insert the two highlighted lines, "Compile" and "Go" (or click "Execute" that re-compiles and runs):
CODE:
Please log in to see this code.
If that makes the IOOR error go away, then with your selected data loading range (for example, "Date Range") there are symbols with zero bars (i.e. had stopped trading or were added later).
Also, it makes sense to inspect your DataSet in Data Manager and exclude any symbols with 0 bars: click on "Symbol Details" and examine the output in the Bars column.
Size:
Color:
In fact, I didn't have problems with this strategy. I also suspected the code after translate, but I tried to change the code [p.e. from MACDSeries(WL_CLOSE), 9) for MACD.Series(Close, 14)] but appeared a compile error. Maybe because I'm using "finantic.TL;class Strategy : WealthScriptTL"....
I tried to use WealthScriptTL in strategy Glitch Index and I also had errors [p.e. error CS0119 @ (39.25): 'finantic.TL.WealthSriptTL.SMA(int.int.int)' is a 'method'. which is not valid in the given context]
Could you explain me the difference between using "class Strategy : WealthScriptTL" and "class Strategy : WealthScript"? Thank you
Size:
Color:
Don't try to mix WSTL generated code with pure C# WealthScript code. It's a no-no.
The difference between ": WealthScriptTL" and ": WealthScript" is that the first strategy inherits from the WealthScriptTL class (i.e. is a product of WSTL) and the other is a native, pure WealthScript code.
Size:
Color:
So, I can use WealthScriptTL, right?
Replying Eugene 5:00 AM: with the code "if( Bars.Count < 14 ), Abort();" in the beginning the error continue.
I think that the problem can't be about the bars, because when I run the code for only one ticker sometimes it doesn’t have error and sometimes not...
When error appear for only one ticker the error in the bottom of the windows with green color is
"Runtime error: Index was out of range. Must be non-negative and less than the size of the collection.
at WealthLabCompile2.Strategy.Execute()
at finantic.TL.WealthScriptTL.MACD(Int32 bar.Int32 series)
at WealthLab.DataSeries.get Item (Int32 i)
at System.Collections.Generic.List'1.get Item (Int32 index)
at System.ThrowHelper.ThrowArgumentOutOfRangeException()
at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument Argument.ExceptionResource resource)"
but after that I click "Run the Strategy" (for the same ticker), and appear in the Debug and Error Messages ""AC.FP 10/19/2011 ChartScript 1 Short-term trend is positive. 20.7575422856003 ""
Thanks
Size:
Color:
I just did a quick test with your strategy and I see the data errors too - but only with that strategy. Other strategies that use precisely the same data loading don't have the problem. I've never used (and never will use) WealthScriptTL, but the problem seems to be there, so I recommend knocking out this strategy in pure C#. If you can paste the WL4 code, I can whip it up pretty quickly.
Size:
Color:
I'm not familiar with pure C# code, and the posted code is very simple because I was deleting code for find the first error in the original strategy translated for WL6 (after I had the code without compiled errors, appear the "green error" Runtime error: not supported. The original WL4 code is more than 2000 lines, including functions and Community Indicators (as Hilbert Transformations).
The WL4 code only for the posted code before in WSTL:
CODE:
Please log in to see this code.
The return of the original code isn't a test for trading, it is values based in indicators defined by us, equal for each stock, that after we transfer for excel.
Thanks
Size:
Color:
Run this screen on
single symbol w/ longest history:
CODE:
Please log in to see this code.
Size:
Color:
Hi, thank you for the code. It run ok, and it returns the same results of WL4 for 99% of Euro Stoxx's companies.
I'm trying to re-write the code from WSTL to WS. Could we post in this category doubts about WS code, or should we use the category WealthScript (.NET)?
With the same structure, I tried to re-write another part of the big code. But in this case, I have a cycle "for" for all bars of each stock and appears a new error: "Error in Visualizer: TabPage: {Drawdown}, removing.
Exception of type ‘System.OutOfMemoryException’ was thown."
CODE:
Please log in to see this code.
Thanks for your help.
Size:
Color:
QUOTE:
I'm trying to re-write the code from WSTL to WS. Could we post in this category doubts about WS code, or should we use the category WealthScript (.NET)?
It doesn't really matter as we can move users' posts to the appropriate category.
QUOTE:
With the same structure, I tried to re-write another part of the big code. But in this case, I have a cycle "for" for all bars of each stock and appears a new error: "Error in Visualizer: TabPage: {Drawdown}, removing.
Exception of type ‘System.OutOfMemoryException’ was thown."
You might want to review the FAQ for
Out of memory problems. and be sure to run the code on 1 symbol. Here's a slightly revamped version:
CODE:
Please log in to see this code.
Size:
Color:
Hi. I’ve already seen the Out of Memory FAQ, and I turned off all Performance Visualizers, but the error continue.
If I break the DataSet SXXE in SXXE-1 and SXXE-2, it run ok but it isn’t the perfect solution…
How can I use the Bars.Cache.Clear in your last code? I tried after RestoreContext(), but without success.
What is the difference between x32 version and x64 version?
Thanks a lot.
Size:
Color:
QUOTE:
What is the difference between x32 version and x64 version?
See the Wiki
FAQ.
QUOTE:
but the error continue
Sorry, not possible to give further suggestions w/o learning about your WL6 edition (bitness), installed/available RAM, DataSet complexity (bar scale + data loading depth), enabled visualizers, the exact error message after turning off all visualizers.
Size:
Color:
We use the Metastock data, so we can't Install the x64 version, so the solution is to install more RAM, right?
Size:
Color:
No and if you read the FAQ in my penultimate reply, you'll know why.
Size:
Color:
Thank you. How can I substitute the function OffsetSeries(Series, Bars) from WL4 to WL6? And the #Average?
Size:
Color:
Size:
Color:
Thanks a lot for your orientation. Could you help me with the "Correlation"? How can I obtain the same result for the code Correlation (x,y, start bar, last bar) in old version, with the new version? Now we have only tree entries for the function: Correlation (x,y, n).
Size:
Color:
Three are more than enough. The x and y are obvious and haven't changed (the two correlated DataSeries).
The period specifies the quantity of data to analyze in the Lookback parameter (period). You obtain the same result when the lastbar-startbar matches the period.
Size:
Color:
So, no more options for this calculation. My question come from the problem the correlation isn't for all DataSeries, but for a certain period.
Size:
Color:
That's why there is a parameter called period in Correlation.
Size:
Color:
Could you help me with the translation of a public strategy "Total Cyclic Package" in the WL4? Thank you.
Size:
Color:
No.
Size:
Color:
Hi,
When I run the following code I obtain the right correlation for each stock, but when I include the code in comments (for run once for all stocks, according your instructions above) the Lastbar is allways the same and the correlation is zero, for all stocks. How can I solve this problem? Thank you very much.
CODE:
Please log in to see this code.
Size:
Color:
Because the DataSeries are 'attached' to the clicked Bars. In a Strategy that loops by DataSetSymbols, you have to create them after calling
SetContext e.g.:
CODE:
Please log in to see this code.
Size:
Color:
P.S. Please post new requests not directly related to WSTL in new threads, thanks.
Size:
Color:
OK, I'll post. About the answer, thanks a lot, I understood the solution, but now I have the problem of the memory :(
Size:
Color:
Size:
Color: