답변완료
print문의 오류
아래 프로그램에서 state2.txt 로 보면 state가 0,1,2,3 등으로 변하고 있는데
실제 state.txt에는 프린트가 되지 않습니다.
참고로 생성화일은 콜옵션 247.5로 돌린 것 입니다.
=============== 프로그램 ============
#선물의 하루 최대 최소 차이점
# Index : 봉의 번호
# sDate : 봉의 시작 날짜
# date : 봉의 끝 날짜
# time : 봉의 끝 시간(103020) 10시30분20초
# Open : 시가
# High : 고가
# Low : 저가
# Close : 종가
# Volume : 거래량
# Money : 거래 대금
# openinterest : 미결제 약정
# Bids : 매수 총잔량
# asks : 매도 총잔량
# ticks : 체결건수
# upticks : 상승형 체결건수
# downticks : 하락형 체결건수
# upvol : 상승형 체결거래량
# downvol : 하락형 체결거래량
# baseprice : 기준가
variables : v_i(0),state(0),v_close(0),rate(0.95),num(1),next_state(0);
arrays : av_price[20](0);
if(index >2 ) then {
state = next_state[1];
next_state = next_state[1];
}
print("state2.txt","index = %6.0f state %4.0f close:%2.2f",index,state,close);
if(time<90130) then {
state = 0;
next_state = 0;
}
if(state==0) then { /* initialization */
if( time > 90130 && date == 20070718 ) then { /* Transition to trading */
next_state = 1;
print("state.txt","state %4.0f",state);
av_price[0] = Close;
For v_i=1 to 19 {
av_price[v_i] = av_price[v_i-1]*rate;
}
For v_i=0 to 19 { /*소수점 두 째 짜리까지로 라운드 */
av_price[v_i] = round(av_price[v_i],2);
print("price222.txt","price:%2.2f %.0f %",av_price[v_i],state);
}
}
} else if(state == 1) then {
if(close<=av_price[state]) then { /*Transit to next state */
next_state = state+1;
print("state.txt","state %4.0f",next_state);
buy("b1",Onclose,DEF,num);
}
if(close>=av_price[state-1]) then {
next_state = 1001;
print("state.txt","state %4.0f",next_state);
}
} else if(state == 2) then {
if(close<=av_price[state]) then { /*Transit to next state */
next_state = state+1;
print("state.txt","state %4.0f",next_state);
buy("b2",Onclose,DEF,1);
}
if(close>=av_price[state-2]) then {
next_state = state-1;
print("state.txt","state %4.0f",next_state);
Exitlong("s2",Onclose,DEF,"b1",num,1);
}
} else if(state ==3) then {
if(close<=av_price[state]) then { /*Transit to next state */
next_state = state+1;
print("state.txt","state %4.0f",next_state);
buy("b3",Onclose,DEF,num);
}
if(close>=av_price[state-2]) then {
next_state = state-1;
print("state.txt","state %4.0f",next_state);
Exitlong("s3",Onclose,DEF,"b2",num,1);
}
} else if(state ==4) then {
if(close<=av_price[state]) then { /*Transit to next state */
next_state = state+1;
print("state.txt","state %4.0f",next_state);
buy("b4",Onclose,DEF,num);
}
if(close>=av_price[state-2]) then {
next_state = state-1;
print("state.txt","state %4.0f",next_state);
Exitlong("s4",Onclose,DEF,"b3",num,1);
}
} else if(state ==5) then {
if(close<=av_price[state]) then { /*Transit to next state */
next_state =state+1;
print("state.txt","state %4.0f",next_state);
buy("b5",Onclose,DEF,num);
}
if(close>=av_price[state-2]) then {
next_state =state-1;
print("state.txt","state %4.0f",next_state);
Exitlong("s5",Onclose,DEF,"b4",num,1);
}
}else if(state ==6) then {
if(close<=av_price[state]) then { /*Transit to next state */
next_state =state+1;
print("state.txt","state %4.0f",next_state);
buy("b6",Onclose,DEF,num);
}
if(close>=av_price[state-2]) then {
next_state =state-1;
print("state.txt","state %4.0f",next_state);
Exitlong("s6",Onclose,DEF,"b5",num,1);
}
}else if(state ==7) then {
if(close<=av_price[state]) then { /*Transit to next state */
next_state =state+1;
print("state.txt","state %4.0f",next_state);
buy("b7",Onclose,DEF,num);
}
if(close>=av_price[state-2]) then {
next_state =state-1;
print("state.txt","state %4.0f",next_state);
Exitlong("s7",Onclose,DEF,"b6",num,1);
}
}else if(state ==8) then {
if(close<=av_price[state]) then { /*Transit to next state */
next_state =state+1;
print("state.txt","state %4.0f",next_state);
buy("b8",Onclose,DEF,num);
}
if(close>=av_price[state-2]) then {
next_state =state-1;
print("state.txt","state %4.0f",next_state);
Exitlong("s8",Onclose,DEF,"b7",num,1);
}
}else if(state ==9) then {
if(close<=av_price[state]) then { /*Transit to next state */
next_state =state+1;
print("state.txt","state %4.0f",next_state);
buy("b9",Onclose,DEF,num);
}
if(close>=av_price[state-2]) then {
next_state =state-1;
print("state.txt","state %4.0f",next_state);
Exitlong("s9",Onclose,DEF,"b8",num,1);
}
}else if(state ==10) then {
if(close<=av_price[state]) then { /*Transit to next state */
next_state =state+1;
print("state.txt","state %4.0f",next_state);
buy("b10",Onclose,DEF,num);
}
if(close>=av_price[state-2]) then {
next_state =state-1;
print("state.txt","state %4.0f",next_state);
Exitlong("s10",Onclose,DEF,"b9",num,1);
}
} else if(state ==11) then {
if(close<=av_price[state]) then { /*Transit to next state */
next_state =state+1;
print("state.txt","state %4.0f",next_state);
buy("b11",Onclose,DEF,num);
}
if(close>=av_price[state-2]) then {
next_state =state-1;
print("state.txt","state %4.0f",next_state);
Exitlong("s11",Onclose,DEF,"b10",num,1);
}
} else if(state ==12) then {
if(close<=av_price[state]) then { /*Transit to next state */
next_state =state+1;
print("state.txt","state %4.0f",next_state);
buy("b12",Onclose,DEF,num);
}
if(close>=av_price[state-2]) then {
next_state =state-1;
print("state.txt","state %4.0f",next_state);
Exitlong("s12",Onclose,DEF,"b11",num,1);
}
} else if(state ==13) then {
if(close<=av_price[state]) then { /*Transit to next state */
next_state =state+1;
print("state.txt","state %4.0f",next_state);
buy("b13",Onclose,DEF,num);
}
if(close>=av_price[state-2]) then {
next_state =state-1;
print("state.txt","state %4.0f",next_state);
Exitlong("s13",Onclose,DEF,"b12",num,1);
}
} else if(state ==14) then {
if(close<=av_price[state]) then { /*Transit to next state */
next_state =state+1;
print("state.txt","state %4.0f",next_state);
buy("b14",Onclose,DEF,num);
}
if(close>=av_price[state-2]) then {
next_state =state-1;
print("state.txt","state %4.0f",next_state);
Exitlong("s14",Onclose,DEF,"b13",num,1);
}
} else if(state ==15) then {
if(close<=av_price[state]) then { /*Transit to next state */
next_state =state+1;
print("state.txt","state %4.0f",next_state);
buy("b15",Onclose,DEF,num);
}
if(close>=av_price[state-2]) then {
next_state =state-1;
print("state.txt","state %4.0f",next_state);
Exitlong("s15",Onclose,DEF,"b14",num,1);
}
} else if(state ==16) then {
if(close<=av_price[state]) then { /*Transit to next state */
next_state =state+1;
print("state.txt","state %4.0f",next_state);
buy("b16",Onclose,DEF,num);
}
if(close>=av_price[state-2]) then {
next_state =state-1;
print("state.txt","state %4.0f",next_state);
Exitlong("s16",Onclose,DEF,"b15",num,1);
}
} else if(state ==17) then {
if(close<=av_price[state]) then { /*Transit to next state */
next_state =state+1;
print("state.txt","state %4.0f",next_state);
buy("b17",Onclose,DEF,num);
}
if(close>=av_price[state-2]) then {
next_state =state-1;
print("state.txt","state %4.0f",next_state);
Exitlong("s17",Onclose,DEF,"b16",num,1);
}
} else if(state ==18) then {
if(close<=av_price[state]) then { /*Transit to next state */
next_state =state+1;
print("state.txt","state %4.0f",next_state);
buy("b18",Onclose,DEF,num);
}
if(close>=av_price[state-2]) then {
next_state =state-1;
print("state.txt","state %4.0f",next_state);
Exitlong("s18",Onclose,DEF,"b17",num,1);
}
} else if(state ==19) then {
/* if(close<=av_price[state]) then {
next_state = state+1;
print("state.txt","state %4.0f",next_state);
buy(1);
}*/
if(close>=av_price[state-2]) then {
next_state = state-1;
print("state.txt","state %4.0f",next_state);
Exitlong("s19",Onclose,DEF,"b18",num,1);
}
} else if(state == 1001) then {
if(close<=av_price[0]) then { /*Transit to next state */
next_state = 1;
print("state.txt","state %4.0f",next_state);
}
}
2007-08-02
858
글번호 200364
예스트레이더 (iM증권)