下面是從之前小幫手解答中拼湊的腳本,有幾個問題想請教
疑問:
1.intrabarpersist //代表意義?
2.filledavgprice //代表意義?
3.SetPosition(目標部位,委託價格)
//setposition(0, market); //怎麼賣比例部位 ex:賣庫存的1/4量(張
4.前日收盤-2tick //請問此條件怎麼call //close[1]-2tick ?
5.情境是前一日收盤買進,隔日賣
有辦法跑過去特定幾檔台股來驗證結果?
6. 下列腳本 這段 if lock1 then //這邊語法有問題?
==================================================================================
var: intrabarpersist controller1(False);
var: intrabarpersist controller2(False);
var: lock1=false;
if filled > 0 and close < 前日收盤-2tick then begin
setposition(0, market); //停損
end;
if(漲停板) then begin
setposition(0, market); //停利
end;
if filled > 0 and (100 * (close - filledavgprice) / filledavgprice) >= 2 then begin
controller1 = True;
//只要庫存大於0且有收盤價漲超過2%時controller 就為 True。(有需要的話可以改為high)
setposition(x, market); //賣1/4庫存
lock1=true;
end;
if filled > 0 and controller1 = True and (100 * (close - filledavgprice) / filledavgprice) <= 0.5 then begin
//曾漲超過2.5%,現在只剩下0.5%以下時
if lock1 then //這邊語法有問題?
setposition(0, market); //停利1/4
else
setposition(0, market); //停利2/4
controller1 = False; //將controller改回False
end;
if filled > 0 and (100 * (close - filledavgprice) / filledavgprice) >= 5 then begin
controller2 = True;
//setposition(0, market); //賣1/4庫存
end;
if filled > 0 and controller2 = True and (100 * (close - filledavgprice) / filledavgprice) <= 1 then begin
//曾漲超過5%,現在只剩下1%以下時
setposition(0, market); //出場
controller2 = False; //將controller改回False
end;
再麻煩幫review一下 感謝
1 評論