如何在每分鐘頻率裡面加上檢查每5分鐘才要執行的動作

  •   346 
  • 最後發表   莊莊  2024 十二月 09
莊莊 發文於   2024/12/05

我想要寫一支程式每分鐘會監控,但其中一段行為要在每間隔 5 分鐘才要觸發,請問要怎麼樣才能讓它判斷間隔 5 分鐘才能執行呢?謝謝!

if barfreq <> "Min" or Barinterval <>1 then RaiseRuntimeError("請設定頻率為 1 分鐘");

variable: _status_1(0), _status_2(0), _status_3(0);

if {條件1} then _status_1 = 1;
if {條件2} then _status_2 = 1;
if {條件3} then _status_3 = 1;

if _status_1 = 1 Or _status_2 = 1 then begin

  if {每5分鐘} then begin

      if {條件4} then {執行4};

  end;

end else begin

  if {條件5} then {執行5};

end;

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

if barfreq <> "Min" or Barinterval <>1 then RaiseRuntimeError("請設定頻率為 1 分鐘");

variable: _status_1(0), _status_2(0), _status_3(0), intraBarPersist myTime(0);

if {條件1} then _status_1 = 1;
if {條件2} then _status_2 = 1;
if {條件3} then _status_3 = 1;

if _status_1 = 1 Or _status_2 = 1 then begin
  myTime=getField("時間","5");
  if myTime<>myTime[1] then begin
      if {條件4} then {執行4};
  end;
end else begin
  if {條件5} then {執行5};
end;

  • 按讚來自於
  • hohayo
XS小編 發文於   2024/12/09

Hello 莊莊,

 

小編補充,若要確保策略洗價的話,要使用 自動洗價 功能。

逐筆洗價會受到商品是否有交易的影響,不能保證一定會洗價。

在冷門商品上時每筆交易有可能間隔過久。

  • 按讚來自於
  • Pingzz0719
  • hohayo
發表回覆
Close