一種
//有庫存先賣再買
if position=1 and filled=1 and value3 < 0 and getField("均價") < close then setposition(0,close);
if close <= filledAvgPrice *0.99 then setposition(1,close);
if close <= filledAvgPrice *0.995 then setposition(1,close);
//無庫存先放空賣再買
if position=0 and filled =0 and value3 < 0 and getField("均價") < close then setposition(-1,close);
if filled=-1 and close <= filledAvgPrice*0.99 then setposition(0,close);
if filled=-1 and close <= filledAvgPrice *0.995 then setposition(0,close);
以下有Begin end
第二種
//有庫存先賣再買
if position=1 and filled=1 and value3 < 0 and getField("均價") < close then
begin setposition(0,close);
if close <= filledAvgPrice *0.99 then setposition(1,close);
if close <= filledAvgPrice *0.995 then setposition(1,close);
end
else
begin //無庫存先放空賣再買
if position=0 and filled =0 and value3 < 0 and getField("均價") < close then setposition(-1,close);
if filled=-1 and close <= filledAvgPrice*0.99 then setposition(0,close);
if filled=-1 and close <= filledAvgPrice *0.995 then setposition(0,close);
end;
第三種
// 有庫存先賣再買
if position=1 and filled=1 and value3 < 0 and getField("均價") < close then
begin
setposition(0,close);
if close <= filledAvgPrice *0.99 then setposition(1,close);
if close <= filledAvgPrice *0.995 then setposition(1,close);
end
else
begin
// 無庫存先放空賣再買
if position=0 and filled =0 and value3 < 0 and getField("均價") < close then
begin
setposition(-1,close);
if filled=-1 and close <= filledAvgPrice*0.99 then setposition(0,close);
if filled=-1 and close <= filledAvgPrice *0.995 then setposition(0,close);
end
end;
此三種,無包圍和有包圍,再包圍的執行結果差異有哪些?
 
            
        
        
        
        
            
5 評論