區間突破XS寫法

  •   216 
  • 最後發表   ttsp  2024 二月 15
ttsp 發文於   2024/02/14

小幫手您好

這是從書上複寫下來的語法, 

在編譯時會顯示在最後一行出問題

但我實在找不出原因......

能否請小幫手幫我確認看看, 感激不盡~~

XS如下:

 

 

if barfreq<>"min" or barInterval<>1 then raiseRunTimeError("本腳本只適用1分K");

 

variable:barcount(0), openvol(0), H15(0), L15(0), _range(0);

 

if date<>date[1] then barcount=1 else barcount+=1;

 

input:txt("啟動後只觸發一次","觸發設定");

 

 

if barcount=15 then

//目前時間已來到09:15:00

 

begin

 

H15= highest(High, 15); 

//前15分鐘的最高點

 

L15= lowest(Low, 15);

//前15分鐘的最低點

 

openvol = volume[14]; 

//第一根K bar的量

 

end;

 

if L15 <>0 then _range = H15/L15 -1;

 

 

condition1=false;

if close > H15 and _range >=0.01 and openvol/Getfield("成交量", "D")[1] > 0.03

then

begin

condition1=true;

retmsg= "Long";   //買進訊號

 

condition2=false;

if close < L15 and _range >=0.01 and openvol/Getfield("成交量", "D")[1] > 0.03

then

begin

condition2=true;

retmsg= "Short"; 

end;

 

if currenttime>= 091600 and 

(close/Getfield("收盤價", "D")[1] -1 <=0.05 or

close/Getfield("收盤價", "D")[1] -1 >=-0.05 and

(condition1 or condition2)

and average(Getfield("成交量", "D")[1], 5)>1000 then ret=1;

排序方式: 標準 | 最新
貓市 發文於   2024/02/15

可以多檢查begin/end, ()左右括號等等是否匹配

 

if barfreq<>"min" or barInterval<>1 then raiseRunTimeError("本腳本只適用1分K");

variable:barcount(0), openvol(0), H15(0), L15(0), _range(0);

if date<>date[1] then barcount=1 else barcount+=1;

input:txt("啟動後只觸發一次","觸發設定");

if barcount=15 then

//目前時間已來到09:15:00

begin

H15= highest(High, 15); 

//前15分鐘的最高點

L15= lowest(Low, 15);

//前15分鐘的最低點

openvol = volume[14]; 

//第一根K bar的量

end;

if L15 <>0 then _range = H15/L15 -1;

condition1=false;

if close > H15 and _range >=0.01 and openvol/Getfield("成交量", "D")[1] > 0.03

then

begin

condition1=true;

retmsg= "Long";   //買進訊號

end; 

condition2=false;

if close < L15 and _range >=0.01 and openvol/Getfield("成交量", "D")[1] > 0.03

then

begin

condition2=true;

retmsg= "Short"; 

end;

if currenttime>= 091600 and 

close/Getfield("收盤價", "D")[1] -1 <=0.05 or

close/Getfield("收盤價", "D")[1] -1 >=-0.05 and

(condition1 or condition2)

and average(Getfield("成交量", "D")[1], 5)>1000 then ret=1;

  • 按讚來自於
  • b24524658
ttsp 發文於   2024/02/15

非常感謝~豁然開朗了  

原來是在更前面, 我一直在找系統給的錯誤位置

新年快樂~

發表回覆
Close