Yes, you are right. I can rewrite it... But 50 is not defined. But after searching in the WEB I think I translated it quite correctly.
Thanks, dubi --- In amibroker@yahoogroups.com, Rajiv Arya <rajivary...@...> wrote: > > > Can rewrite this > > summ = 0; > for( i = 5; i < BarCount; i++ ) > { > if ((22*KAdjusted[i]+8*DAdjusted[i])/30 >50) summ[i]=1; > if ((22*KAdjusted[i]+8*DAdjusted[i])/30 <50) summ[i]=-1; > } > xAverage = EMA(Summ,5); > > > > > > to > > summ=iif(((22*Kadjust+8*Dadjust)/30)>=50,1,-1); > > xaverage = ema(summ,5); > > > > > > > > To: amibroker@yahoogroups.com > From: gonzale...@... > Date: Thu, 12 Nov 2009 22:47:51 +0000 > Subject: [amibroker] digital Stochastic > > > > > > Hi, > > tried to translate this code from TradeSignal to Amibroker (but I think I did > something wrong): > > TradeSignal Code: > > Meta: > Synopsis( "Digitale Stochastic - (c)2008 kah...@... - > Info: Trader`s 08/2008" ), > SubChart( True ), > WebLink( "http://www.quanttrader.at" ); > > Inputs: > PeriodStoch( 5, 1 ), > PeriodSmoothing1( 3, 1 ), > PeriodSmoothing2( 3, 1 ), > OverBought( 80, 0, 100 ), > OverSold( 20, 0, 100 ); > > Variables: > fast_k( 0 ), > slow_k( 0 ), > slow_d( 0 ), > summ; > { Berechnung fast_k, slow_k } > StochasticNormal( High, Low, Close, PeriodStoch, PeriodSmoothing1, > PeriodSmoothing2, fast_k, slow_k, slow_d ); > > { Digitalisierung } > if (22*slow_k+8*fast_k)/30 >50 then summ=1; > if (22*slow_k+8*fast_k)/30 <50 then summ=-1; > > { Darstellung } > DrawLine(xaverage(summ,periodStoch), "digitale Stochastic" ); > > AFL: > > KAdjusted = StochK(5,3); > DAdjusted = StochD(5,3,3); > > // Digitalisierung > summ = 0; > for( i = 5; i < BarCount; i++ ) > { > if ((22*KAdjusted[i]+8*DAdjusted[i])/30 >50) summ[i]=1; > if ((22*KAdjusted[i]+8*DAdjusted[i])/30 <50) summ[i]=-1; > } > xAverage = EMA(Summ,5); > > Plot (xAverage, "Stoch. Dig.", colorBlack); > > Is my code right? > > Thanks and regards, dubi > > > > > > _________________________________________________________________ > Find the right PC with Windows 7 and Windows Live. > http://www.microsoft.com/Windows/pc-scout/laptop-set-criteria.aspx?cbid=wl&filt=200,2400,10,19,1,3,1,7,50,650,2,12,0,1000&cat=1,2,3,4,5,6&brands=5,6,7,8,9,10,11,12,13,14,15,16&addf=4,5,9&ocid=PID24727::T:WLMTAGL:ON:WL:en-US:WWL_WIN_evergreen2:112009 >