Move % of equity from one portfolio to another? (Portfolio rebalancing)
Author: jahlbeck
Creation Date: 5/17/2010 2:45 PM
profile picture

jahlbeck

#1
I would like to build a trading system that dynamically moves from one portfolio to another. For instance, I would like to code a system so that when Portfolio "A" moved 1% down I would move 5% of portfolio "A" to Portfolio "B" and conversly a 1% move up in Portfolio "A" would result in 5% of portfolio "B" to be moved to porfolio "A"

I understand how to build the respective portfolios (A and B) but can you tell me how to code it so I can backtest the trading?
profile picture

Cone

#2
Before I say that that kind of interaction between Portfolios is not possible, give me an example of what Portfolios A and B are made up of, and what moving 5% of A to B would look like.
profile picture

jahlbeck

#3
Portfolio "A" is made up of a group of risk ouriented ETFs (7 total), "B" is made up of a single low risk ETF.
profile picture

Cone

#4
I have to start by saying that unless you're a good programmer and already understand how Wealth-Lab works, it's unlikely that you'll be able to accomplished this.

0. Wealth-Lab is Position-based. So, when doing your resizing, it means that you have to buy, sell, and/or split Positions. The easy way to turn off commissions, flatten out every day (or week), and then adjust by sizing new Positions.

1. There's no way to simultaneously test two "portfolios" and generate independent results for both. Essentially, the trading for you low-risk ETF would have to be included with the results of "A".

2. There's really only an arcane method of interacting with Porfolio Equity, i.e., to influence trading decisions.

3. Despite 2., if you use SetShareSize in your script, you can keep track of Portfolio Equity, and write rules around it. I don't know of an example, but it's theoretically possible and was the motivation for reviving SetShareSize in v5. The script would have to operate in a DataSetSymbols loop, ensuring that it only took the trade it has capital for.

I'd say your best bet is #3. You have to trade your low-risk ETF as a secondary symbol while looping through your DataSetSymbols. For some hints look at the Rotation scripts and the QuickRef example for DataSetSymbols.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).