Hehehe... Sy cuman oprek2...
Best Regards, Christopher Tahir MSN : chris_ta...@hotmail.com YM : chris_ta...@ymail.com FB : chris.ta...@yahoo.com Blog : ez-stock.blogspot.com -----Original Message----- From: greenhorn Sent: 02/08/2010 10:33:14 AM Subject: Re: [Komunitas AmiBroker] Oprekan R-Squared + LinReg + Slope + BarCount toppssss..... thanks,pak. salam, green On Sun, Aug 1, 2010 at 6:31 PM, Christopher Tahir <chris_ta...@ymail.com>wrote: > > > Hihihihi... > Iseng2.... Ini bisa dipake buat komplit punya..... > BarCount buat itungin periode candle yg ada sejak tanggal dimana linreg > ditentukan. > > Berikut AFL nya.... > HIhihihii: > > > ****Kumplit PUNYA**** > > _SECTION_BEGIN("R-Squared+LinReg+Slope"); > MaxGraph=5; > > Periods = Optimize("Periods",Param("Periods",20,2,300,1),2,500,1); > shift = Param("Look back period",0,0,500,1); > P = ParamField("Price field",-1); > > x = Cum(1); > lastx = LastValue( x ) - shift; > aa = LastValue( Ref(LinRegIntercept(P, Periods), -shift) ); > bb = LastValue( Ref(LinRegSlope( P, Periods), -shift) ); > y = Aa + bb * ( x - (Lastx - Periods+1 ) ); > > R2=(Correlation(P,y,Periods)^2)*100; > R2Style=ParamStyle("R2 Style"); > R2Color=ParamColor("R2 Color",colorBlack); > Rdm = 100-R2; > > LRColor = ParamColor("LR Color", colorCycle ); > LRStyle = ParamStyle("LR Style"); > LRLine = IIf( x > (lastx - Periods) AND BarIndex() < Lastx, y, Null ); > Plot( LRLine , "LinReg", LRCOLOR, LRSTYLE); > > // ========================== Plot 1st SD Channel > =============================================================== > > SDP = Param("Standard Deviation", 1.0, 0, 6, 0.1); > SD = SDP/2; > > width = LastValue( Ref(SD*StDev(p, Periods),-shift) );SDU = IIf( x > (lastx > - Periods) AND BarIndex() < Lastx, y+width , Null ) ; > SDL = IIf( x > (lastx - Periods) AND BarIndex() < Lastx, y-width , Null ) ; > > SDColor = ParamColor("SD Color", colorCycle ); > SDStyle = ParamStyle("SD Style"); > > Plot( SDU , "Upper Lin Reg", SDColor,SDStyle ); > Plot( SDL , "Lower Lin Reg", SDColor,SDStyle ); > > // ========================== Plot 2d SD Channel > =============================================================== > > SDP2 = Param("2d Standard Deviation", 2.0, 0, 6, 0.1); > SD2 = SDP2/2; > > width2 = LastValue( Ref(SD2*StDev(p, Periods),-shift) );SDU2 = IIf( x > > (lastx - Periods) AND BarIndex() < Lastx, y+width2 , Null ) ; > SDL2 = IIf( x > (lastx - Periods) AND BarIndex() < Lastx, y-width2 , Null ) > ; > > SDColor2 = ParamColor("2 SD Color", colorCycle ); > SDStyle2 = ParamStyle("2 SD Style"); > > Plot( SDU2 , "Upper Lin Reg", SDColor2,SDStyle2 ); > Plot( SDL2 , "Lower Lin Reg", SDColor2,SDStyle2 ); > > // ============================ End Indicator Code > ============================================================== > > slope = LinRegSlope(C,Periods); > > _SECTION_BEGIN("Bar Count"); > Start = ParamDate("Start","Default",0); > X = BarsSince(DateNum()== Start)+1; > _SECTION_END(); > > Title = > StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g > (%.1f%%) > {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) )+" > "+"R-Squared = "+R2+"%"+" > "+"Random = "+Rdm+"%"+" > "+"Slope = "+slope+" > "+"BarCount = "+X; > > _SECTION_END(); > > > ***Jangan DIJUAL yah**** > > HIhihihihihi > Silahkan sedot bagi yg soorr.... > Kasi comment & perbaikan yah....^^ > Thanks temen2.... > Best Regards, > Christopher Tahir > ez-stock.blogspot.com > MSN: chris_ta...@hotmail.com > YM: chris_ta...@ymail.com > > > >