底下的程式有點奇怪,最後plot的是condition1而已,但程式碼卻因為"有問題程式"部分而影響到plot,如果把有問題的部分用{}註解起來,程式又正常了!
請問關於getfield函數是不是有問題?!
//-----有問題程式部分------
condition2=false;
if GetField("收盤價","D")>=GetField("收盤價","D")[20]*1.2 and close>average(GetField("收盤價","D")[1],60)
and average(GetField("成交量","D"),5)>1000 {and GetField("收盤價","D")<=200}
then condition2=true;
condition3=false;
if (average(GetField("收盤價","D")[1],10)>average(GetField("收盤價","D")[1],20)
and close>average(GetField("收盤價","D")[1],60) and
average(GetField("收盤價","D")[1],10) > average(GetField("收盤價","D")[10],10) and
average(GetField("收盤價","D")[1],20) > average(GetField("收盤價","D")[10],20) and
average(GetField("收盤價","D")[10],10) >average(GetField("收盤價","D")[10],20) and
GetField("收盤價","D")/GetField("收盤價","D")[60]-1>=20*0.01 ) then condition3 = true;
///--------完整程式文---------
input:_time(093000,"訊號接收時間"),_control(0.07,"訊號觸發時漲幅控制");
condition1=false;
if close>open
then condition1=true;
condition2=false;
if GetField("收盤價","D")>=GetField("收盤價","D")[20]*1.2 and close>average(GetField("收盤價","D")[1],60)
and average(GetField("成交量","D"),5)>1000 {and GetField("收盤價","D")<=200}
then condition2=true;
condition3=false;
if (average(GetField("收盤價","D")[1],10)>average(GetField("收盤價","D")[1],20)
and close>average(GetField("收盤價","D")[1],60) and
average(GetField("收盤價","D")[1],10) > average(GetField("收盤價","D")[10],10) and
average(GetField("收盤價","D")[1],20) > average(GetField("收盤價","D")[10],20) and
average(GetField("收盤價","D")[10],10) >average(GetField("收盤價","D")[10],20) and
GetField("收盤價","D")/GetField("收盤價","D")[60]-1>=20*0.01 ) then condition3 = true;
if condition1 {and (condition2 or condition3)} then
plot1(999,"Buy");
1 評論