글 수 16
키움증권 시스템트레이딩 분봉매매 예제
매매의 원칙은 2.5% 손절을 한다.(수수료 포함 3%를 넘기지 않는다는 것이 원칙)
매수진입
현재가가 5봉, 10봉, 20봉 이동평균선 위에 있고,
20봉 이동평균선이 120봉 이동평균선 위에 있으며
현재가와 5봉 이동평균선의 이격차가 3% 미만이고,
5봉,20봉,60봉 이동평균선은 우상향 하여야만 매수한다.
c > avg(c,5)
and
c > avg(c,10)
and
c > avg(c,20)
and
avg(c,20) > avg(c,120)
and
c*0.03 > c-avg(c,5)
and
0 < (avg(c,5)-avg(c,5,1))
and
0 < (avg(c,20)-avg(c,20,1))
and
0 < (avg(c,60)-avg(c,60,1))
매수청산
20봉 이동평균선을 이탈하거나 5봉 이동평균선이 20봉 이동평균선을 하향 이탈할 경우 매도한다.
c < avg(c,20) or avg(c,5) < avg(c,20)
2009.11.05 15:01:44 (*.186.243.3)
c > avg(c,5)
and
c > avg(c,10)
and
c > avg(c,20)
and
avg(c,20) > avg(c,120)
and
c*0.03 > c-avg(c,5)
and
0 < (avg(c,5)-avg(c,5,1))
and
0 < (avg(c,20)-avg(c,20,1))
and
0 < (avg(c,60)-avg(c,60,1))
2009.11.05 15:36:29 (*.186.243.3)
대신꺼 예제
if close > mov(close,5,s) And _
close > mov(close,10,s) And _
close > mov(close,20,s) And _
mov(close,20,s) > mov(close,120,s) And _
close*0.03 > close-mov(close,5,s) And _
0 < (mov(close,5,s)-mov(close,5,s,1)) And _
0 < (mov(close,20,s)-mov(close,20,s,1)) And _
0 < (mov(close,60,s)-mov(close,60,s,1)) then
call buy("buy",AtMarket)
if close < mov(close,20,s) Or mov(close,5,s) < mov(close,20,s) Or close < EntryPrice-EntryPrice*0.03 then
call buy("buy",AtMarket)
2009.11.06 18:42:35 (*.186.243.3)
'해당문제를 해결하는 방법은 여러가지가 있으나 일반적으로 shift방법을 이용합니다
'즉 현재의 이평선과 이평선을 특정일간 이동시킨 이평선간의 관계를 이용합니다
settestmode
Var3 = close*0.03 > close-mov(close,5,s)
Var4 = 0 < (mov(close,5,s)-mov(close,5,s,1))
Var5 = 0 < (mov(close,20,s)-mov(close,20,s,1))
Var6 = 0 < (mov(close,60,s)-mov(close,60,s,1))
Var7 = close < mov(close,20,s)
Var8 = mov(close,5,s) < mov(close,20,s)
If mov5 = True And mov10 = True And mov20 = True And cross20120 = True And _
Var3 = True And Var4 = True And Var5 = True And Var6 = True Then
Call buy("Buy",Atmarket,Contracts)
End If
If Var7=True Or Var8 = True Or losscut = True Then
Call ExitLong("ExitLong",Atmarket,Contracts)
End If