How do I purchase different ETF percentages in a theoretical long-term protfolio to be backtested?
Author: fsgregs1
Creation Date: 6/30/2011 8:29 PM
profile picture

fsgregs1

#1
I am a new user of Wealthlab Pro. If this question has already been answered and I missed it, please forgive me.

I want to do something very elementary. I want to create a theoretical portfolio of a basket of 10 ETF index stocks, decide what percentage of each I want to buy, choose a date range, make the theoretical purchase on paper, then run backtests of the portfolio to see how it would have performed during different market periods. For example, my portfolio might contain 20% of a total US market ETF, 10% of a REIT ETF, 15% of an Emerging Market ETF, 25% of a global bond ETF, etc.

When I installed Wealthlab Pro and ran it, I discovered to my utter and absolute amazement that the program will not do that!!!! Instead, while I can create a data set containing 10 ETFs and specify a starting equity (say $100,000), I can only make a theoretical trade of those 10 stocks by equal weight. I can buy 10% of each, or $10,000 of each, but there are no provisions for me to tell the program that I want to buy 20% of one ETF and 5% of another. Since every investor who is designing a "buy and hold" portfolio for the longer term obviously wants the ability to change percentages of each holding and backtest how each performs, I simply could not believe the program could not offer that feature by default.

So, I contacted Wealthlab Pro Tech support and they confirmed that in fact, it DOES NOT do that. One rep said it was not possible. Another suggested that I might try creating a combination strategy whereby I create 10 separate strategies, assign a different ETF stock to each, load all 10 strategies up in a combination strategy, then use the "position size" field to change how much of each stock I purchase/load into the strategy, then run the combination strategy. It would be a bit tedious, but it might work.

I tried it and got things to work somewhat, but when I ran the strategy, the "Buy and Hold" field was far above what it should have been and is clearly wrong. I have been unable to fix it. Somehow, I have not set the parameters correctly.

Is anyone aware of a script or extension that will allow a user to create a basket of stocks and buy different amounts/percentages of each, then backtest the basket portfolio? If so, I'd be grateful for a link to where I can find the script.

Thanks in advance

Frank
profile picture

Cone

#2
To be sure, Wealth-Lab is a programming environment, and if you've never programmed scripts or PosSizers in Wealth-Lab, you may come to the conclusion that it's not possible.

The truth is, it's possible in more than one way; I can think of four. We'll start with the easiest one because I think it's the way you want to use it.

Method 1: Create a list of historical trades and "import" them into a backtest. You first need to install the Community.Components from Wealth-Lab.com Add-in Extensions and then follow the instructions here.

Method 2:
Use the brand new 6.2 feature: Combination Strategies. Here you can simply duplicate the Strategy assigning each one to a different ETF and adjust the allocation and sizing for each one. Just use the Buy and Hold strategy and adjust the starting date to one bar before the day you want to start.

I just noticed that we don't have a Buy and Hold Strategy loaded in WLP, so I may upload one to make it convenient for everyone. Here it is if you want to get started now:

CODE:
Please log in to see this code.

---------
Since you're new we won't go into the other two methods, but I'll just mention them for reference:

Method 3:
Use the WealthScript Override method and change the sizing based on the symbol

Method 4:
Similar to above, create a PosSizer that sizes based on just about any rules you can think of. You may be interested in seeing some examples - just click here.
profile picture

Eugene

#3
Hi Frank,

Welcome to the forums. Certainly, the rep who said it's impossible was wrong and the other was creative. The Combo strategy approach might work.

Another - more direct but more involved - approach would be to develop a PosSizer. It takes some development skills and a programming IDE but these modules are used to express money management rules of any complexity:

MS123 PosSizer Library

The PosSizer would somehow accept the symbol names and associated amounts/percentages in a GUI. It's an interesting idea to explore for a future PosSizer, one way or another, so I'm putting this on my list to review it later.
profile picture

Sammy_G

#4
The Position Priority PosSizer is the easiest way to do it, fsqreqs1. Even though you have 10 ETFs, if you are not using 10 separate %ages for each symbol, then you can go with the 6 %age values (or less) this PosSizer allows you to specify. All you have to do is assign the appropriate Position Priority when you create the position. I use it in several of my scripts. If you don't understand how to do it, just ask.

[BTW, Eugene, if you are going to expand on this PosSizer, can you make it for up to 20 positions? GUI or no GUI...TIA.]
profile picture

Eugene

#5
Sammy_G, excellent idea :) I just expanded the PosSizer's online guide with this use case:

Priority Adjustment
profile picture

fsgregs1

