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

RE: [amibroker] Question on RS, possibly for Tomasz



PureBytes Links

Trading Reference Links

Jason,

 

I just realized that you aren’t using Telechart data.   The Symbol “!spx” is not a valid Telechart symbol.   The good news is that it was a trivial issue for me to change the code below to make it work with Telechart data. 

 

Unfortunately, it’s NOT a trivial issue for you to change my code to work with your data vendor.   The problem isn’t the code; it’s the data vendor.   AFAIK, the “MG…” sectors and industries are unique to Telechart.  They are composite symbols that created and managed in the Telechart database, and are mapped to stock symbols.   You can probably create a set of AB composite symbols that will work, but I suspect that it would be a lot of work.  

 

Regards,

 

Dan.

 


From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Jason Hart
Sent: Wednesday, July 13, 2005 6:33 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: RE: [amibroker] Question on RS, possibly for Tomasz

 

Dan - In reference to your question:  replace the relstrength lines with ....

 

j = Foreign("!spx", "c");

j1 = RelStrength("!spx");

j2 = RelStrength("!spx")/Ref(j1,-20);

j3 = RelStrength("!spx")/Ref(j1,-30);

j4 = RelStrength("!spx")/Ref(j1,-50);

j5 = RelStrength("!spx")/Ref(j1,-100);

j6 = RelStrength("!spx")/Ref(j1,-120);

j7 = RelStrength("!spx")/Ref(j1,-150);

j8 = RelStrength("!spx")/Ref(j1,-200);

 

   <<  When I tried to run an exploration with this, I got the error, “Relative strength base symbol not found” on all of the RelStrength lines starting with:

 

j1 = RelStrength("j");   >>



Dan Clark <dan_public@xxxxxxxxxxx> wrote:

Quad, Jason,

 

I’ve been wrestling with almost the exact same issues for the past couple of weeks.    In fact, my post of 7:57 this morning is related to this issue.

 

Quad, regarding comparing Sector/Market Relative Strength against each other…  Is this even valid?   (No, I’m not trying to be rude.)   Here’s my thinking…

 

Unless I’m missing something, it seems that your underlying questions are, “Which are the strongest and weakest Sectors?” and “How is Sector strength changing over time?”   (If so, these are my questions as well.)    If this is correct, why do we care about the comparative “Relative Strength to Market”?

 

It seems to me that the combination of the Sectors IS the market.  Correct?    If so, then the Sectors’ comparative ROC or RSI is a valid measure.  Or, perhaps calculating the rank of a Sector within all Sectors using ROC or RSI.    Do my arguments make any sense? 

 

I’m using TC2005 data also and the Sectors/Industries are one of the key reasons that I used the data.    I’ve got several indicators built that calculate Industry and Sector rank and comparative strength.  I use ROC and RSI for both.   I’m VERY interested in improving this.

 

Jason, this looks VERY interesting, but there are two issues:

 

1)   

 

 

2)   

3)  I’m a little confused about using this as a scan.  I.e. it looks like the code computes the relative strength of the Nasdaq index to the S&P500 and it’s changes over time.   But that wouldn’t that only return one row?

 

Inquiring minds want to know.  J

 

Regards,

 

Dan.

 

// Here’s the code I’m using to compute Industry and Market Relative Strength to the current symbol.  (Obviously this works only with a stock symbol which has an industry.)

 

_SECTION_BEGIN("Relative Strength");

// Get Symbols

MktBaseSymbol = ParamStr("Mkt ticker", "SP-500" );

IndustrySymbol = GetBaseIndex() ;

 

StockToIndColor = ParamColor( "Stock to Industry Color", colorOrange );

StockToIndStyle = ParamStyle("Stock To Industry Style", styleLine + styleNoLabel + styleOwnScale) | styleDots  ; 

 

StockToMktColor = ParamColor( "Stock to Market Color", colorRed );

StockToMktStyle = ParamStyle("Stock To Market Style", styleLine + styleNoLabel + styleOwnScale) ; 

 

IndToMktColor = ParamColor( "Industry to Market Color", colorGold );

IndToMktStyle = ParamStyle("Industry To Market Style", styleLine + styleNoLabel + styleOwnScale) ; 

 

RelStrengthSymbolToIndustry = RelStrength(IndustrySymbol );

RelStrengthSymbolToMarket= RelStrength(MktBaseSymbol );

 

ShortMAPeriods    = Param("Rel Strength Short MA Periods", 10, 1, 50, 1);

LongMAPeriods     = Param("Rel Strength Long MA Periods", 40, 1, 50, 1);

 

cShortMAPeriods = NumToStr(ShortMAPeriods, 3.0);

cLongMAPeriods  = NumToStr(LongMAPeriods, 3.0);

 

// Plot Relative Strength - Stock To Industry

Plot( RelStrengthSymbolToIndustry , _SECTION_NAME() + " (" + Name() + " to " + IndustrySymbol + ")", StockToIndColor ,StockToIndStyle );

 

// Plot Relative Strength - Stock To Market

Plot( RelStrengthSymbolToMarket, " (" + Name() + " to " + MktBaseSymbol +  ")", StockToMktColor , StockToMktStyle );

 

// Now plot relative Strength - Industry to Market

RelStrengthIndustryToMarket = (Foreign(IndustrySymbol,"C")/Foreign(MktBaseSymbol,"C")) * 1000;

