Plotting growth of hypothetical $10,000 over a given period
Author: Partha
Creation Date: 9/21/2019 6:41 PM
profile picture

Partha

#1
Hi

I would like to plot the growth of all the symbols in a data set for a hypothetical $10,000 investment over a given time period when start date is given as an input in the code...can someone please share any code which can do this if readily available
profile picture

Cone

#2
A date in code is irrelevant if the data loading range specified doesn't envelope the test period desired. So, before continuning I'd have to know why a Buy & Hold equity curve in Raw Profit mode wouldn't be sufficient. For that, a blank script works just fine.
profile picture

Partha

#3
Hi Cone

This was not for back testing...I wanted to visually see how a stock performed relative to its ETF over 1, 3 and 5 yr period...I have a data set on all the constituent stocks in ETF SMH and I wanted to view on one chart how the individual stocks performed for different periods (see a simple view I generated in website Market Watch)....Do you have a code to generate something like this?
profile picture

superticker

#4
This is a very atypical way to run Wealth-Lab, so I wouldn't save the solution below. There are many on-line resources for making multiple Buy-and-Hold plots for comparison, which are easier to use than WL. Wealth-Lab is all about trading simulations (backtesting), not Buy-and-Hold plotting. That's why this code looks awkward.

The Color array in this example only has 9 different colors. If you put more than 9 symbols in your dataset, you'll get an error.
CODE:
Please log in to see this code.

There's no easy way to change this solution into a WL trading simulation. It's a dead end. You cannot add a trading FOR loop to it easily. :(
profile picture

Eugene

#5
QUOTE:
The Color array in this example can only has 9 different colors. If you put more that 9 symbols in your dataset, you'll get an error.

btw, here's a way to use random colors:

WealthScript Techniques | Relative Performance Chart > "Another solution"
profile picture

Partha

#6
Thanks folks
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).