커뮤니티
질문
2010-04-30 15:53:48
792
글번호 29716
- 2분봉 챠트에서 10분봉 스토캐스틱을 표시하는 수식을 부탁드립니다.
감사합니다.
답변 1
예스스탁 예스스탁 답변
2010-04-30 16:47:21
안녕하세요
예스스탁입니다.
input : 분(10),Period(5), Period1(3), Period2(3);
var : count(0), highVal(0), lowVal(0), StoFastK(0), StoK(0), StoD(0);
var : Ep(0), EP1(0), JISU(0), DINDEX(0), PreStoK(0), PreStoD(0),cnt(0);
Array : HH[20](0),LL[20](0);
var1 = TimeToMinutes(stime)%분;
if dayindex == 0 or var1 < var1[1] Then{
HH[0] = H;
LL[0] = L;
for cnt = 1 to 19{
HH[cnt] = HH[cnt-1][1];
LL[cnt] = LL[cnt-1][1];
}
}
if H > HH[0] Then
HH[0] = H;
if L < LL[0] Then
LL[0] = L;
#### 특정 구간의 고가 [highest(H,Period)] ####
highVal = HH[0];
for count = 0 to Period-1 {
if HH[count] > highVal then
highVal = HH[count];
}
#### 특정 구간의 저가 [lowest(L,Period)] ####
lowVal = LL[0];
for count = 0 to Period-1 {
if LL[count] < lowVal then
lowVal = LL[count];
}
#### Fast StochasticsK ####
StoFastK = (C-lowVal)/(highVal-lowVal)*100; //Fast StochasticsK ==> (C-lowest(L,Period))/(highest(H,Period)-lowest(L,Period))*100
#### Slow StochasticsK ####
Ep = 2/(Period1+1);
if DINDEX >= Period and (date != date[1] or var1 < var1[1]) then {
DINDEX = DINDEX + 1;
PreStoK = StoK[1];
}
if DINDEX <= 1 then
StoK = StoFastK ;
else
StoK = StoFastK * EP + PreStoK * (1-EP); //Slow StochasticsK ==> ema(Fast StochasticsK, Period1)
#### Slow StochasticsD ####
Ep1 = 2/(Period2+1);
if date != date[1] or var1 < var1[1] then {
DINDEX = DINDEX + 1;
PreStoD = StoD[1];
}
if DINDEX <= 1 then
StoD = StoK ;
else
StoD = StoK * EP1 + PreStoD * (1-EP1); //Slow StochasticsD ==> ema(Slow StochasticsK, Period2)
plot1(StoK);
plot2(StoD);
즐거운 하루되세요
> 양방산인 님이 쓴 글입니다.
> 제목 : 질문
> - 2분봉 챠트에서 10분봉 스토캐스틱을 표시하는 수식을 부탁드립니다.
감사합니다.