예스스탁
예스스탁 답변
2023-04-07 10:42:55
안녕하세요
예스스탁입니다.
5분차트에 적용하시면 됩니다.
input : 분(10),short(10),long(20),sig(5);
var : S1(0),D1(0),TM(0),EP1(0),EP2(0),EP3(0);
var : macdv(0),macds(0);
var : TF1(0),ii(0),xma1(0),xma2(0),Prexma1(0),Prexma2(0);
var : MACDV1(0),MACDS1(0),PreMACDV1(0),PreMACDS1(0);
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%분;
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and 분 > 1 and TF1 < TF1[1]) or
(Bdate == Bdate[1] and 분 > 1 and TM >= TM[1]+분) or
(Bdate == Bdate[1] and 분 == 1 and TM > TM[1]) Then
{
ii = ii + 1;
Prexma1 = xma1[1];
Prexma2 = xma2[1];
PreMACDV1 = MACDV1[1];
PreMACDS1 = MACDS1[1];
}
if ii <= 1 then
{
xma1 = C;
xma2 = C;
MACDV1 = xma1-xma2;
MACDS1 = MACDV1;
}
else{
xma1 = C * EP1 + Prexma1 * (1-EP1);
xma2 = C * EP2 + Prexma2 * (1-EP2);
MACDV1 = xma1-xma2;
MACDS1 = MACDV1 * EP3 + PreMACDS1 * (1-EP3);
}
if MarketPosition <= 0 and MACDV1 > MACDS and PreMACDV1 < PreMACDS1 Then
Buy();
if MarketPosition == 1 and CrossDown(macdv,macds) Then
ExitLong();
if MarketPosition >= 0 and MACDV1 < MACDS and PreMACDV1 > PreMACDS1 Then
Sell();
if MarketPosition == -1 and CrossUp(macdv,macds) Then
ExitShort();
}
즐거운 하루되세요
> 신들의전쟁 님이 쓴 글입니다.
> 제목 : MAcd
> 안녕하세요
macd 10,20,5 를 이용하여 변수요청
10분차트 상승교차 매수 하여
5분차트 하락교차 청산한다
10분차트 하락교차 매도 하여
5분차트 상승교차 청산한다
감사합니다