Thanks for the code, Ed. John Bollinger calculates correlations separately for each of 3 ETF portfolios that are part his system: Country, Sector, and Style.
I'm wondering if, in building a list of non-correlated ETFs, it is necessary to separate the ETFs into these groups. What is the advatange... or not? Michael --- In [email protected], "Ed Hoopes" <[EMAIL PROTECTED]> wrote: > > A Correlation Matrix is commonly used to find stocks that have similar > price patterns. Here is one I use: > > // Exploration to create Correlation matrix original by Herman Van Ven > Bergen > // In AutoAnalyzer, set Apply to -> Use Filter -> WatchList to same > list as Param -> ListNumber (zero based) > // Then set LookBackPeriods > // Modified by EH > // April, 2007 > > Listnumber = Param("Listnumber",1,1,263,1); > LookBackPeriods = Param("Lookback Periods",3,1,252,1); > > Buy=Sell=Short=Cover=0; > Filter = 1; > > list = GetCategorySymbols( categoryWatchlist, Listnumber); > > for( NumTickers=0; NumTickers < 99 AND StrExtract( list, NumTickers ) > != ""; NumTickers++ ); > { > //AddTextColumn(Name(),"Ticker",1.0); > for( Col=0; Col<NumTickers; Col++) > { > Ticker1 = Name(); > Ticker2 = StrExtract( list, Col); > Var1 = Foreign(Ticker1,"C"); > Var2 = Foreign(Ticker2,"C"); > Test = Correlation( Var1, Var2, LookBackPeriods ); > Color = IIf(Test>0, colorGreen, IIf(Test<0, colorRed, > colorWhite)); > Color = IIf(Ticker1==Ticker2, 1, color); > AddColumn( Test, Ticker2, 1.3, color); > } > } > > > --- In [email protected], Doji Star <dojistarbullish@> wrote: > > > > Excellent! Excellent code, sir. Thank you. > > > > > > > > ----- Original Message ---- > > From: Graham <kavemanperth@> > > To: [email protected] > > Sent: Wednesday, May 21, 2008 10:48:30 AM > > Subject: Re: [amibroker] Re: System tweak > > > > > > It is possible to use zigzag in a backtest. the important thing is > > that the signals can only occur after the price has passed the > > reversal level > > eg here is a way to use it > > > > p = Peak(C,10); > > pb = PeakBars(C,10) ; > > t = Trough(C,10) ; > > tb = TroughBars(C, 10); > > > > cp = Cross(p*0.9, LowestSince( pb==0, C )); > > ct = Cross(HighestSince( tb==0, C ), t*1.1); > > > > Fall = Flip(Cp,Ct); > > Rise = Flip(Ct,Cp); > > > > Buy = Cross(MACD() ,Signal() ) AND rise; > > Sell = Cross(Signal( ),MACD()) ; > > > > SetChartOptions( 0, chartShowDates| chartWrapTitle ); > > GraphXSpace= 10; > > _N(Title = "{{NAME}} - {{INTERVAL}} {{DATE}} "+_DEFAULT_NAME( )+" : > > {{OHLCX}} {{VALUES}}" ); > > > > BarColor = IIf( rise, colorPaleGreen, IIf( fall, colorOrange, > > ParamColor( "Price Colour", colorWhite ))); > > > > Plot( C, "", BarColor, ParamStyle( "Price Style", styleBar, > maskPrice ) ); > > > > Plot( Zig(C,10), "Zig", colorRed, styleLine ); > > Plot( IIf(pb<tb,Peak( C,10)*0.9, Trough(C, 10)*1.1), "Zig", > > IIf(pb<tb,colorOran ge,colorPaleGree n), styleStaircase ); > > > > PlotShapes( shapeSmallUpTriangl e*Ct, colorPaleGreen, 0, L, -12 ); > > PlotShapes( shapeSmallDownTrian gle*Cp, colorOrange, 0, H, -12 ); > > > > PlotShapes( shapeUpArrow* Buy, colorGreen, 0, L, -24 ); > > PlotShapes( shapeDownArrow* Sell, colorRed, 0, H, -24 ); > > > > -- > > Cheers > > Graham Kav > > AFL Writing Service > > http://www.aflwriti ng.com > > > > 2008/5/21 Louis Préfontaine <[EMAIL PROTECTED] com>: > > > Hi, > > > > > > My idea is to use the zigzag feature in the past to find the best > stocks > > > which match ETF. I'd like to use the zigzag directly in my formula > without > > > having to re-build a new watch-list often. > > > > > > Louis > > > > > > 2008/5/21 Ed Hoopes <reefbreak_sd@ yahoo.com>: > > >> > > >> ZigZag > > >> This indicator cannot be used for trading. It effectively looks into > > >> the future. Say you set its threshold at 4%. It will show tops and > > >> bottoms that are 4% or greater difference. If you get a high today, > > >> but a higher hi 2 weeks from now, it will move the reversal to > the new > > >> higher high. > > >> > > >> It is most often used to calculate theoretical performance of a > series > > >> of price movements. Then you can run your indicators over the same > > >> period and calculate a "capture ratio". Good for comparing indicators > > >> - not trading. > > >
