I am looking for a large (~100) set of uncorrelated stocks to use for backtestin. Can you please comment on each of these options:
1. I have looked at "Wealth-Lab 100" but am not clear what it is. Was it intended as an uncorrelated set? By the way, a few of the symbols in Wealth-Lab 100 will not update from Fidelity, so I am not clear what to make of that, other than delete them (for me it's now "Wealth-Lab 98").
2. I could create my own datasets (.WL files) via my own external code. However, the .WL files appear to be in a binary format and based on other forum posts, reading or writing .WL files appears possible. Is that correct? Or can you provide the file format, or is there a way to import ASCII data?
3. I could time-shift existing data series using the >> or << operators to remove real-world correlations. But if a time-shift a symbol in my code, the chart will display the original (unshifted) symbol data. Is there a way to display the time-shifted bar data in the chart instead?
Thanks,
Ron
Size:
Color:
Forget #2. If you want to create a set of low or negatively correlated stocks (at the present moment), take a look at this downloadable Strategy:
Correlation MatrixAs for #3, start by posting your code so we could determine what's wrong with it.
Size:
Color:
On option #3, I am not clear whether I should shift the core stock data series (OHLC/V) using a) the >> operator or b) manipulating the data values directly. So, I am trying this:
CODE:
Please log in to see this code.
Is this the right approach? It seems to work, except that when I view the new shifted chart, everything is shifted to the left by 10 days except the color of the volume bars. The volume bars show the correctly shifted value but their color (red/green) is wrong. If I hover the mouse over the a shifted volume bar the popup shows the correct color. Is there an extra Bars property that I need to shift?
Or should I use the >> operator somehow to do this? If so, do I need to use setContext() to tell the strategy to use the new shifted symbol? If I do that will that wreak havoc with my calls to Synchronize() that I am using to have indicators ready at the start of my simulations?
Thanks.
Size:
Color:
The thread topic states Uncorrelated DataSet. I have no idea what you're doing, why at all you're modifying the Bars object, should it be done or maybe not, and what it all has to do with the Uncorrelated DataSet. Try explaining what "real-world correlations" you're removing with these manipulations.
But before anything else, try the "Correlation Matrix" and see if this approach fits your needs. I feel you're doing something very unfamiliar to me with those #2-3, so it's better if we find the common ground by using the conventional approach.
Size:
Color:
My "uber"-objective is to develop strategies that work across many symbols and conditions. Therefore I want to test and refine my algorithms across a variety of uncorrelated stocks. One way to create an uncorrelated stock portfolio is to check the correlations between various stocks via the type of tool you pointed out. I actually am already am using such tools but this is a trial-and-error process that in practice does not work well. It can tell you the correlation between within the portfolio but it's very time consuming manual trial and error to come up with portfolio that is uncorrelated.
Instead, my plan is to synthesize uncorrelated symbols. Many stocks, e.g. Dow 30, are moderately to strongly correlated. If, however, we time-shift each of the Dow 30 components into the past, each by some different random number of days (e.g. on the order of months or years) then the resulting shifted stock prices will be very uncorrelated. That's my plan.
By they way, once I modify (time-shift) the stock dataseries, can I save the shifted dataseries?
Size:
Color:
BTW there is an error in what I wrote above. Instead of shifting the series back in time I should be shifting forwards:
CODE:
Please log in to see this code.
Size:
Color:
The Volume bar color must be determined before script runtime. You can just correct the coloring in your routine:
CODE:
Please log in to see this code.
Size:
Color:
Thanks Cone!
Is there any way that I can save my time-shifted data series and re-use them as new stock symbols for later runs? I am running into all sorts of complications by computing them on the fly, e.g. Data Range, startup bars, Synchronize(). If I could just save them that would eliminate these hassles.
Thanks,
Ron
Size:
Color:
I will not pretend to understand what this massaging the data back or forth has to do with symbol correlations, but saving and reusing the virtual symbols can be accomplished with Bars.SaveToFile and Bars.LoadFromFile. For more details and code samples, please see the QuickRef.
Size:
Color:
If I use Bars.SaveToFile, will the file be importable via Data Manager > Create New DataSet > ASCII Files? I am trying to create synthetic symbols that will appear in DataSets in the left-side pane of WLab. The WealthScript QuickRef shows loading the symbol data from code, but I need my synthetic symbols in a Dataset so I can run portfolio simulations on them.
Size:
Color:
Size:
Color:
Thanks. A question about that FAQ. It says:
QUOTE:
* Wealth-Lab expects to find symbols starting with a non-alphabetic character in the root of this folder. If the symbol name contains reserved characters impossible to use in file names (e.g. "+TEST"), you will have to rename the file accordingly (e.g. "%2BTEST.WL").
* Put these synthetic 1-min data files in a new folder: "A" for all tickers starting with A (A, AA, AAPL...), "B" for all symbols starting with B (BA, BRCM...)
The first bullet says that the symbols must start with a non-alphabetic character but the examples in the second bullet all start with alphabetic characters. Must the symbols start with non-alphabetic characters or is alphabetic OK?
Size:
Color:
Absolutely no. It just says that IF your symbol starts with a non-alphabetic character, Wealth-Lab will seek for it in the root of this folder.
Size:
Color: