大家在使用getfield函數上是否遇過這種奇怪的問題?

  •   99 
  • 最後發表   Jing  2018 七月 26
Jing 發文於   2018/07/25

底下的程式有點奇怪,最後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");

 

附加文件

XQ小幫手 發文於   2018/07/26

Hi Jing,

您好,請您提供股票商品代碼,以利小幫手對照查看問題的原因,謝謝。

發表回覆
Close