커뮤니티
함수문의
2004-01-17 20:47:42
2351
글번호 2031
다음 함수 로직이 맞는지 문의 드립니다
timelow,timehigh 함수인데 물론 예스트레이더에서 기본적으로 내장된 줄은 알지만 궁금해서 문의 합니다.
input : startime(numericsimple), endtime(numericsimple);
if d <> d[1] then value1 = 0;
if time = startime then value1 = close;
if time > startime and time <= endtime then begin
if value1 > low then value1 = low;
end;
timelow = value1;
input : startime(numericsimple), endtime(numericsimple);
if d <> d[1] then value1 = 0;
if time = startime then value1 = close;
if time > startime and time <= endtime then begin
if value1 < high then value1 = high;
end;
timehigh = value1;
답변 1
예스스탁 예스스탁 답변
2004-01-19 12:58:33
안녕하세요..예스스탁입니다.
작성하신 내용중에 문법이 잘못된 부분이 있어서 다시 사용자함수로 작성해 보았습니다.
사용자함수명
_timelow
사용자함수식
input : startime(numeric), endtime(numeric);
var : value1(0);
if date != date[1] then
var1 = 0;
if stime >= startime and var1 == 0 then {
value1 = low;
var1 = var1+1;
}
if stime >= startime and stime <= endtime then begin
if value1 >= low then
value1 = low;
end;
_timelow = value1;
사용자함수명
_timehigh
사용자함수식
input : startime(numeric), endtime(numeric);
var : value1(0);
if date != date[1] then
var1 = 0;
if stime >= startime and var1 == 0 then {
value1 = high;
var1 = var1+1;
}
if stime >= startime and stime <= endtime then begin
if value1 <= high then
value1 = high;
end;
_timehigh = value1;
YesLanguage에서 'D' 로 나타내는 데이타변수는 없습니다. 만일 날짜가 변경되는 시점에서 값을 초기화 하기 위한 것이라면
if date != date[1] then ~ 과 같이 작성하셔야 됩니다. 또 '같지않다'를 표현할때 '<>'로 쓰이는 것이 아니라 '!='로 쓰입니다.
사용자함수식 제목에 '_'를 붙인 이유는 timehigh나 timelow는 내장되어 있는 함수라서 함수의 이름으로 쓸 수 없기 때문에 under bar를 붙였습니다.
그리고 작성하신 식에서 if stime == startime then value1 = close 와 같이 작성하면
startime이 없는 경우, 예를들어 수능시험일이나 년초 개장일 처럼 10시에 시작되는 경우, 내장된 timehigh나 timelow와 다르게 그려지는 현상이 있어서 위 내용처럼 수정하였습니다.
즐거운 날 되세요..
> CJ_song0613 님이 쓴 글입니다.
> 제목 : 함수문의
> 다음 함수 로직이 맞는지 문의 드립니다
timelow,timehigh 함수인데 물론 예스트레이더에서 기본적으로 내장된 줄은 알지만 궁금해서 문의 합니다.
input : startime(numericsimple), endtime(numericsimple);
if d <> d[1] then value1 = 0;
if time = startime then value1 = close;
if time > startime and time <= endtime then begin
if value1 > low then value1 = low;
end;
timelow = value1;
input : startime(numericsimple), endtime(numericsimple);
if d <> d[1] then value1 = 0;
if time = startime then value1 = close;
if time > startime and time <= endtime then begin
if value1 < high then value1 = high;
end;
timehigh = value1;
다음글
이전글