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

[amibroker] Re: Sector Analysis



PureBytes Links

Trading Reference Links

Rick,
It appears you are using the ETF's for sectors.  Why not use the
US-Stock database sectors or Industry groups?? I believe John Murphy
had reference to the Industry Groups rather than sectors.  What you
need to do is make a composite of the sectors or industry groups then
sort by performance or ROC by period 1 day, week month etc. Here is a
scan to build a composite of Industry Groups (change to sector if that
is what you want. AB puts results in Group 253, so that is the file
you need to do Performance or ROC exploration. Here's the formula:

Dick H.

//Industry Group Composite

sym = "~" + IndustryID(1);
AddToComposite( L, sym,"L",1+2+8+16);
AddToComposite( O, sym,"O",1+2+8+16 );
AddToComposite( H, sym,"H",1+2+8+16 );
AddToComposite( C, sym,"C",1+2+8+16 );
AddToComposite( V, sym, "V",1+2+8+16);
ROC1 = ROC(C,1);
ROC5 = ROC(C,5);
AddTextColumn( FullName(), "FullName" );
AddColumn (Close, "Close",2.2);
AddColumn (C,"RS",4.1);
AddColumn(ROC(C,1),"ROC1",2.2);
AddColumn(ROC(C,5),"ROC5",2.2);
AddColumn(ROC(C,30),"ROC30",2.2);
Buy=Sell=Short=Cover=0;
Filter= Close >0;


--- In amibroker@xxxxxxxxxxxxxxx, "wavemechanic" <timesarrow@xxx> wrote:
>
> There is a sort function in the library that looks like it could be
incorporated into your title.
> 
> Bill
>   ----- Original Message ----- 
>   From: ricko8294_98 
>   To: amibroker@xxxxxxxxxxxxxxx 
>   Sent: Wednesday, July 09, 2008 11:23 PM
>   Subject: [amibroker] Re: Sector Analysis
> 
> 
>   I wondered why my post dragged up so much of the past.  Didn't 
>   realize the subject was the same.
> 
>   In any event, I would love an answer from anyone who can suggest a 
>   sort routine that would allow me to plot the results in descending 
>   order.
> 
>   I seem to recall there was a posting a couple of years ago which 
>   ranked an entire watchlist and then plotted the "top 4" = but I 
>   cannot locate it again.
> 
>   Any help would be appreciated.
> 
>   Rick
> 
>   --- In amibroker@xxxxxxxxxxxxxxx, "brian_z111" <brian_z111@> wrote:
>   >
>   > Louis,
>   > 
>   > 
>   > It started from Ricko's post #126423.
>   > He has a question about sorting sectors from his code:
>   > 
>   > > If you plot it, you will see that the various sectors are listed 
>   > > under the Title at the top right of the chart
>   > > 
>   > > Is it possible to sort the values being plotted (i.e. the price, 
>   or 
>   > > ROC(x) or RSI(x) so that the highest value sector is listed 
>   first, 
>   > > and the lowest is liste last in the Title?
>   > 
>   > He posted against an old thread, which bought it to the top of the 
>   > messages.
>   > I post online, where the date isn't so prominent - I only read the 
>   > messages and reply if I am interested - so my comments are current 
>   > but we haven't answered Ricko's question.
>   > 
>   > brian_z
>   > 
>   > 
>   > --- In amibroker@xxxxxxxxxxxxxxx, "ricko8294_98" <ricko@> wrote:
>   > >
>   > > John Murphy at StockCharts.com is big on Sector Analysis.
>   > > I have cobbled together a chart that looks at 9 different market 
>   > > sectors all on one chart, and as a starter, set parameters to 
>   show 
>   > > either the close,  or alternatively the ROC or RSI values for 
>   > > different periods.
>   > > 
>   > > The code is below.
>   > > 
>   > > If you plot it, you will see that the various sectors are listed 
>   > > under the Title at the top right of the chart
>   > > 
>   > > Is it possible to sort the values being plotted (i.e. the price, 
>   or 
>   > > ROC(x) or RSI(x) so that the highest value sector is listed 
>   first, 
>   > > and the lowest is liste last in the Title?
>   > > 
>   > > TIA
>   > > Rick 
>   > > 
>   > > // Market Sector Analysis
>   > > 
>   > > SetChartBkColor( colorBlack ) ;
>   > > EnableTextOutput( False );
>   > > S1 = Foreign( "XLY", "Close" ) ;
>   > > S2 = Foreign( "XLK", "Close" ) ;
>   > > S3 = Foreign( "XLI", "Close" ) ;
>   > > S4 = Foreign( "XLB", "Close" ) ;
>   > > S5 = Foreign( "XLE", "Close" ) ;
>   > > S6 = Foreign( "XLP", "Close" ) ;
>   > > S7 = Foreign( "XLV", "Close" ) ;
>   > > S8 = Foreign( "XLU", "Close" ) ;
>   > > S9 = Foreign( "XLF", "Close" ) ;
>   > > 
>   > > Period = Param( "Indicator Period", 14, 1, 50 );
>   > > Plotwhat = ParamList( "Display", "Price|ROC|RSI" );
>   > > 
>   > > 
>   > > if ( Plotwhat == "Price" )
>   > > {
>   > >     S11 = S1;
>   > >     S12 = S2;
>   > >     S13 = S3;
>   > >     S14 = S4;
>   > >     S15 = S5;
>   > >     S16 = S6;
>   > >     S17 = S7;
>   > >     S18 = S8;
>   > >     S19 = S9;
>   > > }
>   > > else
>   > >     if ( Plotwhat == "ROC" )
>   > >     {
>   > >         S11 = ROC( S1, Period );
>   > >         S12 = ROC( S2, Period );
>   > >         S13 = ROC( S3, Period );
>   > >         S14 = ROC( S4, Period );
>   > >         S15 = ROC( S5, Period );
>   > >         S16 = ROC( S6, Period );
>   > >         S17 = ROC( S7, Period );
>   > >         S18 = ROC( S8, Period );
>   > >         S19 = ROC( S9, Period );
>   > >     }
>   > >     else
>   > >     {
>   > >         S11 = RSIa( S1, Period );
>   > >         S12 = RSIa( S2, Period );
>   > >         S13 = RSIa( S3, Period );
>   > >         S14 = RSIa( S4, Period );
>   > >         S15 = RSIa( S5, Period );
>   > >         S16 = RSIa( S6, Period );
>   > >         S17 = RSIa( S7, Period );
>   > >         S18 = RSIa( S8, Period );
>   > >         S19 = RSIa( S9, Period );
>   > >     }
>   > > 
>   > > 
>   > > Plot( S11, "", colorBlue, 1 );
>   > > 
>   > > Plot( S12, "", colorBrightGreen, 1 );
>   > > Plot( S13, "", colorWhite, 1 );
>   > > Plot( S14, "", colorAqua, 1 );
>   > > Plot( S15, "", colorGrey50, 1 );
>   > > Plot( S16, "", colorYellow, 1 );
>   > > Plot( S17, "", colorCustom12, 1 );
>   > > Plot( S18, "", colorLightOrange, 1 );
>   > > Plot( S19, "", colorRed, 1 );
>   > > 
>   > > Title = "Market Sectors    =>   " + EncodeColor( colorYellow ) + 
>   > > WriteIf( Plotwhat == "Price", "Close", Plotwhat + "(" + Period 
>   > > + ")" ) + "\n" +
>   > > EncodeColor( colorBlue ) + "  Consumer Disc        " + WriteVal( 
>   > S11, 
>   > > 1.2 ) + "\n" +
>   > > EncodeColor( colorBrightGreen ) + "  Technology              " + 
>   > > WriteVal( S12, 1.2 ) + "\n" +
>   > > EncodeColor( colorWhite ) + "  Industrial                  " + 
>   > > WriteVal( S13, 1.2 ) + "\n" +
>   > > EncodeColor( colorAqua ) + "  Materials                  " + 
>   > WriteVal
>   > > ( S14, 1.2 ) + "\n" +
>   > > EncodeColor( colorGrey50 ) + "  Energy                     " + 
>   > > WriteVal( S15, 1.2 ) + "\n" +
>   > > EncodeColor( colorYellow ) + "  Consumer Staples    " + WriteVal( 
>   > > S16, 1.2 ) + "\n" +
>   > > EncodeColor( colorCustom12 ) + "  Health Care             " + 
>   > WriteVal
>   > > ( S17, 1.2 ) + "\n" +
>   > > EncodeColor( colorLightOrange )  + "  
>   Utilities                    
>   > " 
>   > > + WriteVal( S18, 1.2 ) + "\n" +
>   > > EncodeColor( colorRed ) + "  Financials                " + 
>   > WriteVal( 
>   > > S19, 1.2 );
>   > >
>   >
> 
> 
> 
>   ------------------------------------
> 
>   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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
>   http://www.amibroker.com/devlog/
> 
>   For other support material please check also:
>   http://www.amibroker.com/support.html
>   Yahoo! Groups Links
> 
> 
> 
> 
>   No virus found in this incoming message.
>   Checked by AVG - http://www.avg.com 
>   Version: 8.0.138 / Virus Database: 270.4.7/1543 - Release Date:
7/9/2008 6:32 PM
>



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

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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
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/