語法問題

  •   306 
  • 最後發表   股海無涯  2024 十月 01
股海無涯 發文於   2024/09/30

各位版上大神大家好
我有撰寫一則語法

if date <> date[1] then value1 = volume;

 

if volume > value1 then value1 = volume;

 

Input: Length(20), LowerBand(3);

 

settotalbar(Length + 3);

 

SetInputName(1, "期數");

 

SetInputName(2, "通道下緣");

 

 

value2=bollingerband(getfield("Close","5"),Length,1 * LowerBand);

 

value3=bollingerband(getfield("Close","5"),Length,-1 * LowerBand);

 

condition1 = time >=093000 and value1 > value1[1];  //0930以後且創新高。

 

condition2=close cross over value2 and GetQuote("漲跌幅")<7; //突破上軌且當前漲幅不超過7%

 

condition3=close cross under value3 and GetQuote("漲跌幅")>-7;//跌破下軌且當前跌幅不超過7%

 

condition4=GetSymbolInfo("買賣現沖")=true;//標的僅限當日可買賣現沖

 

condition5=c>100 and c<200;//目前股價位於100-200間

 

 

if condition1 and condition2 or condition3 and condition4 and condition5

then begin   

 

ret=1;

 

 

    end;

 

構想是在0930後若於盤中爆大量,且突破布林上軌且漲幅小於7%或跌破布林下軌且跌幅小於7%,且個股可買賣現沖時、股價位於100-200間即警示

但回測時卻跑不出東西,請問是有哪邊我沒注意到的嗎,謝謝大家~

排序方式: 標準 | 最新
虎科大許教授 發文於   2024/09/30

GetQuote報價欄位不能用來回測。另外,你連接5個condition有and有or,and優先順序在or之前。這裡可能有邏輯錯誤的問題。

股海無涯 發文於   2024/10/01

好的 謝謝許教授

發表回覆
Close