請教:盤中測試不會觸發

  •   183 
  • 最後發表   Osmond  2019 十月 23
Osmond 發文於   2019/10/16

你好:

沒用過,盤中想測試 retsound
結果連觸發都不會,請教這是什麼原因?

variable:BSflag(0),xlastbar(0);

 

settotalbar(400);

 

if date <> currentdate then return;

if date <>date[1] then begin BSflag =0; xlastbar =0; end;

 

if xlastbar =0 then 

if islastbar then xlastbar =currentbar

else begin

if BSflag =0 then begin

BSflag =1; 

ret=1; retsound ="C:\DDE Sound\horse.wav";

end;

end;

我雷達頻率設 一分鐘,逐筆洗價,謝謝!

排序方式: 標準 | 最新
XQ小幫手 發文於   2019/10/21

Hi Osmond

您好,您的策略邏輯中,寫了這一段

if islastbar then xlastbar =currentbar

else begin

if BSflag =0 then begin

BSflag =1; 

ret=1; retsound ="C:\DDE Sound\horse.wav";

end;

end;

其中,IF..THEN..ELSE 的語法說明如此連結

else語法是用於上面Then的條件"不成立"的時候,執行else後面語法

因此當Then的條件都成立,就不會執行到後續ret=1,因此就不會觸發。

應修改成

if xlastbar =0 then begin

    if islastbar then begin

        xlastbar =currentbar;

        if BSflag =0 then begin

        BSflag =1; 

        ret=1; //retsound ="C:\DDE Sound\horse.wav";

        end;

    end;

end;

以上說明,謝謝。

 

Osmond 發文於   2019/10/23

思考不周,感謝指教,謝謝!

 

發表回覆
Close