1017  

最近價差交易掀起一股熱潮,許多客戶有問到如何用台指期和現貨之間的價差寫出交易策略。這的確是個很好研究的話題。

我們可利用元大Multicharts劃出價差圖,看這一篇 連結 ,觀察台指期貨和現貨正逆價差的關係。到底是期貨跟著現貨跑,還是期貨領先現貨? 價差大於小於多少點數應該收斂還是發散?

以下範例 是由元大投顧最專業的張林忠分析師現身說法

 

逆價差小於一定的點數作多,正價差大於一定的點數作空,設固定的停損停利點,到底這樣可不可行,看完影片之後,把邏輯轉換成PL語法

input:SL(0.0125),PL(0.03),rr(0.4),aa(-40),bb(20); 

value1 = close of data1 - close of data2;  計算期貨和現貨的價差值

if H-L>0 then begin

condition1 = (C-L)/(H-L)>rr and C>O and C[1]>O[1];   重要的濾網

condition2 = (C-L)/(H-L)<1-rr and C<O and C[1]<O[1];

end;

if t>0915 and t<1324 then begin

if condition1 and value1 cross over aa then buy next bar at market;  逆價差縮小買進多單

if condition2 and value1 cross under bb then sellshort next bar at market;  正價差縮小買進空單

end;

停損停利

if marketposition=1 then sell next bar at entryprice*(1-SL) stop;

if marketposition=-1 then buytocover next bar at entryprice*(1+SL) stop;

if marketposition=1 then sell next bar at entryprice*(1+PL) limit;

if marketposition=-1 then buytocover next bar at entryprice*(1-PL)limit;

 結算日平倉

if marketposition<>0 and  dayofweek(date)=3 and dayofmonth(date)>14 and dayofmonth(date)<22 then begin

sell all contracts this bar on close;

buytocover all contracts this bar on close;

end;

回測最近幾年的績效,價差的策略還真的有道理,正逆價差的指標有一定的參考依據。 跟著大師的腳步絕對讓平民少走許多冤枉路

1021  

不過比較好奇的是 遇到了除權息的旺季,常常逆價差過大,這部分策略是否就失效了??

 

arrow
arrow

    元大期貨楊宗儒 發表在 痞客邦 留言(0) 人氣()