커뮤니티
수식좀 부탁드립니다.
2011-12-08 12:54:44
453
글번호 45598
일봉차트의 macd가 상승중일때에만 60분봉macd크로스매매식좀 부탁드립니다.
그리고 일봉 스톡이 상승시에만 60분봉 스톡크로스 매매식도 부탁드립니다.
답변 1
예스스탁 예스스탁 답변
2011-12-08 15:44:11
안녕하세요
예스스탁입니다.
1.
Input : Period1(12), Period2(26), Period3(9);
Var : Ep1(0), EP2(0), EP3(0), JISU1(0), JISU2(0), PreJISU1(0), PreJISU2(0);
Var : macdVal(0), preMacdVal(0), macdSig(0),macdOsc(0),PremacdOsc(0),PreMacdSig(0);
if date != date[1] then {
PreJISU1 = JISU1[1];
PreJISU2 = JISU2[1];
PreMacdVal = macdVal[1];
PreMacdSig = macdSig[1];
PRemacdOsc = macdOsc[1];
}
Ep1 = 2/(Period1+1);
EP2 = 2/(Period2+1);
EP3 = 2/(Period3+1);
JISU1 = C * Ep1 + PreJISU1 * (1-Ep1); //단기지수이동평균
JISU2 = C * Ep2 + PreJISU2 * (1-Ep2); //장기지수이동평균
macdVal = JISU1 - JISU2; //macd
macdSig = macdVal * Ep3 + PreMacdSig * (1-Ep3); //macd signal
macdOsc = macdval-macdsig;
var1 = MACD(Period1,Period2);
var2 = ema(var1,Period3);
if MACDval > PreMacdVal Then{
if crossup(var1,var2) Then
buy();
if CrossDown(var1,var2) Then
Sell();
}
2.
input : Period(20), Period1(12), Period2(12);
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);
#### Slow StochasticsD ####
Ep1 = 2/(Period2+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);
if date != date[1] then {
DINDEX = DINDEX + 1;
PreStoD = StoD[1];
}
if DINDEX <= 1 then
StoD = StoK ;
else
StoD = StoK * EP1 + PreStoD * (1-EP1);
var1 = StochasticsK(Period,Period1);
var2 = StochasticsD(Period,Period1,Period2);
if StoK > PreStok then{
if crossup(var1,var2) Then
buy();
if crossdown(var1,var2) Then
sell
}
즐거운 하루되세요
> 김태형 님이 쓴 글입니다.
> 제목 : 수식좀 부탁드립니다.
> 일봉차트의 macd가 상승중일때에만 60분봉macd크로스매매식좀 부탁드립니다.
그리고 일봉 스톡이 상승시에만 60분봉 스톡크로스 매매식도 부탁드립니다.