예스스탁
예스스탁 답변
2019-10-31 12:30:06
안녕하세요
예스스탁입니다.
1 일봉
input : Period(12), Period1(5), Period2(5);
var : cnt(0), highVal(0), lowVal(0), FK(0), SK(0), SD(0);
var : Ep1(0), Ep2(0), PreSK(0), PreSD(0);
#N일간 최고가 및 최저가
highVal = dayhigh(0);
lowVal = daylow(0);
for cnt = 0 to Period-1 {
if dayHigh(cnt) > highVal then
highVal = dayhigh(cnt);
if dayLow(cnt) < lowVal then
lowVal = dayLow(cnt);
}
#Fast StochasticsK
fK = (C-lowVal)/(highVal-lowVal)*100;
#Slow StochasticsK / Slow StochasticsD
Ep1 = 2/(Period1+1);
Ep2 = 2/(Period2+1);
if bdate != bdate[1] then {
PreSK = SK[1];
PreSD = SD[1];
}
SK = FK * EP1 + PreSK * (1-EP1);
SD = SK * EP2 + PreSD * (1-EP2);
plot1(SK,"일봉 SlowK");
plot2(SD,"일봉 SlowD");
PlotBaseLine1(20);
PlotBaseLine2(80);
2 주봉
input : StoPeriod(12), StoPeriod1(5), StoPeriod2(5);
var : TF1(0),TF2(0),Ep1(0), EP2(0),cnt(0);
var : hVal1(0), lVal1(0), StoFastK(0), StoK(0), StoD(0);
var : JISU(0), DINDEX(0), PreStoK(0), PreStoD(0);
Array : H1[50](0),L1[50](0);
Ep1 = 2/(StoPeriod1+1);
Ep2 = 2/(StoPeriod2+1);
if DayOfWeek(bdate) < DayOfWeek(bdate[1]) Then{
H1[0] = H;
L1[0] = L;
for cnt = 1 to 49{
H1[cnt] = H1[cnt-1][1];
L1[cnt] = L1[cnt-1][1];
}
DINDEX = DINDEX + 1;
PreStoK = StoK[1];
PreStoD = StoD[1];
}
if H > H1[0] Then
H1[0] = H;
if L < L1[0] Then
L1[0] = L;
hVal1 = H1[0];
lVal1 = L1[0];
for cnt = 0 to StoPeriod-1 {
if H1[cnt] > hVal1 then
hVal1 = H1[cnt];
if L1[cnt] < lval1 then
LVal1 = L1[cnt];
}
StoFastK = (C-lVal1)/(hVal1-lVal1)*100;
if DINDEX <= 1 then{
StoK = StoFastK ;
StoD = StoK ;
}
else{
StoK = StoFastK * EP1 + PreStoK * (1-EP1);
StoD = StoK * EP2 + PreStoD * (1-EP2);
}
plot1(StoK);
plot2(StoD);
PlotBaseLine1(20);
PlotBaseLine2(80);
즐거운 하루되세요
> 짱짱해야지 님이 쓴 글입니다.
> 제목 : 분봉상 일봉주봉의 StochasticsK
> 본봉에서 data2를 사용하지 않고
일봉과 주봉의 StochasticsK(12,5), StochasticsD를 분봉에서 표현하고자 합니다.
어떻게 코딩하면 가능한지요??
항상 감사드립니다.