is there a basic script that I can run that can create an index from a watchlistbased on specific percent allocations. For example:
25% large cap
15% small cap
10% emerging markets
50% bonds
ideally something where I can play around with the percentages as variables.
Size:
Color:
Size:
Color:
Assuming use of a fundamental data, you could identify large and small caps, but how would you identify the properties of a symbol so that you knew it was "emerging market" or other? It seems that you'll need to read in that data from an external source, which means you'll need to create that data for each symbol in the WatchList. Creating the index is the more or less the easy part since it's only programming.
Size:
Color:
Cone, I was being too general in my original post. Basically I want to try to replicate various fund asset allocations. Essentially through the use of ETFs or Index Funds is my intention. So, using the original example:
25% SPY
15% IWM
10% EEM
50% SHY
Size:
Color:
If it's just 4 symbols, use GetExternalSymbol for each one and create the index series with a little series math. Example -
CODE:
Please log in to see this code.
Size:
Color:
Here's a more convoluted way for
asurapan to place the created index in Wealth-Lab's global memory to be easily accessible in other strategies:
CODE:
Please log in to see this code.
Size:
Color:
is there a way to then add some Buy code so that I can see the results in the EquityCurve, Drawdown, and ByPeriod?
for example, how would I be able to run the follwing code on the "My Index"?
CODE:
Please log in to see this code.
Size:
Color:
Not sure I understand: myIndex is just a data series. How can you buy a SMA (for instance) at market?
Size:
Color:
strictly hypothetical. i just want to see what performance and risk metics would look like for certain asset allocations. Perhaps myIndex isn't the best way to go about it. I'm just trying to play around with different asset classes and different weightings.
let me be more specific. Lets say I had 10 different ETFs in a dataset. Lets say I want to run a strategy where I only buy an ETF when an EMA Crosssover occurs.
Normally this would be very simple as I could just run the strategy on the entire dataset. But this assumes that each ETF will be allocated 10% of my capital. But what if I want 5% for ETFa and 20% for ETFb, 15% for ETFc, etc.?
Size:
Color:
QUOTE:
Normally this would be very simple as I could just run the strategy on the entire dataset. But this assumes that each ETF will be allocated 10% of my capital. But what if I want 5% for ETFa and 20% for ETFb, 15% for ETFc, etc.?
You'll easily handle it once advanced position sizing support is back again in 5.4 or later build.
QUOTE:
strictly hypothetical. i just want to see what performance and risk metics would look like for certain asset allocations. Perhaps myIndex isn't the best way to go about it. I
On a second thought, you could create a Bars object using
myIndex (even saving the resulting object for later use; see Bars.SaveToFile and Bars.LoadFromFile in the QuickRef) and use SetContext to trade the virtual symbol.
CODE:
Please log in to see this code.
Size:
Color: