請問小編大大
空方策略
自動交易送出委託單經過3根K棒(3分鐘)未成交
刪除委託單這樣寫不知道對不對
總覺得不知道哪裡怪怪的,總覺得根下方出場策略有衝突
//==============================================
{刪除委託單}
if Position < 0 and Filled = 0
and close < close[1]
and close < close[2] //經過2個K棒
then begin SetPosition(filled ,market); //刪除委託單
end;
//=========================================================
{ 依照成本價格設定停損/停利: 請注意當作空時, 判斷是否獲利的方向要改變 }
if Position <> 0 and Filled <> 0 //假設部位不等於0
then begin{ 停利 }
if close <= filledAvgPrice*(1-0.01*profit_percent)
then begin
SetPosition(0);
end else{ 停損 }
if close >= filledAvgPrice*(1+0.01*loss_percent)
then begin
SetPosition(0);
end;
end;
//==============================================
{ 出場時間 }
if Position <> 0
and time >= 104000
and Close < filledAvgPrice
then SetPosition(0);
6 評論