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

[amibroker] Sector Advance/Decline



PureBytes Links

Trading Reference Links




If we can agree that 
many stocks within a given Sector tend to follow other stocks in that sector 
then it follows that  understanding the mood of the Sector your stock 
resides in may offer useful information. A common measure of market sentiment is 
the Advance Decline line. Perhaps this concept could be focused on individual 
sectors as well. The first step is to select a market to study such the nasdaq, 
S&P or a custom universe of your choice.
<SPAN 
class=915501906-22032003> 
In AA select this 
watchlist, select n lastdays n=1
<SPAN 
class=915501906-22032003> 
Now scan the 
following code......
<SPAN 
class=915501906-22032003> 
 
Buy=<FONT color=#ff00ff 
size=2>0<FONT 
face=Arial>;
up=C<FONT 
size=2>>Ref(<FONT 
size=2>C,-<FONT 
size=2>1<FONT color=#000000 
face=Arial>);
dn=C<FONT 
size=2><Ref(<FONT 
size=2>C,-<FONT 
size=2>1<FONT color=#000000 
face=Arial>);
upvol=V<FONT 
face=Arial>>Ref<FONT 
size=2>(V<FONT 
size=2>,-1<FONT 
color=#000000 face=Arial>);
dnvol=V<FONT 
face=Arial><Ref<FONT 
size=2>(V<FONT 
size=2>,-1<FONT 
color=#000000 face=Arial>);
Ad="~AD"+<FONT 
size=2>SectorID(1<FONT 
color=#282828 size=2><FONT color=#000000 
face=Arial>);
 <FONT 
color=#000000>
AddToComposite(up,Ad,<FONT 
size=2>"C"<FONT color=#000000 
face=Arial>);<FONT 
face=Arial>
AddToComposite(dn,Ad,<FONT 
size=2>"O"<FONT color=#000000 
face=Arial>);<FONT 
face=Arial>
AddToComposite(upvol,Ad,<FONT 
size=2>"H"<FONT color=#000000 
face=Arial>);<FONT 
color=#000000>
AddToComposite(dnvol,Ad,<FONT 
size=2>"L"<FONT color=#000000 
face=Arial>);
 
<SPAN 
class=915501906-22032003>Now go to IB to plot the data we have 
collected.........
<SPAN 
class=915501906-22032003> 
<SPAN 
class=915501906-22032003><FONT 
color=#008000> 
//Sector <FONT 
color=#000000 face=Arial size=2>AD 
 <FONT 
color=#000000>
pds=Param("Smoothing Periods",5,1,20,1<FONT 
color=#282828>);<FONT 
size=2>
Ad="~AD"+SectorID(1<FONT 
color=#000000 face=Arial size=2>);<FONT 
color=#000000>
ADissues=Foreign(Ad,"C"<FONT 
color=#282828>);<FONT 
size=2>
Dissues=Foreign(Ad,"O"<FONT 
color=#000000 face=Arial size=2>);<FONT 
color=#000000>
Advol=Foreign(Ad,"H");<FONT 
color=#000000 face=Arial>// not used but there is you want it<FONT 
color=#282828>
Dvol=Foreign(Ad,"L");<FONT 
color=#000000 face=Arial size=2>//not used but there if you want it
 <FONT 
color=#000000>
Plot(EMA(adissues,pds),"Advancers",5,1<FONT 
color=#282828>);<FONT 
color=#0000ff>
Plot(EMA(dissues,pds),"Decliners",4,1<FONT 
color=#282828><FONT color=#000000 face=Arial 
size=2>);
 
Title=<FONT 
color=#0000ff>SectorID(<FONT 
color=#ff00ff>1)+ <FONT 
color=#ff00ff>" Sector Advance<SPAN 
class=915501906-22032003>/Decline"<FONT 
color=#282828>+"\n Advancing Issues "<FONT 
color=#282828> +WriteVal<FONT 
color=#282828>(EMA<FONT 
color=#282828>(Adissues,pds),1.0<FONT 
color=#282828>)+" Declining Issues "<FONT 
color=#282828>+WriteVal<FONT 
color=#282828>(EMA<FONT 
color=#282828>(dissues,pds),1.0<FONT 
color=#282828>);
 
 
As you 
scroll your watchlist  the appropriate Sectors A/D line will plot. The 
smoothing is adjustable via Param. It is easy to see which stocks correlate with 
their Sector brethren. Perhaps you will find it 
useful.
 
<SPAN 
class=915501906-22032003> <FONT color=#0000ff 
face=Arial size=2>Jayson 
 






Yahoo! Groups Sponsor


  ADVERTISEMENT









Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.