logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Bullstock  
#1 Posted : Monday, October 9, 2006 9:04:04 AM(UTC)
Bullstock

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 9/28/2006(UTC)
Posts: 32

Hi,

Is it possible to create a chart with two securities or more that start with same reference point, so that it is easy to compare their performance.

see attached picture as an example

UserPostedImage

Bullstock
hayseed  
#2 Posted : Monday, October 9, 2006 5:47:15 PM(UTC)
hayseed

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 3/7/2005(UTC)
Posts: 1,346

hey bullstock.... that can be done by several means... you should be able is understand the code below which is not exactly like your chart but should give an idea.... version 9 has the security so just change the index path to your choice...

you can apply to multiple securites and then just copy and overlay the seperate plots into any same window to compare individual securities..... in that manner you can compare 4 or 5 but the chart quickly becomes cluttered with more than that.... once overlayed all indivdual plots can be further adjusted.... thats handy comparing some of the ultra bear funds ....

workin on a dll for something similar to this.... h

---------------------------------------------------------------------

firstdate:=Input("first date mmddyyyy",111990,12312100,1032006);

amount:=Input("US dollar amount", 1,1000000,1000);

shares:=Input("number of shares",1,1000000,100);

choice:=Input(" 1 dollars or 2 shares",1,2,2);

etf:=Input("0 none, 1 dia, 2 spy, 3 qqq",0,3,0);
etf2:=Input("0 none, 1 dia, 2 spy, 3 qqq",0,3,0);


a:=amount/C;
aa:=ValueWhen(1, firstDate=Month()*1000000 + DayOfMonth()*10000+ Year(),a);
aaaa:=(aa*C)-amount;

b:=shares*C;
bb:=ValueWhen(1, firstDate=Month()*1000000 + DayOfMonth()*10000+ Year(),b);

bbbb:=b-bb;
plot:=If(choice=1,aaaa,If(choice=2,bbbb,aaaa));
0;
plot;


{dia etf section, change the security to suit}

a:=amount/Security("C:\MetaStock Data\etf\dia",C ) ;
aa:=ValueWhen(1, firstDate=Month()*1000000 + DayOfMonth()*10000+ Year(),a);
aaaa:=(aa*Security("C:\MetaStock Data\etf\dia",C ))-amount;

b:=shares*Security("C:\MetaStock Data\etf\dia",C );
bb:=ValueWhen(1, firstDate=Month()*1000000 + DayOfMonth()*10000+ Year(),b);

bbbb:=b-bb;

dia:=If(choice=1,aaaa,If(choice=2,bbbb,aaaa));


{spy etf section, change the security to suit}

a:=amount/Security("C:\MetaStock Data\etf\spy",C ) ;
aa:=ValueWhen(1, firstDate=Month()*1000000 + DayOfMonth()*10000+ Year(),a);
aaaa:=(aa*Security("C:\MetaStock Data\etf\spy",C ))-amount;

b:=shares*Security("C:\MetaStock Data\etf\spy",C );
bb:=ValueWhen(1, firstDate=Month()*1000000 + DayOfMonth()*10000+ Year(),b);

bbbb:=b-bb;

spy:=If(choice=1,aaaa,If(choice=2,bbbb,aaaa));


{qqqq etf section, change the security to suit}

a:=amount/Security("C:\MetaStock Data\etf\qqqq",C ) ;
aa:=ValueWhen(1, firstDate=Month()*1000000 + DayOfMonth()*10000+ Year(),a);
aaaa:=(aa*Security("C:\MetaStock Data\etf\qqqq",C ))-amount;

b:=shares*Security("C:\MetaStock Data\etf\qqqq",C );
bb:=ValueWhen(1, firstDate=Month()*1000000 + DayOfMonth()*10000+ Year(),b);

bbbb:=b-bb;

qqqq:=If(choice=1,aaaa,If(choice=2,bbbb,aaaa));

If(etf=1,dia,If(etf=2,spy,If(etf=3,qqqq,0)));

If(etf2=1,dia,If(etf2=2,spy,If(etf2=3,qqqq,0)));

wabbit  
#3 Posted : Monday, October 9, 2006 6:38:14 PM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
nice work h....

Personally, to plot the second security at the same startting price as the first security, I would shift the second security down by it value on the first bar then shift it up to the value of the first security on the first bar. Apply this shift consistently across the entire time period....

Code:

mySec:=Security(other security,C);
shift:=ValueWhen(1,Cum(IsDefined(mySec))=1,mySec)-ValueWhen(1,Cum(IsDefined(mySec))=1,C);

{plot the shifted second security on the same axis as the primary security}
mySec-shift;


Of course, if the second security hasn't been around as long as the primary security using the first bar on the chart will lead to errors, hence, the use of the IsDefined() function...


Hope this helps.

wabbit [:D]
Bullstock  
#4 Posted : Monday, October 9, 2006 7:17:12 PM(UTC)
Bullstock

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 9/28/2006(UTC)
Posts: 32

Thanks you all....

Bullstock
Jose  
#5 Posted : Tuesday, October 10, 2006 7:34:04 AM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
The URSC tool kit may also be of interest here - it allows a true Relative Strength Comparison between two securities, with a common zero starting point based on either calendar days lookback or a specific date. "Normalized RSC values with true % levels that are directly comparable to all charts." "Adjustable common zero-starting data points, independent of any missing data." jose '-)
Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.