開盤30分鐘處在跌的狀態

  •   110 
  • 最後發表   散散惹人愛  2023 九月 25
散散惹人愛 發文於   2023/09/15

var: intraBarPersist sTime(0), intraBarPersist lTime(0), intraBarPersist retRecord(0);

once begin

    sTime = currentTime;

    lTime = timeadd(sTime, "M", 30);

    end;

condition2 = close<GetField("收盤價","D")[1];

if condition2 then retRecord = 1;

if currenttime >= lTime and retRecord = 0 then condition3= false;

if currenttime >= lTime and retRecord = 1 then condition3= true;

 

小幫手請協助看看

condition3成立 是否表示 開盤後已進行30分仍維持在跌的狀態?

 

 

 

 

XQ小幫手 發文於   2023/09/25

 Hello 散散惹人愛,

 

您可以參考小幫手在 如果策略雷達在一定的時間內都沒通知,能設定一個訊息嗎? 的回覆。

也可以使用變數來記錄,舉例來說:

 

var: intrabarpersist _date(0), intrabarpersist _cond(0);

 

if _date <> date then begin   //換日或第一次運算時重置 _cond

    _cond = 0;

    _date = date;

    end;

 

if currenttime <= 093000 and close < getfield("Close", "D") then _cond = 1 else if currenttime <= 093000 and close >= getfield("Close", "D") then cond = 0;    //如果 09:30 以前收盤價小於昨日收盤價的話 cond 為 1

 

發表回覆
Close