XS腳本對選擇權無作用?

  •   92 
  • 最後發表   無情卻慈悲  2022 九月 02
無情卻慈悲 發文於   2022/08/28

你好,我想問一下

我下方寫的出場腳本,對期貨有用,但對選擇權卻無法自動停利停損,不知哪有誤?

 

//++多單停利:

input:_win_point(10,"幾點停利");

if position > 0 

and Close - FilledAvgPrice > 0

and Close - FilledAvgPrice  >= _win_point 

then begin

SetPosition(0, MARKET,label:="多單停利:點數停利");

end;

//++空單停利:期貨

if position < 0  

and FilledAvgPrice - close    > 0

and FilledAvgPrice - Close  >= _win_point

then begin

SetPosition(0, MARKET,label:="空單停利");

end;

 

//---■停損■---

//多單停損1:

input:_point_loss(20,"X點停損");

//++多單停損

if position > 0 

and Close - FilledAvgPrice < 0

and FilledAvgPrice -  Close > _point_loss

then begin

SetPosition(0, MARKET,label:="多單停損 ");

end;

 

//++空單停損

//input:_point_loss(10,"幾點停損");

//空單停損1:

if position < 0   

and FilledAvgPrice - Close  <  0

and Close - FilledAvgPrice > _point_loss

then begin

SetPosition(0, MARKET,label:="空單停損");

end;

 

 

XQ小幫手 發文於   2022/09/02

Hello 無情卻慈悲,

 

小幫手認為您應該是用台指期的價格去計算,這是不正確的。

實際上停損停利會用商品的價格去計算。

 

舉例而言,台指選09W1 C15000 的價格現在是20元,買進的價格假設是25好了,您的停損停利設為20,根據腳本的停損就會是

Close - FilledAvgPrice < 0   //25 - 20 < 0  符合

and FilledAvgPrice -  Close > _point_loss    //25 - 20 > 20  不符合

 

發表回覆
Close