Input: Length(10,"天數");
Input: Multiplier(3,"ATR倍數");
var: v1(0), v2(0);
if currentBar = 1 then begin
v1 = 99999;
v2 = 0;
end;
if currentBar > 1 then begin
if close > v1 then begin
v1 = close + atr(Length) * Multiplier;
end;
if close < v2 then begin
v2 = close - atr(Length) * Multiplier;
end;
end;
Var: Condition1Flag(close > v1);
Var: Condition2Flag(close < v2);
if Position <= 0 and filled <= 0 and Condition1Flag then begin
SetPosition(1, MARKET); // 以市價買進
end;
if Position >= 0 and filled >= 0 and Condition2Flag then begin
SetPosition(-1, MARKET); // 以市價賣出
end;
 
 
             
        
        .jpg?width=50&crop=0,0,50,50) 
         
        .jpg?width=20&crop=0,0,20,20) 
                     
         
     
     分類
    分類
 
            
7 評論