예스스탁
예스스탁 답변
2024-02-16 09:53:04
안녕하세요
예스스탁입니다.
1
input : ntime(30);
input : short(12),long(26),sig(9);
var : S1(0),D1(0),TM(0),TF(0),OO(0);
var : EP1(0),EP2(0),EP3(0),ii(0);
var : Pre1(0),Xma1(0),Pre2(0),Xma2(0),PreMACDS(0);
var : MACDV(0),MACDS(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
{
OO = O;
ii = ii +1;
Pre1 = xma1[1];
Pre2 = xma2[1];
PreMACDS = MACDS[1];
}
if ii <= 1 then
{
xma1 = C;
xma2 = C;
MACDV = xma1-xma2;
MACDS = MACDV;
}
else
{
xma1 = C * EP1 + Pre1 * (1-EP1);
xma2 = C * EP2 + Pre2 * (1-EP2);
MACDV = xma1-xma2;
MACDS = MACDV * EP3 + PreMACDS * (1-EP3);
}
if MarketPosition <= 0 and OO > 0 and C > OO and C > O and C[1] < O[1] and MACDV > MACDS Then
Buy();
if MarketPosition == 1 and C < O Then
ExitLong();
}
2
input : ntime(30);
input : short(12),long(26),sig(9);
var : S1(0),D1(0),TM(0),TF(0),OO(0);
var : EP1(0),EP2(0),EP3(0),ii(0);
var : Pre1(0),Xma1(0),Pre2(0),Xma2(0),PreMACDS(0);
var : MACDV(0),MACDS(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
{
OO = O;
ii = ii +1;
Pre1 = xma1[1];
Pre2 = xma2[1];
PreMACDS = MACDS[1];
}
if ii <= 1 then
{
xma1 = C;
xma2 = C;
MACDV = xma1-xma2;
MACDS = MACDV;
}
else
{
xma1 = C * EP1 + Pre1 * (1-EP1);
xma2 = C * EP2 + Pre2 * (1-EP2);
MACDV = xma1-xma2;
MACDS = MACDV * EP3 + PreMACDS * (1-EP3);
}
if MarketPosition >= 0 and OO > 0 and C < OO and C < O and C[1] > O[1] and MACDV < MACDS Then
Sell();
if MarketPosition == -1 and C > O Then
ExitShort();
}
즐거운 하루되세요
> 선물대장 님이 쓴 글입니다.
> 제목 : 문의 드립니다.
> 아래 식에서 MACD를 추가하고자 합니다.
매수 때 30분봉에서 MACD 12 26 9 선이 시그널선 위에 있을 때 아래 식을 적용하여 매수
매도 때 30분봉
에서 MACD 12 26 9 선이 시그널선 아래에 있을 때 아래 식을 적용하여 매도
부탁드립니다.
input : ntime(30);
var : S1(0),D1(0),TM(0),TF(0),OO(0);
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
{
OO = O;
}
if MarketPosition <= 0 and OO > 0 and C > OO and C > O and C[1] < O[1] Then
Buy();
if MarketPosition == 1 and C < O Then
ExitLong();
}
-------------------------------------------------------------------------------
input : ntime(30);
var : S1(0),D1(0),TM(0),TF(0),OO(0);
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
{
OO = O;
}
if MarketPosition >= 0 and OO > 0 and C < OO and C < O and C[1] > O[1] Then
Sell();
if MarketPosition == -1 and C > O Then
ExitShort();
}