//기본차트 MACD
macdv = macd(short,long);
macds = Ema(macdv,sig);
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;
TF1 = TM%분1;
TF2 = TM%분2;
//15분봉 MACD
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and 분1 > 1 and TF1 < TF1[1]) or
(Bdate == Bdate[1] and 분1 > 1 and TM >= TM[1]+분1) or
(Bdate == Bdate[1] and 분1 == 1 and TM > TM[1]) Then
{
i1 = i1 + 1;
Prexma11 = xma11[1];
Prexma12 = xma12[1];
PreMACDS1 = MACDS1[1];
}
if i1 <= 1 then
{
xma11 = C;
xma12 = C;
MACDV1 = xma11-xma12;
MACDS1 = MACDV1;
}
else
{
xma11 = C * EP1 + Prexma11 * (1-EP1);
xma12 = C * EP2 + Prexma12 * (1-EP2);
MACDV1 = xma11-xma12;
MACDS1 = MACDV1 * EP3 + PreMACDS1 * (1-EP3);
}
//20분봉 MACD
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and 분2 > 1 and TF2 < TF2[1]) or
(Bdate == Bdate[1] and 분2 > 1 and TM >= TM[1]+분2) or
(Bdate == Bdate[1] and 분2 == 1 and TM > TM[1]) Then
{
i2 = i2 + 1;
Prexma21 = xma11[1];
Prexma22 = xma12[1];
PreMACDS2 = MACDS2[1];
}
if i2 <= 1 then
{
xma21 = C;
xma22 = C;
MACDV2 = xma21-xma22;
MACDS2 = MACDV2;
}
else
{
xma21 = C * EP1 + Prexma21 * (1-EP1);
xma22 = C * EP2 + Prexma22 * (1-EP2);
MACDV2 = xma21-xma22;
MACDS2 = MACDV2 * EP3 + PreMACDS2 * (1-EP3);
}
시간 변경은 어떻게하나요?
예) 현재차트 60분봉
15분봉--->120분봉
20분봉--->240분봉
답변 1
예스스탁
예스스탁 답변
2023-06-21 10:40:19
안녕하세요
예스스탁입니다.
input : 분1(15),분2(20);
이전 답변드린 수식에 위와 같이 다른주기의 분을 지정하는 외부변수가 있습니다.
해당 외부변수값을 변경하시면 됩니다.
기본차트를 60분으로 지정하시고
분1은 120, 분2는 240으로 지정하시면 됩니다.
즐거운 하루되세요
> 탱탱볼 님이 쓴 글입니다.
> 제목 : 문의드립니다
> //기본차트 MACD
macdv = macd(short,long);
macds = Ema(macdv,sig);
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;
TF1 = TM%분1;
TF2 = TM%분2;
//15분봉 MACD
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and 분1 > 1 and TF1 < TF1[1]) or
(Bdate == Bdate[1] and 분1 > 1 and TM >= TM[1]+분1) or
(Bdate == Bdate[1] and 분1 == 1 and TM > TM[1]) Then
{
i1 = i1 + 1;
Prexma11 = xma11[1];
Prexma12 = xma12[1];
PreMACDS1 = MACDS1[1];
}
if i1 <= 1 then
{
xma11 = C;
xma12 = C;
MACDV1 = xma11-xma12;
MACDS1 = MACDV1;
}
else
{
xma11 = C * EP1 + Prexma11 * (1-EP1);
xma12 = C * EP2 + Prexma12 * (1-EP2);
MACDV1 = xma11-xma12;
MACDS1 = MACDV1 * EP3 + PreMACDS1 * (1-EP3);
}
//20분봉 MACD
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and 분2 > 1 and TF2 < TF2[1]) or
(Bdate == Bdate[1] and 분2 > 1 and TM >= TM[1]+분2) or
(Bdate == Bdate[1] and 분2 == 1 and TM > TM[1]) Then
{
i2 = i2 + 1;
Prexma21 = xma11[1];
Prexma22 = xma12[1];
PreMACDS2 = MACDS2[1];
}
if i2 <= 1 then
{
xma21 = C;
xma22 = C;
MACDV2 = xma21-xma22;
MACDS2 = MACDV2;
}
else
{
xma21 = C * EP1 + Prexma21 * (1-EP1);
xma22 = C * EP2 + Prexma22 * (1-EP2);
MACDV2 = xma21-xma22;
MACDS2 = MACDV2 * EP3 + PreMACDS2 * (1-EP3);
}
시간 변경은 어떻게하나요?
예) 현재차트 60분봉
15분봉--->120분봉
20분봉--->240분봉