Comparing Total Return/Year
Author: balexander1978
Creation Date: 2/20/2015 9:04 PM
profile picture

balexander1978

#1
I have been trudging through a lot of material and I can't quite find what I'm looking for. If someone has a moment, I would appreciate the help.

Quite simply, as suggested in the title, I would like to chart the total return (% gain/loss, plus dividends) of multiple symbols over the duration of one year. I'm guessing that I am over looking it somewhere.

One thing that I did find was the ROC Multiple Symbols Strategy (below). I like the comparison portion, but again am looking for total return as a percentage.

I did have a somewhat unrelated question about this code as well. Is there a way to make the color of the symbols in the data set that I am running the strategy on keep their color as I scroll through?

Thank you all in advance.

CODE:
Please log in to see this code.
profile picture

Eugene

#2
QUOTE:
Quite simply, as suggested in the title, I would like to chart the total return (% gain/loss, plus dividends) of multiple symbols over the duration of one year.


Code above as well as this sample code (Relative Performance Chart) should chart the individual return for comparison. For the total return, Index-Lab and YTDGain should make it possible:

1. From Tools menu, open Index-Lab, select Basic Index from Index Builder view, highlight your DataSet, click Next, then Finish.
2. Install Community Indicators, restart WLP, then use the YTDGain (Year To Date Gain) indicator. Load up the data for 2 years (don't choose Most Recent, select 01/01/2013 - 12/31/2014 for example).

For the Dow 30 DataSet, the resulting figure would be 7.52% which is the correct figure: Dow up 7.5% for the year
profile picture

Cone

#3
Here's a nice little script with a reusable class to whet your appetite. You just have to instantiate a PerformanceData object by passing the Bars, dates, and a dividend item string to have all the public gain and drawdown metrics and DataSeries at your disposal. The script demonstrates comparing the clicked symbol with the "SPY" benchmark.

CODE:
Please log in to see this code.
profile picture

Eugene

#4
We should probably build this nice reusable class into C.Components, shouldn't we?
profile picture

Cone

#5
By all means. PerformanceData is too general of a name though. Maybe GainAndDrawdown? PricePercent? .. something better?
profile picture

Eugene

#6
GainAndDrawdown is fine. To be included in Community Components 2015.04.
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).