Plot(RelStrengthIndustryToMarket  ,  " (" + IndustrySymbol+ " to " + Name()+ ")", IndToMktColor , IndToMktStyle );

 

if( Status("action")==actionCommentary )

{ printf("(Interpretation is not available yet)");}

_SECTION_END();


From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Jason Hart
Sent: Saturday, July 09, 2005 9:18 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] Question on RS, possibly for Tomasz

 

Quad,

 

I've got a number of different RS-type explorations that I've been experimenting with.  Try this scan - it's by no means perfect, but you can modify it to fit your criteria.  A quick warning though, this formula works fine on my home PC but at work I had to play around with "j" because it wasn't recognized as a valid symbol...strange.   

 

Jason

Filter=C>0;

x=RelStrength("!comp");

j = Foreign("!spx", "c");

j1 = RelStrength("j");

j2 = RelStrength("j")/Ref(j1,-20);

j3 = RelStrength("j")/Ref(j1,-30);

j4 = RelStrength("j")/Ref(j1,-50);

j5 = RelStrength("j")/Ref(j1,-100);

j6 = RelStrength("j")/Ref(j1,-120);

j7 = RelStrength("j")/Ref(j1,-150);

j8 = RelStrength("j")/Ref(j1,-200);

vol1 = StDev(log(C/Ref(C,-1)),720) * sqrt(260)*100;

vol2 = StDev(log(C/Ref(C,-1)),20) * sqrt(260)*100;

vol3 = StDev(log(C/Ref(C,-1)),50) * sqrt(260)*100;

vol4 = StDev(log(C/Ref(C,-1)),90) * sqrt(260)*100;

Vol5 = (Vol2 + Vol3+ Vol4)/3;

Vol6 = Vol5-Vol1;

Final = (j2*1) + (j3*1.2) + (j4*1.3)+(j5*1.4) + (j6*1.5) + (j7*1.7) + (j8*1.7);

RSC=LinRegSlope(x,7);

AddColumn(IIf(rsc>0,BarsSince(rsc<=0),BarsSince(rsc>=0)),"Cross",1.0);

AddTextColumn(FullName(),"name",5);

AddColumn(FINAL,"Today RSC",1.2,colorDefault,IIf(final==0,colorBlue,IIf(final>Ref(final,-1),colorGreen,colorRed)));

AddColumn(Ref(final,-1),"Yesterday RSC",1.2,colorDefault,IIf(final==0,colorBlue,IIf(Ref(final,-1)>=Ref(final,-2),colorGreen,colorRed)));

AddColumn(Ref(final,-2),"2 days",1.2,colorDefault,IIf(final==0,colorBlue,IIf(Ref(final,-2)>=Ref(final,-3),colorGreen,colorRed)));

AddColumn(Ref(final,-3),"3 days",1.2,colorDefault,IIf(final==0,colorBlue,IIf(Ref(final,-3)>=Ref(final,-4),colorGreen,colorRed)));

AddColumn(Ref(final,-4),"4 days",1.2,colorDefault,IIf(final==0,colorBlue,IIf(Ref(final,-4)>=Ref(final,-5),colorGreen,colorRed)));

AddColumn(Ref(final,-5),"5 days",1.2,colorDefault,IIf(final==0,colorBlue,IIf(Ref(final,-5)>=Ref(final,-6),colorGreen,colorRed)));

AddColumn(Ref(final,-6),"6 days",1.2,colorDefault,IIf(final==0,colorBlue,IIf(Ref(final,-6)>=Ref(final,-7),colorGreen,colorRed)));

AddColumn(Ref(final,-7),"7 days",1.2,colorDefault,IIf(final==0,colorBlue,IIf(Ref(final,-7)>=Ref(final,-8),colorGreen,colorRed)));

AddColumn(Ref(final,-8),"8 days",1.2,colorDefault,IIf(final==0,colorBlue,IIf(Ref(final,-8)>=Ref(final,-9),colorGreen,colorRed)));

AddColumn(Ref(final,-9),"9 days",1.2,colorDefault,IIf(final==0,colorBlue,IIf(Ref(final,-9)>=Ref(final,-10),colorGreen,colorRed)));

AddColumn(Ref(final,-10),"10 days",1.2,colorDefault,IIf(final==0,colorBlue,IIf(Ref(final,-10)>=Ref(final,-11),colorGreen,colorRed)));



Quad Rate Serial Abby <quad_pumped_abby@xxxxxxxxx> wrote:

I would like to do an exploration for the change in RS of a sector
over various periods, say one week, two weeks, etc.  I extracted the
RS of the sector versus the S&P Equal Weight Index using:

Strength = RelStrength ( "SPEW-X", fixup = 1 );

Then I found the change over the time periods in question.

Of course, when you look at a plot of the RS for a symbol or sector it
appears the numerical value of the RS is directly correlated to the
price of the underlying.  Thus, the numerical change in RS would be
meaningless against a different priced sector. 

I thought the simple solution was to divide the RS value by the
closing price, thus normalizing the results.  But this caused the RS
charts and values to be identical for every sector. 

Is what I'm trying to do an impossibility with Amibroker or is my
approach all wrong?  Any help would be appreciated.

Thanks,

Bret




Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html



__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html



SPONSORED LINKS

Investment management software

Investment property software

Investment software

Investment tracking software

Return on investment software

Stock investment software

 



Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html




__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html






Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html





SPONSORED LINKS
Investment management software Investment property software Investment software
Investment tracking software Return on investment software Stock investment software


YAHOO! GROUPS LINKS