警示1分頻率,如何間隔時間再觸發

  •   207 
  • 最後發表   ItsYeLizard  2021 五月 10
ItsYeLizard 發文於   2021/05/08

 

當警示使用1分k 頻率(不逐筆洗價)時,如果下一根k棒還是符合條件會再次觸發

請問有辦法利用語法固定間隔(時間 or k棒數)後,符合條件才觸發嗎?

if condition1 and condition2  then begin

ret = 1;

RetMsg = Text(NumToStr(GetField("收盤價"),2));

end;

XQ小幫手 發文於   2021/05/10

Hello ItsYeLizard,

 

您可以設一個變數來控制。

例如說:

input: count_num(10);      //最少要經過幾根bar

var: count(0);

 

count += 1;    //每經過1根bar加1

condition1= ...;

condition2= ...;

 

if condition1 and condition2 and count > count_num then begin

    ret = 1;

    RetMsg = Text(NumToStr(GetField("收盤價"),2));

    count = 0;            //歸零重新開始

    end;

 

這樣的話就會是最少要經過10根bar以後才會再度警示。

發表回覆
Close