Compare two portfolios
Author: gbw00007
Creation Date: 9/25/2008 4:21 PM
profile picture

gbw00007

#1
I am looking for a program that will allow me to compare 2 (or a portfolio of) stocks. I want to use an exogenous number divided by current price to determent my investment decision.
For example stock a 30/ divided by a current price of 15=2.
Stock b 40/ divided by a current price of 10= 4.

So if I have 100 to spend stock a gets 33% of money 2/6 (sum of a and b). Stock b gets 66% of money 4/6. As current prices move around I will have the ability to rebalance my portfolio.
I may want to limit the amount that can go any one stock.

Thank you
Glenn Weinstein
CODE:
Please log in to see this code.

profile picture

Cone

#2
There's no problem creating indicators using exogenous numbers (instead of GetExternalSeries, maybe we should have called it "GetExogenousSeries".) However, something that is not easy to do in Wealth-Lab is rebalancing positions within a portfolio, and, although you can split up cash for a particular bar in SimuScripts, rebalancing cannot be done using SimuScripts.

This is because WL is "position-based". You can only add or subtract to a portfolio by splitting then selling or buying new Positions. The logic for buying and selling is in the ChartScript (not in a SimuScript, which is used for sizing only), and, each of these Positions needs to be managed separately, hence the complexity.

One approach to simplify the problem is to assume 0 trading costs. Whenever you need to rebalance, you exit all Positions and enter them again (in which case you can use a SimuScript for the balancing logic). The big disadvantage of this, however, is that it throws off metrics like profit per bar, number of trades, wins, etc.
profile picture

gbw00007

#3
Dear Cone,

Thank you for taking time to respond to my 2 posts, giving me good insight. 1st let me apologize for not knowing where and how to post things- I am new here. 2nd to address my analytic concerns. If I was to use SimuScript- for balancing logic, could I some how download data to excel and calculate my portfolio performance?

Also would you suggest I post my programing needs on the 4.0 forum
profile picture

Cone

#4
QUOTE:
If I was to use SimuScript- for balancing logic
You cannot do this for the reason I explained. SimuScripts are for sizing Positions only. You must acquire or get rid of Positions in the ChartScript logic. True "rebalancing" will take a rather large programming effort by someone that knows W-L well, or, you can try shortcuts like the one I mentioned.

Either way, since the trades and sizes of those trades are dependent on trades performed across the Portfolio, you need to write the script such that the entire Portfolio Simulation is performed in the code - similar to the technique used in this KB article: Interacting Dynamically with Portfolio Level Equity... but that's just for starters. "Balancing" will add another order of complexity.

QUOTE:
could I some how download data to excel and calculate my portfolio performance?
Excel is good for many things, but without some add-in, I don't see why you would even think about doning it in Excel when it's already done for you in Wealth-Lab. But yes, of course, there are many ways to export data - that's the extremely easy part. Balancing is your problematic task.
profile picture

Eugene

#5
QUOTE:
True "rebalancing" will take a rather large programming effort

Just an example for gbw00007: Portfolio of Multiple systems with Scaling out - here. It includes exiting from positions in order to manage portfolio performance metrics (i.e. volatility/risk). Despite all those lines of code, the scaling out portion of the code is somewhat dumbed down - and there's no "scaling in" so... True "rebalancing" will take a rather large programming effort.
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).