예스스탁
예스스탁 답변
2020-07-20 14:23:40
안녕하세요
예스스탁입니다.
1 MACD
input : ntime(30),short(12),long(26),sig(9);
var : S1(0),D1(0),TM(0),EP1(0),EP2(0),EP3(0),MACDO(0);
var : TF(0),xma1(0),xma2(0),idx(0),Prexma1(0),Prexma2(0),MACDV(0),MACDS(0),PreMACDS(0);
Ep1 = 2/(short+1);
Ep2 = 2/(long+1);
Ep3 = 2/(sig+1);
if Bdate != Bdate[1] Then
{
S1 = TimeToMinutes(stime);
D1 = sdate;
}
if D1 > 0 then
{
if sdate == D1 Then
TM = TimeToMinutes(stime)-S1;
Else
TM = TimeToMinutes(stime)+1440-S1;
TF = TM%ntime;
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and ntime > 1 and TF < TF[1]) or
(Bdate == Bdate[1] and ntime > 1 and TM >= TM[1]+ntime) or
(Bdate == Bdate[1] and ntime == 1 and TM > TM[1]) Then
{
idx = idx + 1;
Prexma1 = xma1[1];
Prexma2 = xma2[1];
PreMACDS = MACDS[1];
}
if idx <= 1 then {
xma1 = C;
xma2 = C;
MACDV = xma1-xma2;
MACDS = MACDV;
MACDO = MACDV-MACDS;
}
else{
xma1 = C * EP1 + Prexma1 * (1-EP1);
xma2 = C * EP2 + Prexma2 * (1-EP2);
MACDV = xma1-xma2;
MACDS = MACDV * EP3 + PreMACDS * (1-EP3);
MACDO = MACDV-MACDS;
}
plot1(MACDV,"MACD");
plot2(MACDS,"signal");
plot3(MACDO,"Ocs");
PlotBaseLine1(0);
}
2 스토케스틱
input : ntime(30),Sto1(10),Sto2(5),Sto3(5);
var : S1(0),D1(0),TM(0),TF(0);
var : cnt(0), Hv(0), LV(0), FK(0), SK(0), SD(0);
var : Ep1(0), EP2(0), JISU(0), DINDEX(0), PreSK(0), PreSD(0);
Array : HH[100](0),LL[100](0);
Ep1 = 2/(sto2+1);
Ep2 = 2/(sto3+1);
if Bdate != Bdate[1] Then
{
S1 = TimeToMinutes(stime);
D1 = sdate;
}
if D1 > 0 then
{
if sdate == D1 Then
TM = TimeToMinutes(stime)-S1;
Else
TM = TimeToMinutes(stime)+1440-S1;
TF = TimeToMinutes(stime)%ntime;
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and ntime > 1 and TF < TF[1]) or
(Bdate == Bdate[1] and ntime > 1 and TM >= TM[1]+ntime) or
(Bdate == Bdate[1] and ntime == 1 and TM > TM[1]) Then
{
HH[0] = H;
LL[0] = L;
for cnt = 1 to 99
{
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;
if HH[sto1-1] > 0 and LL[sto1-1] > 0 then
{
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and ntime > 1 and TF < TF[1]) or
(Bdate == Bdate[1] and ntime > 1 and TM >= TM[1]+ntime) or
(Bdate == Bdate[1] and ntime == 1 and TM > TM[1]) Then
{
DINDEX = DINDEX+1;
PreSK = SK[1];
PreSD = SD[1];
}
Hv = HH[0];
LV = LL[0];
for cnt = 0 to sto1-1
{
if HH[cnt] > Hv then
Hv = HH[cnt];
if LL[cnt] < LV then
LV = LL[cnt];
}
FK = (C-LV)/(HV-LV)*100;
if DINDEX <= 1 then
{
SK = FK;
SD = SK;
}
else
{
SK = FK * EP1 + PreSK * (1-EP1);
SD = SK * EP2 + PreSD * (1-EP2);
}
plot1(PreSK);
plot2(PreSD);
PlotBaseLine1(20);
PlotBaseLine2(80);
}
}
즐거운 하루되세요
> 미우 님이 쓴 글입니다.
> 제목 : 안녕하세요..지표부탁드립니다..감사합니다.
> 3분봉차트에서
30분봉차트의 mACD 와 스톡캐스틱을 표현하고싶습니다..
아래는 부봉에서 일봉으로 표현하는 지표인데 30분봉으로 변형하는법을 모르겠습니다.
input : Period(12), Period1(5), Period2(5);
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);
#### 특정 구간의 고가 [highest(H,Period)] ####
highVal = dayhigh(0);
for count = 0 to Period-1 {
if dayHigh(count) > highVal then
highVal = dayhigh(count);
}
#### 특정 구간의 저가 [lowest(L,Period)] ####
lowVal = daylow(0);
for count = 0 to Period-1 {
if dayLow(count) < lowVal then
lowVal = dayLow(count);
}
#### Fast StochasticsK ####
StoFastK = (C-lowVal)/(highVal-lowVal)*100;
#### Slow StochasticsK ####
Ep = 2/(Period1+1);
if date != date[1] then {
DINDEX = DINDEX + 1;
PreStoK = StoK[1];
}
if DINDEX <= 1 then
StoK = StoFastK ;
else
StoK = StoFastK * EP + PreStoK * (1-EP);
#### Slow StochasticsD ####
Ep1 = 2/(Period2+1);
if date != date[1] then {
DINDEX = DINDEX + 1;
PreStoD = StoD[1];
}
if DINDEX <= 1 then
StoD = StoK ;
else
StoD = StoK * EP1 + PreStoD * (1-EP1);
plot1(StoK);
plot2(StoD);