Relative performance chartscript?
Author: P_Cherry
Creation Date: 9/2/2008 4:50 AM
profile picture

P_Cherry

#1
Hi,
I would like to chart relative performance of 2-10 instruments starting at Data range definition (at 0%)...

This script was available in WL4, but in WL5 there is nothing like that:(

Can anybody help?

Thx
Peter
profile picture

Eugene

#2
If you're looking for a way to compare to a benchmark symbol, then see WealthScript Programming Guide, chapter Painting the Chart > Charting Multiple Symbols > Compare to a Benchmark Symbol.

Otherwise let me know the name of the chartscript.
profile picture

P_Cherry

#3
Yes, I know about this chapter, there is following code:

CODE:
Please log in to see this code.


But it gives me errors...I don´t know how to implement it with initial part of the script:
CODE:
Please log in to see this code.



In summary I would like to get something like this:
http://finance.yahoo.com/echarts?s=IBM#chart2:symbol=ibm;range=1y;compare=^dji+^ixic;indicator=rsi+stochasticfast(10,5);charttype=line;crosshair=on;ohlcvalues=0;logscale=off;source=undefined







profile picture

Eugene

#4
1) Please use the CODE and LINK buttons to present code and links respectively. Your link is not working.
2) No need to paste example code.

QUOTE:
But it gives me errors...I don´t know how to implement it with initial part of the script:

Every example comes with a link that points to the chapter illustrating "How to Run Example Code". Just copy and paste the snippet like the screenshot shows:

1. Copy the entire example code snippet.
2. Create a new Strategy window.
3. Select code starting from "protected..." and up to the penultimate curly bracket. In other words, there should be two brackets left not highlighted at the end of the Editor window.
4. Paste.
5. Create as many PlotBenchMark calls for different symbols as needed.
6. Press "Execute".
profile picture

P_Cherry

#5
Partial success, thanks, I ran the code:)

It is very similar to desired chart script, but I miss relative vertical axis (to see relative increase/decrease):

http://finance.yahoo.com/echarts?s=IBM#chart2:symbol=ibm;range=1y;compare=^dji+^ixic;indicator=rsi+stochasticfast(10,5);charttype=line;crosshair=on;ohlcvalues=0;logscale=off;source=undefined
profile picture

Cone

#6
Here you go - this one's a full copy and paste. Click "Run the Strategy" to compile and run after pasting it in the Editor.

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

P_Cherry

#7
Great:) That´s exactly what I was looking for.

I have just changed date to 1900 to be able use various data ranges for start.
PlotBenchMarkPct(benchMarkSymbols, colors, new DateTime(1900, 1, 1));

BTW, now I am trying to have 'new DateTime' as Strategy parameter but still fighting with compiling errors..any programmer can help how to implement this code?

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

Cone

#8
Change "MovingAverageCrossover" to the name of your Strategy class. If you used the code above, it's MyStrategy. I'm pretty sure there are step-by-step instructions for this in the WealthScript Programming Guide.

In fact, there are! See: Programming Trading Strategies > Strategy Parameters
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).