空單想在平盤上一檔先行回補一部分

  •   205 
  • 最後發表   散散惹人愛  2024 九月 13
散散惹人愛 發文於   2024/09/13

請教各位先進&小編:

if currentTime >= 091600 and position <> filled then CancelAllOrders(); 

if Position = 0 and short_condition  and condition1 then begin 

SetPosition(-1, AddSpread(Close, 2),label:="上2檔放空"); 

Print("放空"); 

end  

else if Position = -1 and short_condition and condition1  then begin 

SetPosition(-2, AddSpread(Close, 1),label:="上1檔加空");

    Print("小放空"); 

end; 

var: short_one_condition(false); { 空單加碼1張 }  

var: reduce_one_condition(false); { 空單減碼(回補)1張}  

var: exit_short_condition(false); { 空單全部回補 }  

var: intrabarpersist hasOrdered(false);

if position<>0 and filled<>0 then

begin 

value95=100 * (Close - FilledAvgPrice) / FilledAvgPrice; //停利停損% 

value96= closeD(1);

condition39 = FilledAvgPrice>closeD(1);///進場於平盤之上

condition40 = FilledAvgPrice < HIGHD(0);

if Position < -1 and currentTime<093700  and value95<-1 and 

then cover(1,GetField("收盤價", "D")[1],label:="跌到平盤先回補");

SentTime=Getfield("時間","M");

end;


 

XQ編譯如上;

錯誤訊息通常為:無法辨認的字,cover第二個參數不能為 XXX

主要是:

  • 開盤做空: 在0916分前,下單做空,皆有可能委託下單
  • 下單後 以value95 控制 ,即空單成交後,未實現做空獲利達1%以上
  • 空單成交後,且在09時37分以前,掛一個平盤價上一檔:回補空單,0937後則不須策略,取消之

 

以下是參考XQ的描述,


 

虎科大許教授 發文於   2024/09/13

//養成撰寫的好習慣,就可以減少很多困擾。
var: short_condition(false); 
var: short_one_condition(false);  {空單加碼1張 }  
var: reduce_one_condition(false); { 空單減碼(回補)1張}  
var: exit_short_condition(false); { 空單全部回補 }  
var: intrabarpersist hasOrdered(false);
var: SentTime(0);
if currentTime >= 091600 and position <> filled then CancelAllOrders(); 
if Position = 0 and short_condition  and condition1 then 
    begin 
        SetPosition(-1, AddSpread(Close, 2),label:="上2檔放空"); 
        Print("放空"); 
    end  
else if Position = -1 and short_condition and condition1  then 
    begin 
        SetPosition(-2, AddSpread(Close, 1),label:="上1檔加空");
        Print("小放空"); 
    end; 
if position<>0 and filled<>0 then
    begin 
        value95=100 * (Close - FilledAvgPrice) / FilledAvgPrice; //停利停損% 
        value96= closeD(1);
        condition39 = FilledAvgPrice>closeD(1);///進場於平盤之上
        condition40 = FilledAvgPrice < HIGHD(0);
        if Position < -1 and currentTime<093700  and value95<-1
            then cover(1,GetField("收盤價", "D")[1],label:="跌到平盤先回補");
        SentTime=Getfield("時間","M");
    end;

  • 按讚來自於
  • Kesler
發表回覆
Close