커뮤니티
수식 수정 부탁합니다
2016-01-09 16:56:43
120
글번호 94253
항상 도움을 주셔서 감사합니다
아래의 수식에서 1차까지 매수되든, 2차까지 매수되든, 3차까지 매수가 되든지 간에
일단 매도1, 매도2, 매도3이 발생하면 당일에 더이상 진입을 하지 못하도록
수식변경 부탁드립니다.
input : 금액(2100000),기준일(20151105);
var1 = (DayOpen(1)+DayClose(1))/2;
var2 = (var1+DayClose(1))/2;
var3 = (var1+DayOpen(1))/2;
if sdate >= 기준일 then{
if MarketPosition == 0 and NextBarOpen >= var2
# and dayopen > DayClose(1)
and stime < 120000
Then buy("1차매수",atlimit,var2,Floor(금액/C));
# 전일 평균가에 오면 2차매수
if MarketPosition == 1 and MaxEntries < 3 Then{
if NextBarOpen >= var1 Then
buy("2차매수",AtLimit,var1,Floor(금액/C));
if NextBarOpen >= var3 Then
buy("3차매수",AtLimit,var3,Floor(금액/C));
# 각각의 평단가보다 2.4%, 1.5%, 1% 오르면 매도
if MaxEntries == 1 Then
ExitLong("매도1",atlimit,AvgEntryPrice*1.024);
if MaxEntries == 2 Then
ExitLong("매도2",atlimit,AvgEntryPrice*1.015);
if MaxEntries == 3 Then{
ExitLong("매도3",atlimit,AvgEntryPrice*1.01);
ExitLong("전량매도",AtStop,LatestEntryPrice(0)*0.97);
}
}
}
SetStopEndofday(140000);
답변 1
예스스탁 예스스탁 답변
2016-01-11 10:09:48
안녕하세요
예스스탁입니다.
input : 금액(2100000),기준일(20151105);
var : Xcond(false);
var1 = (DayOpen(1)+DayClose(1))/2;
var2 = (var1+DayClose(1))/2;
var3 = (var1+DayOpen(1))/2;
if date != date[1] Then
Xcond = false;
if TotalTrades > TotalTrades[1] Then
Xcond = true;
if sdate >= 기준일 and Xcond == false then{
if MarketPosition == 0 and NextBarOpen >= var2
#and dayopen > DayClose(1)
and stime < 120000
Then buy("1차매수",atlimit,var2,Floor(금액/C));
# 전일 평균가에 오면 2차매수
if MarketPosition == 1 and MaxEntries < 3 Then{
if NextBarOpen >= var1 Then
buy("2차매수",AtLimit,var1,Floor(금액/C));
if NextBarOpen >= var3 Then
buy("3차매수",AtLimit,var3,Floor(금액/C));
# 각각의 평단가보다 2.4%, 1.5%, 1% 오르면 매도
if MaxEntries == 1 Then
ExitLong("매도1",atlimit,AvgEntryPrice*1.024);
if MaxEntries == 2 Then
ExitLong("매도2",atlimit,AvgEntryPrice*1.015);
if MaxEntries == 3 Then{
ExitLong("매도3",atlimit,AvgEntryPrice*1.01);
ExitLong("전량매도",AtStop,LatestEntryPrice(0)*0.97);
}
}
}
SetStopEndofday(140000);
즐거운 하루되세요
> 뽄때 님이 쓴 글입니다.
> 제목 : 수식 수정 부탁합니다
> 항상 도움을 주셔서 감사합니다
아래의 수식에서 1차까지 매수되든, 2차까지 매수되든, 3차까지 매수가 되든지 간에
일단 매도1, 매도2, 매도3이 발생하면 당일에 더이상 진입을 하지 못하도록
수식변경 부탁드립니다.
input : 금액(2100000),기준일(20151105);
var1 = (DayOpen(1)+DayClose(1))/2;
var2 = (var1+DayClose(1))/2;
var3 = (var1+DayOpen(1))/2;
if sdate >= 기준일 then{
if MarketPosition == 0 and NextBarOpen >= var2
# and dayopen > DayClose(1)
and stime < 120000
Then buy("1차매수",atlimit,var2,Floor(금액/C));
# 전일 평균가에 오면 2차매수
if MarketPosition == 1 and MaxEntries < 3 Then{
if NextBarOpen >= var1 Then
buy("2차매수",AtLimit,var1,Floor(금액/C));
if NextBarOpen >= var3 Then
buy("3차매수",AtLimit,var3,Floor(금액/C));
# 각각의 평단가보다 2.4%, 1.5%, 1% 오르면 매도
if MaxEntries == 1 Then
ExitLong("매도1",atlimit,AvgEntryPrice*1.024);
if MaxEntries == 2 Then
ExitLong("매도2",atlimit,AvgEntryPrice*1.015);
if MaxEntries == 3 Then{
ExitLong("매도3",atlimit,AvgEntryPrice*1.01);
ExitLong("전량매도",AtStop,LatestEntryPrice(0)*0.97);
}
}
}
SetStopEndofday(140000);
다음글
이전글