親愛的小編好,
要寫一段突破MACD背離關鍵K棒價位的策略,希望寫收盤價突破關鍵K棒的高點買進,低於關鍵K棒的低點時就放棄動作,寫了以下的條件執行後,卻發現如果跌破關鍵K棒低點後並沒有取消條件,而是等價格回到原關鍵K棒高點後又動作。
請問取消條件的指定要如何寫呢??
value6 = xfMin_MACD("30",xfMin_weightedclose("30"),12,26,9,value1,value2,value3);
condition1 = value3 crosses over value3[1];
condition2 = close < close[1];
variable: HBprice(0),LBprice(0);
if (condition1 and condition2 ) = true then begin
HBprice =High ;
LBprice =Low;
end;
if close crosses over HBprice and close > close[1] then setposition(1)
else if close crosses under LBprice and close < LBprice then return;
 
            
        
        
        
            
1 評論