停利出場後

  •   375 
  • 最後發表   LAST trader  2022 三月 01
LAST trader 發文於   2021/06/10

照範例腳本寫了一個語法if Position = 1 and Filled = 1 then begin  

{ 依照成本價格設定停損/停利 }  

  

if profit_point > 0 and Close >= FilledAvgPrice + profit_point  then begin  

{ 停利 }  

SetPosition(0) and   begin SetPosition(1)  ;  

end else if loss_point > 0 and Close <= FilledAvgPrice - loss_point then begin  

{ 停損 }  

SetPosition(0);  

  

end;         如果交易是達到停利標準 出場後 馬上再次進場   語法該怎麼寫 比較好  

  目前的困擾是 如果停利點設 太大  洗盤局可能會被洗出場   設太小 趨勢盤 抓到少  

如果可以 每次進場獲利 後出 場  完再次進場 再配合停損 策略 似乎可以達到最大效益    

排序方式: 標準 | 最新
XQ小幫手 發文於   2021/06/11

Hello LAST trader,

 

您可以使用變數來記錄停利出場。舉例來說:

var: tp_out(0);

 

if profit_point > 0 and Close >= FilledAvgPrice + profit_point  then begin  

    SetPosition(0);

    tp_out = 1;  

    end

else if loss_point > 0 and Close <= FilledAvgPrice - loss_point then begin  

    SetPosition(0);

    tp_out = 0;  

    end;

 

if tp_out = 1 then SetPosition(1);

如果您出場只有停利或停損的話只要停利出場就會再度進場,而停損不會。

LAST trader 發文於   2021/07/23

小幫手您好~

我想問 如果 繼續進場後 有 希望連續進場這單 的停損 跟     一般單的停損 不同 該如何表示 以下這樣的方式可行嗎

var: tp_out(0);

 

if profit_point > 0 and Close >= FilledAvgPrice + profit_point  then begin  

    SetPosition(0);

    tp_out = 1;  

    end

else if loss_point > 0 and Close <= FilledAvgPrice - loss_point then begin  

    SetPosition(0);

    tp_out = 0;  

    end;

else if    tp_out = 1 and  loss_point > 0 and Close <= FilledAvgPrice - AAAloss_point then begin  

    SetPosition(0);

   

   end;

 

 

if tp_out = 1 then SetPosition(1);

XQ小幫手 發文於   2021/07/27

Hello LAST trader,

 

您需要把前面停損的if判斷也加上tp_out。

舉例來說:

if profit_point > 0 and Close >= FilledAvgPrice + profit_point  then begin  

    SetPosition(0);

    tp_out = 1;

    end

else tp_out = 0 if loss_point > 0 and Close <= FilledAvgPrice - loss_point then begin  

    SetPosition(0);

    tp_out = 0;  

    end

else if tp_out = 1 and  loss_point > 0 and Close <= FilledAvgPrice - AAAloss_point then begin  

    SetPosition(0);

    end;

這樣的話才不會一旦第二個if判斷式符合就進入,反而沒有進到第三個。

LAST trader 發文於   2022/02/26

直接複製小幫手的程式下去跑  好像 不會再度進場  麻煩小幫手看看 是不是哪邊有問題

XQ小幫手 發文於   2022/03/01

Hello LAST trader,

 

需要麻煩您提供完整的腳本,並詳細描述您的需求讓小幫手檢驗看如何修改會比較好。

小幫手上面的範例只有出場的部分,並沒有包含進場的部分。

您可以直接將檔案上傳,也可以Mail至客服信箱 XQservice@XQ.com.tw且務必附上 討論文章連結網址(小幫手才能盡早處理)。

感謝。

發表回覆
Close