請問小幫手大大及各位高手大大,如下的程式要如何設定開盤時內檢查個股是否KD黃金交叉且,對個股有設定2個檢查時間要如何設定雷達,是要設定 連續觸發 ,還是 啟動後只觸發一次
input: _time1(100000), _time2(120000), _limit(1, "區段內警示次數");
variable: rsv(0), k(0), _d(0), count(0);
condition1 = currenttime >= _time1 and currenttime[1] <= _time1;
condition2 = currenttime >= _time2 and currenttime[1] <= _time2;
SetTotalBar(maxlist(9,6) * 3 ); // 設定資料讀取範圍
Stochastic(9, 3, 3, rsv, k, _d); // 計算K值與D值
if condition1 or condition2 then count = 0; //區段內次數重置
if count < _limit and k cross over _d then begin
ret = 1;
count += 1;
retMsg = "KD黃金交叉";
end;
1 評論