#6
Thanks, guys for all your posts. First, I do not know how to use the PositionPrioritySizer option. Assuming I do have 10 - 20 ETF's I want in my portfolio,are there easy to understand directions for (1) how to assemble a combination portfolio from a set of up to 20 different symbols to trade and (2) assign each symbol a trading priority so that I can tell the strategy what percentage of each I want to trade/backtest?

With total respect for all your efforts, I am most confused about something. I was first told about Wealthlab Pro by a Fidelity rep, who explained it was a program designed to backtest a variety of portfolios that investors might want to try out. Now, I don't think I am an unusual investor. If I choose 10 stocks, mutual funds, REIT's, etc. to include in my portfolio, I WILL want to vary their percentages. Every investor does that. Very few of us (including all of you), have investment portfolios containing only equal percentages of everything.

When I discovered that Wealthlab Pro does not have an easy default set of choices to specify a group of stock/fund symbols to include and simply specify what percentage of each you want in the portfolio, I was frankly astonished! How could that be? What am I missing?

I appreciate your efforts to tell me how to work through this, and I am confident that one or more techniques will work, but .... why is what I am asking for not been made into a default menu in Wealthlab Pro a long time ago? Am I misunderstanding what the program is supposed to do?

Anyway, a few days ago, I tried the "combination strategy" approach recommended by Cone above of creating a strategy with just one rule (buy at market). I then created a new combination strategy by copying that single strategy 10 times, assigning a different stock symbol to each, and editing equity allocation/position size for each. I used seven different percentages, ranging from 20% to 3%. I funded it with $100,000. My total equity allocation added up to only 70% of the $100,000, so that I was left with 30% unspent cash to cover fees, etc. I set the top left menu to "Raw Profit Mode" ($100,000)

I then ran the combination strategy. It worked very well. I bought approximately the percentage of ETF funds I wanted ... the performance and graph functions were good, the trade screen showed the correct trades, etc. I was happy!

Then I added an 11th symbol, with a purchase of 4% equity. Now, I was running a strategy that would buy a total of 74% assets, leaving a healthy 26% of unspent cash. I reran the backtest. UNFORTUNATELY, I now got a message saying "1 trade was not included in the backtest results due to insufficient capital. Use Raw Profit Mode ...." The 11th symbol I had added had not been bought, even though I had plenty of cash in the portfolio to cover the cost. Here is a screenshot of it: http://www.4shared.com/photo/t6zXCInD/Wealthlab_error1.html



I have tried everything to get it to work. I changed all the other percentages so they were less than 70%. I changed the symbols. Nothing changes. The program will not let me backtest more than 10 symbols in a combination strategy.

In closing, if there is a way to fix this ... great! If the PosSizer option is best, please just direct me to the step-by-step instructions for how to set up my portfolio with up to 20 symbols and assign different percentages of holdings for each. Thanks in advance for your good advice.

Frank



profile picture

Eugene

#7
QUOTE:
First, I do not know how to use the PositionPrioritySizer option.

1. In your code, assign a value of type double to the Position.Priority property of the Position being created based on the underlying instrument e.g.
CODE:
Please log in to see this code.

These 1, 2, 3 etc. are custom values (up to 6) that identify your symbol with a market group (i.e. 1 for all emerging market ETFs and so on, you get the picture).

2. In the Priority Adjustment PosSizer, assign an applicable position size in % of equity. Enable the checkboxes to activate.

For example, for your emerging market ETFs enter From = 1 and To = 1.99 and position size = 10%, for global bond ETFs From = 2 and To = 2.99 and position size = 15% etc.

Voila.
profile picture

Eugene

#8
QUOTE:
Wealthlab_error1.html

Are you sure you studied the User Guide > Strategy Window > Backtesting Strategies > 100% of Equity Sizing?
profile picture

Cone

#9
Another way...
Method 5:
Wealth-Lab is Position based. Using a constant dollar or % of Equity sizing, a strategy can buy more or fewer Positions in an instrument to adjust allocation. (However, the strategy must manage all the Positions is creates.)

Wealth-Lab isn't going to be precisely what everyone is looking for, but we have shown you nearly a half-dozen ways to do what you want in WLP. There are a few pages of discussion about Position sizing in the User Guide: Reference > Data Panel > Position Size Control that you should read for context.

As for the rejected Position, the simple answer is that your portfolio didn't have the cash size required to add the Position due to its basis price used to size the Position.
More reading for you:
User Guide: Strategy Window > Backtesting Strategies > How Trades Are Chosen
and
User Guide: Strategy Window > Backtesting Strategies > 100% of Equity Sizing