頻率:1K 觸發設定:連續觸發 逐筆洗價
假設訊號:condition1
var:intraBarPersist condition1_bar(0); if condition1 and currentBar <> condition1_bar then begin condition1_bar = currentBar; ret=1; end;
這樣的寫法,可以在連續觸發的環境下,達成K棒內單次觸發。
現在的問題是,如果再開啟策略之前,condition1已經達成,在開啟策略後,警示紀錄是不會有訊號跑出來,
應該是已經 currentBar = condition1_bar的問題,但我想要的是開啟策略時重新計算,
所以改寫:
var:intraBarPersist condition1_bar(0); once IsLastBar begin condition1_bar= 0; end; if condition1 and currentBar <> condition1_bar then begin condition1_bar = currentBar; ret=1; end;
但發現還是不行,求解。
PS:因為很多訊號,才選擇觸發設定:連續觸發,全部寫在一個腳本裡,減少計算。
1 評論