[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] comparative RS



PureBytes Links

Trading Reference Links

Yuki Taga wrote:
> I have poured over the list archives, but I have uncovered nothing
> that allows me to explore and return values for each of the 33 sub
> indices compared to, say, the TOPIX (^IXJ) index.  When I try to plot
> RS of various sub indices, I get numbers than are not bounded by 0 to
> 100, which seems odd to me.
> 
> When I look up RS in the help file, I find nothing about periodicity,
> which I also find rather strange.  Certainly comparative RS must be
> measured over some period of time, must it not?  Am I completely
> nuts?

Yuki,

this code is a slight modification of an example of comparative relative 
strenght that Tomasz gave I don't remember where (the man?).
It plots the current ticker in percentage terms against a small set of 
indexes. You can focus the period you need to look at via zooming or 
using the Focus parameter.

startpoint = Status("barvisible");
period     = Param("Focus", 1, 1, 250, 1);
startpoint = startpoint - Ref( startpoint, -period );

price = Close;
Plot( 100 * ( price/ValueWhen( startpoint, price ) - 1 ), Name(),colorBlue);

ticker = ParamStr("Ticker 1", "^GSPC" );
price  = Foreign( ticker, "C");
Plot( 100 * ( price/ValueWhen( startpoint, price ) - 1 ), ticker,colorRed );

ticker = ParamStr("Ticker 2", "^RUA" );
price  = Foreign( ticker, "C");
Plot( 100 * ( price/ValueWhen( startpoint, price ) - 1 ), 
ticker,colorGreen );

ticker = ParamStr("Ticker 3", "^SGX" );
price  = Foreign( ticker, "C");
Plot( 100 * ( price/ValueWhen( startpoint, price ) - 1 ), 
ticker,colorBrown );

ticker = ParamStr("Ticker 4", "^SVX" );
price  = Foreign( ticker, "C");
Plot( 100 * ( price/ValueWhen( startpoint, price ) - 1 ), 
ticker,colorDarkYellow );

GraphXSpace = 3;


This is the same code modified for taking into account different time 
periods (to a year) in months terms.

period     = Param("RS months", 1, 1, 12, 1);
RS_Period  = period*20;

price = ROC(Close, RS_Period);

index = ParamStr("Ticker 1", "^GSPC" );
RS  = price - ROC(Foreign( index, "C"), RS_Period);
Plot( RS, index,colorRed );

index = ParamStr("Ticker 2", "^RUA" );
RS  = price - ROC(Foreign( index, "C"), RS_Period);
Plot( RS, index,colorGreen );

index = ParamStr("Ticker 3", "^SGX" );
RS  = price - ROC(Foreign( index, "C"), RS_Period);
Plot(RS, index,colorBrown );

index = ParamStr("Ticker 4", "^SVX" );
RS  = price - ROC(Foreign( index, "C"), RS_Period);
Plot( RS, index,colorDarkYellow );

GraphXSpace = 3;


You will see that the most intuitive is the first one. Imo it's better 
to look at the comparative relative strenght  of a set of indexes with 
different time periods in AA via Explore.

Franco



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/