想請問突破指定區間出場

  •   112 
  • 最後發表   boldie  2021 四月 08
boldie 發文於   2021/04/04

您好,請問一下

假設我使用2根K棒當進場依據,我要指定這2根K棒最高最低點當出場訊號,突破跌破後出場,這樣寫對嗎?

 

input:Length(2,"區間")

variable:highprice(0),lowprice(0),count(0);

 

if date <> date[1] then

count=0;

 

if count < 2 and time >= firsttime then begin

 

highprice = highest(high,Length);

lowprice = lowest(low,Length);

count = count+1;

end;

if close > highprice or close < lowprice then ret=1;

XQ小幫手 發文於   2021/04/08

Hello boldie,

 

依照您的腳本,稍作修改後加上備註,請看看是否符合您的需求。

input:Length(2,"區間"), firsttime(100000, "開始時間");

variable:highprice(0),lowprice(0),count(0);

 

if getfieldDate("date") <> getfieldDate("date")[1] then count=0;    //換日重置

 

if count < 2 and time >= firsttime then begin        //近兩根K棒的最高與最低,同天內指定時間後會執行兩次

    highprice = highest(high,Length);

    lowprice = lowest(low,Length);

    count = count+1;

    end;

if close > highprice or close < lowprice then ret=1;    //收盤價大於設定的最高或小於最低就警示

發表回覆
Close