커뮤니티
수식검토 부탁드립니다
2016-01-19 13:18:57
121
글번호 94536
매수조건 :
1) 일봉의 5일 이평선이하로 내려가면 바로 매수(완성봉 아니고 터치하면 매수)
2) 일봉의 10일 이평선이하로 내려가면 바로 매수(완성봉 아니고 터치하면 매수)
3) 정해진 가격(P1) 이하로 내려가면 바로 매수
4) 정해진 가격(P2) 이하로 내려가면 바로 추가 2차 매수
일봉챠트에 적용해보니 신호가 나오질 않습니다
아무래도 분봉챠트에 적용을 해야 할 것 같은데...
그러면 이평선 수식을 일봉기준으로 수정 부탁드립니다
input : 금액(2000000),기준일(20150104),P1(25200),P2(25200),Period1(5),Period2(10);
var : Xcond(false),이평1(0),이평2(0) ;
이평1 = ma(C, Period1);
이평2 = ma(C, Period2);
# 하루 한번만 진입
if date != date[1] Then
Xcond = false;
if TotalTrades > TotalTrades[1] Then
Xcond = true;
if Xcond == false then{
if sdate >= 기준일 then{
if MarketPosition == 0 and NextBarOpen >= 이평1 Then
buy("5일선매수",atlimit,이평1,Floor(금액/C));
if MarketPosition == 0 and NextBarOpen >= 이평2 Then
buy("10일선매수",atlimit,이평2,Floor(금액/C));
if MarketPosition == 0 and NextBarOpen >= P1 Then
buy("1차매수",atlimit,P1,Floor(금액/C));
if MarketPosition == 1 and MaxEntries < 3 Then{
if NextBarOpen >= P2 Then
buy("2차매수",atlimit,P1,Floor(금액/C));
if MaxEntries == 1 Then
ExitLong("BP1",atlimit,AvgEntryPrice*1.02);
if MaxEntries == 2 Then
ExitLong("BP2",atlimit,AvgEntryPrice*1.015);
if MaxEntries == 3 Then{
ExitLong("BP3",atlimit,AvgEntryPrice*1.01);
ExitLong("Bx",AtStop,LatestEntryPrice(0)*0.97);
}
}
}
}
답변 1
예스스탁 예스스탁 답변
2016-01-19 20:00:30
안녕하세요
예스스탁입니다.
input : 금액(2000000),기준일(20150104),P1(25200),P2(25200),Period1(5),Period2(10);
var : Xcond(false),cnt(0),sum1(0),sum2(0),이평1(0),이평2(0) ;
sum1 = 0;
sum2 = 0;
for cnt = 0 to Period2{
if cnt < Period1 Then
sum1 = sum1 + DayClose(cnt);
if cnt < Period2 Then
sum2 = sum2 + DayClose(cnt);
}
이평1 = sum1/Period1;
이평2 = sum2/Period2;
# 하루 한번만 진입
if date != date[1] Then
Xcond = false;
if TotalTrades > TotalTrades[1] Then
Xcond = true;
if Xcond == false then{
if sdate >= 기준일 then{
if MarketPosition == 0 and NextBarOpen >= 이평1 Then
buy("5일선매수",atlimit,이평1,Floor(금액/C));
if MarketPosition == 0 and NextBarOpen >= 이평2 Then
buy("10일선매수",atlimit,이평2,Floor(금액/C));
if MarketPosition == 0 and NextBarOpen >= P1 Then
buy("1차매수",atlimit,P1,Floor(금액/C));
if MarketPosition == 1 and MaxEntries < 3 Then{
if NextBarOpen >= P2 Then
buy("2차매수",atlimit,P1,Floor(금액/C));
if MaxEntries == 1 Then
ExitLong("BP1",atlimit,AvgEntryPrice*1.02);
if MaxEntries == 2 Then
ExitLong("BP2",atlimit,AvgEntryPrice*1.015);
if MaxEntries == 3 Then{
ExitLong("BP3",atlimit,AvgEntryPrice*1.01);
ExitLong("Bx",AtStop,LatestEntryPrice(0)*0.97);
}
}
}
}
즐거운 하루되세요
> 뽄때 님이 쓴 글입니다.
> 제목 : 수식검토 부탁드립니다
> 매수조건 :
1) 일봉의 5일 이평선이하로 내려가면 바로 매수(완성봉 아니고 터치하면 매수)
2) 일봉의 10일 이평선이하로 내려가면 바로 매수(완성봉 아니고 터치하면 매수)
3) 정해진 가격(P1) 이하로 내려가면 바로 매수
4) 정해진 가격(P2) 이하로 내려가면 바로 추가 2차 매수
일봉챠트에 적용해보니 신호가 나오질 않습니다
아무래도 분봉챠트에 적용을 해야 할 것 같은데...
그러면 이평선 수식을 일봉기준으로 수정 부탁드립니다
input : 금액(2000000),기준일(20150104),P1(25200),P2(25200),Period1(5),Period2(10);
var : Xcond(false),이평1(0),이평2(0) ;
이평1 = ma(C, Period1);
이평2 = ma(C, Period2);
# 하루 한번만 진입
if date != date[1] Then
Xcond = false;
if TotalTrades > TotalTrades[1] Then
Xcond = true;
if Xcond == false then{
if sdate >= 기준일 then{
if MarketPosition == 0 and NextBarOpen >= 이평1 Then
buy("5일선매수",atlimit,이평1,Floor(금액/C));
if MarketPosition == 0 and NextBarOpen >= 이평2 Then
buy("10일선매수",atlimit,이평2,Floor(금액/C));
if MarketPosition == 0 and NextBarOpen >= P1 Then
buy("1차매수",atlimit,P1,Floor(금액/C));
if MarketPosition == 1 and MaxEntries < 3 Then{
if NextBarOpen >= P2 Then
buy("2차매수",atlimit,P1,Floor(금액/C));
if MaxEntries == 1 Then
ExitLong("BP1",atlimit,AvgEntryPrice*1.02);
if MaxEntries == 2 Then
ExitLong("BP2",atlimit,AvgEntryPrice*1.015);
if MaxEntries == 3 Then{
ExitLong("BP3",atlimit,AvgEntryPrice*1.01);
ExitLong("Bx",AtStop,LatestEntryPrice(0)*0.97);
}
}
}
}
다음글
이전글