Stoch %k %d
Kod:
// Stoch %k %d
/*
periodK = input(14, title="K", minval=1)
periodD = input(3, title="D (Smoothed K)", minval=1)
smoothK = input(3, title="Smooth", minval=1)
k = sma(stoch(close, high, low, periodK), smoothK)
d = sma(k, periodD)
adjk = (((sma(stoch(close, high, low, periodK), smoothK))/100)-.5)*2
adjd = ((d/100)-.5)*2
*/
var periodK = 14;
var periodD = 3;
var smoothK = 3;
var stoch = Sistem.StochasticOsc(periodK ,periodD );
var Sk = Sistem.MA(stoch, "Simple", smoothK);
var Sd = Sistem.MA(Sk, "Simple", periodD );
var adjk = Sistem.Liste(0);
var adjd = Sistem.Liste(0);
for (int i=1; i < Sistem.BarSayisi; i++)
{
adjk[i] = ((Sk[i]/100) - 0.5f)*2;
adjd[i] = ((Sd[i]/100) - 0.5f)*2;
}
Sistem.Cizgiler[0].Deger = adjk;
Sistem.Cizgiler[1].Deger = adjd;
Sistem.Cizgiler[2].Deger = Sistem.Liste(0.600f);
Sistem.Cizgiler[3].Deger = Sistem.Liste(-0.600f);
Yer İmleri