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...@quanttrader.at -
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

Reply via email to