커뮤니티
수식문의
2015-05-12 20:38:08
145
글번호 85955
수식문의 입니다.
일반조건:일차와 이차로 나눠서 진입하고 청산도 각각 하는것으로 했으면 합니다.
매수조건
일차:어제 종가가 5일선 위에서 마감하였을경우
오늘 시가에서 매수한다.
이차:매수후 0.5p수익나는 시점에서 재매수한다.
청산조건
일차매수부분:당일종가청산(150400)또는 손절-1.5p
이차매수부분:손절-1p 또는 당일종가 청산(150400)
매도조건은 매수조건과 반대로 부탁드립니다.
답변 1
예스스탁 예스스탁 답변
2015-05-13 16:37:55
안녕하세요
예스스탁입니다.
input : P1(5);
var : sumV(0), maV(0),cnt(0), count(0);
#일봉이평 계산
sumV = 0;
count = 0;
for cnt = 0 to P1-1 {
sumV = sumV+DayClose(cnt);
if sdate == EntryDate(cnt) Then
count = count+1;
}
maV = sumV / P1;
if MarketPosition == 0 and stime == 151500 and C > maV Then{
buy("B1",AtMarket);
buy("BB1",AtStop,NextBarOpen+0.5);
}
if MarketPosition == 1 Then{
if CurrentEntries == 1 and dayhigh < dayopen+0.5 then{
buy("BB2",AtStop,dayopen+0.5);
}
exitlong("BL",AtStop,dayopen-1.5,"B1");
if MaxEntries == 2 Then{
exitlong("BL1",AtStop,LatestEntryPrice(0)-1.0,"BB1");
exitlong("BL2",AtStop,LatestEntryPrice(0)-1.0,"BB2");
}
}
if MarketPosition == 0 and stime == 151500 and C < maV Then{
Sell("S1",AtMarket);
Sell("SS1",AtStop,NextBarOpen-0.5);
}
if MarketPosition == -1 Then{
if CurrentEntries == 1 and daylow > dayopen-0.5 then{
sell("SS2",AtStop,dayopen-0.5);
}
ExitShort("SL",AtStop,dayopen+1.5,"S1");
if MaxEntries == 2 Then{
ExitShort("SL1",AtStop,dayopen+1.0,"SS1");
ExitShort("SL2",AtStop,dayopen+1.0,"SS2");
}
}
SetStopEndofday(150400);
즐거운 하루되세요
> HI_yj**** 님이 쓴 글입니다.
> 제목 : 수식문의
> 수식문의 입니다.
일반조건:일차와 이차로 나눠서 진입하고 청산도 각각 하는것으로 했으면 합니다.
매수조건
일차:어제 종가가 5일선 위에서 마감하였을경우
오늘 시가에서 매수한다.
이차:매수후 0.5p수익나는 시점에서 재매수한다.
청산조건
일차매수부분:당일종가청산(150400)또는 손절-1.5p
이차매수부분:손절-1p 또는 당일종가 청산(150400)
매도조건은 매수조건과 반대로 부탁드립니다.
다음글
이전글