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

[amibroker] Re: MAAD - Most active advance/decline line



PureBytes Links

Trading Reference Links

Yes, you've got the problem exactly right - finding the top 20 stocks, in volume, for a given day.  I think to do this you would need to compare each stock in the index to every other stock in the index, or utilize some loop to do it - but it's beyond me.

--- In amibroker@xxxxxxxxxxxxxxx, "areehoi" <areehoi@xxx> wrote:
>
> Droskill,
> As I interpreted the MAAD indicator it is based on the high volume stocks -- top 20. In other words a A/D line based on the 20 high volume stocks each day.  Yesterday these were the top 25 High volume stocks:
> Ticker	Close	Close-1	Volume
> BAC	11.94	13.22	433248704
> SPY	89.28	92.04	251876992
> FAZ	5.44	4.71	237738400
> FAS	8.03	9.53	228983504
> C	3	3.17	204409200
> QQQQ	35.08	36.16	137701504
> XLF	11.34	12.04	133198304
> GE	11.52	12.1	102410800
> WFC	22.51	24.19	82112400
> EEM	30.6	31.75	80986096
> MSFT	23.28	24.07	71293296
> INTC	15.68	16.01	70840304
> JPM	32.87	35	70389200
> ETFC	1.19	1.26	61451700
> PFE	14.79	15	58470900
> F	5.38	5.72	57614800
> IWM	49.49	51.31	54877200
> UYG	3.58	4	54439000
> AIG	1.39	1.53	49126000
> CSCO	18.41	18.92	46180600
> AA	10.02	11	44634100
> SSO	24.66	26.23	44414800
> RF	3.84	4.13	43220400
> SKF	46.34	41.83	41821700
> VALE	16.98	18.54	41812300
> 
> Sometime back I developed (with the help of others) an Advance/Decline, NewHi NewLo indicator/composite. Here is the formula:
> // Breadth of Stocks
> // Develops 4 composites that can be plotted or manipulated as you wish
> // How to Run
> // 1) Select Group - Stocks or Market -NYSE,Nasdq, AMEX (or all stocks/ETF's)
> // 2) Select an issue with a long history in the current ticker window
> // 3) Set APPLY TO to use filter Market - Stocks
> // 4) Set RANGE to one bar... 1 n last quotations
> // 5) Press SCAN
> 
> //===================52 Weeks New High -Lows==================================
> NHi = (C> HHV(Ref(C,-1),251));
> NLo = (C< LLV(Ref(C,-1),251));
> AddToComposite(IIf(C > HHV(Ref(C, -1), 251), 1,0), "~StocksNewHi", "X"); //Find New Highs over the past 52 weeks. 
> AddToComposite(IIf(C < LLV(Ref(C, -1), 251), 1,0), "~StocksNewLo", "X"); //Same for lows next.
> NewHigh = Foreign("~StocksNewHi","X");
> NewLow = Foreign("~StocksNewLo","X");
> 
> DIFF_H_L = NewHigh-NewLow;
> 
> Plot(NewHigh,"NewHigh",colorGreen,styleThick|styleHistogram); 
> Plot(NewLow*-1,"NewLow",colorRed,styleThick|styleHistogram); 
> Plot(0,"",1); 
> 
> 
> //===================Advance/Decline Issues
> AddToComposite(C>Ref(C,-1),"~StocksAdv","X");
> AddToComposite(C<Ref(C,-1),"~StocksDec","X");
> AddToComposite(C==Ref(C,-1),"~StocksNC","X");
> 
> Adv = Foreign("~StocksAdv","X");
> Dec = Foreign("~StocksDec","X");
> NC =Foreign ("~StocksNC","X");
> DIFF_A_D = Adv-Dec;
> ADRatio = IIf(Dec>Adv,(Dec*-1)/Adv,Adv/Dec);
> Plot(Adv,"Adv",colorBlack,styleLine);
> Plot(Dec,"Dec",colorBrown,styleLine);
> //Plot( Adv-Dec, "Adv/Dec Histogram", IIf(Adv-Dec > 0,colorBrightGreen,colorRed ), styleNoTitle | ParamStyle("Histogram style", styleHistogram | styleNoLabel, maskHistogram ));
> //Plot(Diff_A_D,"Diff_A_D",colorBlack,styleThick);
> Plot(ADRatio,"AdvanceDeclineRatio",colorDarkBlue,styleHistogram);
> Plot (Cum(Adv-Dec),"Diff_A_D",colorBlack,styleDots);
> 
> GraphXSpace = 2;
> Filter = C;
> Buy = Sell = 0;
> 
> Result = WriteIf(Buy,"Buy","Sell");
> //AddTextColumn( WriteIf(Buy, "Buy" , "Sell" ) , "TRADE" ,  5 ,   IIf(Buy,colorYellow, colorWhite), IIf(Buy, colorDarkGreen, colorDarkRed) );
> AddTextColumn(Result,"Trade", formatChar,IIf(Buy,colorDarkGreen,colorLightYellow ), IIf(Sell,colorLightYellow,colorLime));
> //AddTextColumn(Result,"Trade", formatChar,IIf(Buy,colorDarkGreen,colorRed ), IIf(Sell,colorLightYellow,colorLime));
> AddTextColumn(FullName(),"Full name",77,colorPlum, IIf(Close <1.00,colorYellow,colorDefault ) );
> AddTextColumn(IndustryID(1) ,"     Industry Sector      ", 25.0, colorWhite, colorBlue);
> AddColumn( Close, "Close", 1.2, IIf( ROC(C, 1 ) >= 0, colorDarkGreen,colorRed ),50 );
> AddColumn(NHi,"52 Wk High",1.2,colorBrown);
> AddColumn(NLo,"52 Wk Low",1.2,colorDarkBlue);
> //AddColumn ((NHi-NLo/NHi)*100,"% Dif Hi_Lo", 3.2, colorYellow,colorGreen);
> AddColumn( ( (HHV(C,251))-LLV(C,251))/(HHV(C,251))*100,"% Dif Hi_Lo", 3.2, colorYellow,colorGreen);
> Buy = ExRem(Buy,Sell);
> Sell = ExRem(Sell,Buy);
> _SECTION_END();
> 
> The challenge is to develop formula that will pick the top 20 or 25 high volume stocks each day from ones database and run the oomposite scan on it. Correct me if I'm wrong.
> 
> Dick H
> 
> 
> 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "droskill" <droskill@> wrote:
> >
> > Thanks for the pointer - I tried coding up an Exploration as:
> > 
> > upvol = Volume > Percentile( Volume, 1, 80 ) AND Close > Ref(Close,-1); 
> > downvol = Volume > Percentile( Volume, 1, 80 ) AND Close < Ref(Close,-1); 
> > MAAD = upvol - downvol;
> > 
> > Buy = 0;
> > AddToComposite(upvol,"~MAAD_UpVol20","X");
> > AddToComposite(downvol,"~MADD_DownVol20","X");
> > AddToComposite(MAAD,"~MADD_diff","X");
> > AddToComposite(1,"~MADD_count","X");
> > 
> > But then I realized that I wasn't comparing the volume of one stock to all other stocks - I was just comparing vs. historical volume of an individual stock.  So what I really want to do (which would be incredibly slow):
> > 
> > - Loop through the stocks in a watchlist (in this case, the NYSE)
> > - Compare the volume of a stock to all others in the list.
> > - If it is in the top, say, 20%, then add it to the composite (either up or down depending on whether it was up or down for the day)
> > 
> > I'd be concerned that the code would be to slow to be a reasonable calculation for my home PC - thoughts appreciated.
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, Thomas Ludwig <Thomas.Ludwig@> wrote:
> > >
> > > droskill,
> > > 
> > > I haven't tried it yet - but I think you could use the percentile function. 
> > > See the examples on http://www.amibroker.com/guide/afl/afl_view.php?id=251
> > > 
> > > Greetings,
> > > 
> > > Thomas
> > > 
> > > 
> > > On 19.06.2009, 00:55:12 droskill wrote:
> > > > Hello all -
> > > >
> > > > In the recent issue of Futures, there was an article about MAAD - most
> > > > active advance/decline line that I found interesting.  What I can't figure
> > > > out, however, is how to calculate it in AB.
> > > >
> > > > It is defined as such in the article:
> > > >
> > > > "Thankfully, there is a way to track the smart money in the equity markets.
> > > > After each trading session and at the end of each week, financial print
> > > > journals and a variety of online sources publish the results for the most
> > > > active issues traded by volume on the New York Stock Exchange (NYSE),
> > > > Nasdaq and American Stock Exchange (Amex). You just need to know what to do
> > > > with that information."
> > > >
> > > > "On a given trading day, the 20 most actively traded issues on the NYSE can
> > > > constitute 30% to 50% of composite exchange volume. It follows that we
> > > > should follow the volume leaders when creating a gauge of the internal
> > > > strength or weakness of the market."
> > > >
> > > > So I'm trying to figure out a way you could do this.  The challenge is
> > > > obviously that the most active changes on a daily or weekly basis - so how
> > > > could one possibly use AddToComposite to do this.  Any thoughts on this?
> > > >
> > > > Thanks!
> > > >
> > > >
> > > >
> > > > ------------------------------------
> > > >
> > > > **** IMPORTANT PLEASE READ ****
> > > > This group is for the discussion between users only.
> > > > This is *NOT* technical support channel.
> > > >
> > > > TO GET TECHNICAL SUPPORT send an e-mail directly to
> > > > SUPPORT {at} amibroker.com
> > > >
> > > > TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
> > > > http://www.amibroker.com/feedback/
> > > > (submissions sent via other channels won't be considered)
> > > >
> > > > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> > > > http://www.amibroker.com/devlog/
> > > >
> > > > Yahoo! Groups Links
> > > >
> > > >
> > > >
> > >
> >
>




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

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

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

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

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