커뮤니티
수식 질문입니다.
2009-06-29 20:12:52
658
글번호 23135
30 MBO 이고요,
시각 기준이 아닌 당일 첫봉부터 봉번호로 매기고,
당일 1회만 진입하는 식인데, 안되네요...ㅠㅠ
도와주세요.
input: input1(6);
var: value98(0), value99(0), month(0), dayofmonth(0), cnt(0);
month = int((sdate/10000)*100);
dayofmonth = FracPortion(sdate/100)*100;
If month==1 and DayOfMonth==2 and value99==24 then
value98=value98-12;
If date<>date[1] then {
value98 = currentbar - 1;
value99 = currentbar - value98;
var10 = CurrentEntries();
}
cnt = CurrentEntries - var10;
IF sDate>=20050101 and Sdate<=20071231 then {
If value99>=input1 and value99<72 and cnt<1 then {
buy("매수", atstop, DayHigh(0));
sell("매도", atstop, DayLow(0));
}
SetStopEndofday();
}
답변 1
예스스탁 예스스탁 답변
2009-06-30 09:05:21
안녕하세요
예스스탁입니다.
봉번호는 dayindex라는 함수로 제공되고 있습니다.
당일 첫봉을 0으로 1씩증가하니 dayindex+1하시면 당일 봉갯수를 샐수 있습니다.
input: input1(6);
var : count(0);
# 당일 진입횟수 계산
count = 0;
for var1 = 0 to 10{
if sdate == EntryDate(var1) Then
count = count+1;
}
var2 = dayindex+1; ## 당일 봉갯수
IF sDate>=20050101 and Sdate<=20071231 then {
If var2 >=input1 and var2 < 72 and count<1 then {
buy("매수", atstop, DayHigh(0));
sell("매도", atstop, DayLow(0));
}
}
SetStopEndofday(150000);
SetStopEndofday는 당일 청산함수로 시간을 넣어주셔야 합니다.
SetStopEndofday()는 종가청산인데 시뮬레이션에서만 의미가 있습니다.
즐거운 하루되세요
> 도화지 님이 쓴 글입니다.
> 제목 : 수식 질문입니다.
>
30 MBO 이고요,
시각 기준이 아닌 당일 첫봉부터 봉번호로 매기고,
당일 1회만 진입하는 식인데, 안되네요...ㅠㅠ
도와주세요.
input: input1(6);
var: value98(0), value99(0), month(0), dayofmonth(0), cnt(0);
month = int((sdate/10000)*100);
dayofmonth = FracPortion(sdate/100)*100;
If month==1 and DayOfMonth==2 and value99==24 then
value98=value98-12;
If date<>date[1] then {
value98 = currentbar - 1;
value99 = currentbar - value98;
var10 = CurrentEntries();
}
cnt = CurrentEntries - var10;
IF sDate>=20050101 and Sdate<=20071231 then {
If value99>=input1 and value99<72 and cnt<1 then {
buy("매수", atstop, DayHigh(0));
sell("매도", atstop, DayLow(0));
}
SetStopEndofday();
}
다음글
이전글