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

Re: [amibroker] Re: Advance Decline Line ATTN: DMcleod



PureBytes Links

Trading Reference Links

This is work done by another developer who likes to remain anonymous (AND I don't claim to represent him) but here goes on how I think you'll have to do it.  If you don't have the Amibroker Clearwater CDs you probably should get them to fill you in on the details. 

The objective as presented in Clearwater was to get breadth indicators on mutual funds given you know the holdings.  You can do the same for sectors.
The code is surprisingly straightforward but you've got to do some set up leg work.

1) Need to build 19 watchlists of each Rydex sector fund holdings (in your case it would be each sector with a limited number but representative component stocks).  The watchlists list are contiguous and number say WL 40 to 56. 
2) Combine all of these stocks into a master component list of all the stocks in each one of those sectors.  For Rydex it runs on approx 300 unique stocks representing 17 sector funds.  If you ran it against the ALL list it may break the back of a 2 GigHz machine. As it is it take 7-8 minutes to run on these 300 stocks. 
3) The main AFL operates on list developed in step 2,  then looks in each watch list to finds what sector that stock belongs in and adds  the metrics you're looking for to the appropriate composite.  
4) These composites are  stored with Unique names like    ~+"fundname"+adv for the composite with advancing issues for the Energy Sector for example
5) To display these in one Layout you need a generic indicator that decodes the fundname

It probably could be coded with other program logic but this seems to be the most straight forward way to do it in AFL.  If AB would provide for processing the Watchlist literal name in AFL this would be a little easier.  

JOE 


----- Original Message ----- 
  From: dmcleod1981 
  To: amibroker@xxxxxxxxxxxxxxx 
  Sent: Saturday, September 11, 2004 6:08 PM
  Subject: [amibroker] Re: Advance Decline Line ATTN: DMcleod


  Joe,

  I appreciate the help. This will work on a single composite run but I 
  am trying to do all the sectors in one shot just as you can build 
  them using SectorID() all with one run if that makes sense. 

  I found in the archives how to do that but there seems to be nothing 
  on how to make the AD Lines using the same type of procedures.  I 
  guess I could make a list using SectorID() == 1 etc but I thought 
  there might be an easier way.

  I have sent a few hours on the archives and I may dig something but 
  it sure is not the easiest thing to sort through.

  Thanks again for the suggestion.


  --- In amibroker@xxxxxxxxxxxxxxx, "Joe Landry" <jelandry@xxxx> wrote:
  > I didn't try to see what was happening with your code, but here's a 
  code fragment from the Clearwater School that will develop the 
  > 
  > advancing issues and declining issues as well as new highs and new 
  lows (note the original author used 60 bars or 6 weeks).
  > 
  > Apply it to a list of your sectors's stocks and run SCAN.
  > 
  >  There's a section for your indicator window that will display new 
  highs/new lows. 
  > 
  > Best Regards
  > 
  > Joe Landry 
  > 
  > // Breadth of NDX100 
  > 
  > // Develops 4 composites that can be plotted or manipulated as you 
  wish
  > 
  > // 
  > 
  > // How to Run
  > 
  > // 1) Build a watchlist of NDX100 stocks
  > 
  > // 2) Select an issue with a long history in the current ticker 
  window
  > 
  > // 3) Set APPLY TO to use filter NDX100
  > 
  > // 4) Set RANGE to one bar... 1 n last quotations
  > 
  > // 5) Press SCAN
  > 
  > // Voila! 
  > 
  > Buy=Sell=0; 
  > 
  > Filter=1; 
  > 
  > //===================6 Weeks New Highs New 
  Lows==========================================
  > 
  > AddToComposite(IIf(High > HHV(Ref(High, -1), 30), 1, 
  0), "~NDXNewHighs", "X");
  > 
  > AddToComposite(IIf(Low < LLV(Ref(Low, -1), 30), 1, 
  0), "~NDXNewLows", "X");
  > 
  > //===================Advance/Decline Issues 
  > 
  > AddToComposite(IIf(Close - Ref(Close, -1) > 0, 1, 
  0), "~NDXAdv", "X" );
  > 
  > AddToComposite(IIf(Ref(Close, -1) - Close > 0, 1, 
  0), "~NDXDec", "X" );
  > 
  > >>>>>>>>>>>>>>>>>>>>> For Your indicator builder 
  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<,
  > 
  > NASADV=Foreign("~NDXAdv","X");
  > 
  > NASDECL = Foreign("~NDXDec","X");
  > 
  > DIFF = NASADV-NASDECL;
  > 
  > Plot(NASADV,"NAS(Grn)",8,2);
  > 
  > Plot(-NASDECL,"NAS(Red)",4,2);
  > 
  > Plot(MA(Diff,10),"10dayMA",1,4);
  > 
  > Plot(0,"",colorLightBlue,1);
  > 
  > Title = "NASDAQ Adv(Green) & Decl(Red),Net10day MA";
  > 
  >   ----- Original Message ----- 
  >   From: dmcleod1981 
  >   To: amibroker@xxxxxxxxxxxxxxx 
  >   Sent: Saturday, September 11, 2004 3:36 PM
  >   Subject: [amibroker] Advance Decline Line
  > 
  > 
  >   I am trying to use the addtocomposite to create an Advance 
  Decline 
  >   line for each sector.
  > 
  >   I have the following code but this does not create a cumulative 
  line 
  >   which is what I am trying to do.
  > 
  >   //creates advance /decline by sector composite
  > 
  >   up=C>Ref(C,-1);
  >   dn=C<Ref(C,-1);
  >   ADln=(up-dn);
  >   Ad="~AD"+SectorID(1);
  >   AddToComposite(ADln,AD,"C");
  >   Buy=Sell=Short=Cover=0;
  > 
  >   I tried using Cum(ADln); etc but I am not really sure how all of 
  this 
  >   works together yet. Still a newbie grasping for a clue....
  > 
  >   Thanks
  > 
  >   DM
  > 
  > 
  > 
  > 
  > 
  >   Check AmiBroker web page at:
  >   http://www.amibroker.com/
  > 
  >   Check group FAQ at: 
  http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  > 
  > 
  >         Yahoo! Groups Sponsor 
  >               ADVERTISEMENT
  >              
  >        
  >        
  > 
  > 
  > --------------------------------------------------------------------
  ----------
  >   Yahoo! Groups Links
  > 
  >     a.. To visit your group on the web, go to:
  >     http://groups.yahoo.com/group/amibroker/
  >       
  >     b.. To unsubscribe from this group, send an email to:
  >     amibroker-unsubscribe@xxxxxxxxxxxxxxx
  >       
  >     c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
  Service. 
  > 
  > 
  > 
  > [Non-text portions of this message have been removed]



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

  Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 


        Yahoo! Groups Sponsor 
              ADVERTISEMENT
             
       
       


------------------------------------------------------------------------------
  Yahoo! Groups Links

    a.. To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/
      
    b.. To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx
      
    c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 



[Non-text portions of this message have been removed]



------------------------ 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/