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 [email protected], "ricko8294_98" <[EMAIL PROTECTED]> 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 ); >
