過去N天內 出現過2次以上開收高低一樣的情形

  •   93 
  • 最後發表   Soweon  2019 九月 25
Soweon 發文於   2019/09/22

請問如何撰寫

在過去N天內

出現過2次以上開收高低一樣的情形

謝謝!

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

Hi Soweon

您好,小幫手這邊幫您撰寫了一個範例,請您參考範例。

建議您可以使用for..to..迴圈搭配if..then判斷,去判斷每一天的開高低收價格相同

並使用一個參數將相關次數記錄下來,最後去判斷次數就完成啦。

input:X(20,"過去幾天");
var:countopenhighlowclose(0),i(1);
i=1;
countopenhighlowclose=0;
for i = 1 to X
    begin
        if close[i]=high[i] and high[i]=low[i] and low[i]=open[i] then 
        countopenhighlowclose=countopenhighlowclose+1;
    end;


if countopenhighlowclose>=2 then ret=1;
outputfield1(countopenhighlowclose,"開高低收重複次數");

以上說明,謝謝。

附加文件

發表回覆
Close