예스스탁
예스스탁 답변
2023-06-20 13:37:18
안녕하세요
예스스탁입니다.
input : 분1(15),분2(20);
input : short(12),long(26),sig(9);
var : S1(0),D1(0),TM(0),EP1(0),EP2(0),EP3(0);
var : macdv(0),macds(0);
var : TF1(0),i1(0),xma11(0),xma12(0),Prexma11(0),Prexma12(0),MACDV1(0),MACDS1(0),PreMACDS1(0);
var : TF2(0),i2(0),xma21(0),xma22(0),Prexma21(0),Prexma22(0),MACDV2(0),MACDS2(0),PreMACDS2(0);
//기본차트 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);
}
if macdv1 > 0 and CrossUp(macdv,0) Then
Buy();
if macdv1 > 0 and CrossDown(macdv,0) Then
Sell();
if CrossDown(macdv1,0) Then
Sell();
if macdv2 < 0 and macdv1 > 0 and CrossDown(macdv1,macds2) Then
Sell();
if macdv2 < 0 and macdv1 > 0 and CrossUp(macdv1,macds2) and macdv > 0 Then
Buy();
}
즐거운 하루되세요
> 탱탱볼 님이 쓴 글입니다.
> 제목 : 문의드립니다
> macd 5분봉과 macd 15분봉 macd 20분봉 조합
Input: shortperiod(12), longperiod(24), sig(9);
var: signal(0), value(0);
value = macd(shortperiod, longperiod);
Signal = Ema(value, sig);
15분봉 macd > 0 and 5분봉 CrossUP(value, 0)매수
15분봉 macd > 0 and 5분봉 CrossDown(value, 0)매도
15분봉 CrossDown(value, 0) 매도
20분봉 macd < 0 and 15분봉 macd > 0 and 15분봉 CrossDown(value, signal) 상황시 매도후 대기
20분봉 macd < 0 and 15분봉 macd > 0 and 15분봉 CrossUp(value, signal) 상황시 15분봉 macd > 0 and 5분봉 macd > 0 매수
감사합니다.