EasyTrader ArtNo 173
ETF英文原文為Exchange Traded Funds,中文稱為「指數股票型證券投資信託基金」,簡稱為「指數股票型基金」,ETF即 為將指數予以證券化,由於指數係衡量市場漲跌趨勢之指標,因此所謂指數證券化,係指投資人不以傳統方式直接進行一籃子股票之投資,而是透過持有表彰指數標的股票權益的受益憑證來間接投資;因此簡而言之,ETF是一種在證券交易所買賣,提供投資人參與指數表現的基金,ETF基金以持有與指數相同之股票為主,分割成眾多單價較低之投資單位,發行受益憑證。ETF商品特色
一、被動式管理,追求指數報酬率
二、獨特之實物申購/買回機制,使其市價得以貼近淨值
三、兼具股票與指數基金特色之商品
這本由 Larry Connors所寫的書《High Probability ETF Trading》是排名在 2009 年十大交易書籍之中,而且書中介紹的策略在代號SPY 的 ETF 1993~ 2008 測試的勝率高達 85% 以上。
備註 SPY - 追蹤標普500指數的SPDR S&P 500 ETF(SPDR是Standard and Poor’s Deposit Receipt的縮寫,這支ETF是美國第一支ETF,成立於1993年1月22日。
本篇介紹其中的 MULTIPLE DAYS DOWN 的交易策略
進場作多條件
- 1. 收盤價大於 200 日均線
- 2. 收盤價小於 5 日均線
- 3. 過去 5日內有 4日的收盤價是下跌
當收盤價回到 5 日均線之上則平倉
進場作空條件
- 1. 收盤價小於 200 日均線
- 2. 收盤價大於 5 日均線
- 3. 過去 5日內有 4日的收盤價是上漲
當收盤價回到 5 日均線之下則平倉
在初步測試過程中,原有平倉條件對台指期而言效果不佳,因此改用部落格上常用的測試方法,另外針對當日收盤價進場改為次日開盤價進場
測試程式碼 { 使用隨機參數的好處是可以同時測試多樣變數 ,縮短測試時間}
input:EntryType(1),ExitType(0);
inputs:Ref_L(5),Ratio_L(0.8),Ref_S(5),Ratio_S(0.8),TrendL(200),RetraceL(5),TrendS(200),RetraceS(5) ,NBarL(2),NBarS(2),TradeProfit(0.05),TradeStopLoss(0.03) ;
vars: IsBalanceDay(False),MP(0),PF(0),PL(0);
MP = MarketPosition ;
if DAYofMonth(Date) > 14 and DAYofMonth(Date) < 22 and DAYofWeek(Date)= 3 then isBalanceDay = True else isBalanceDay =False ;
PF = AvgPrice*TradeProfit ;
PL = AvgPrice*TradeStopLoss ;
{ 將過去 5日內有 4日的收盤價是上漲/下跌改為變數 }
Value1 = MaxList(Intportion(Ref_L*Ratio_L),1) ;
Value2 = MaxList(IntPortion(Ref_S*Ratio_S),1) ;
if EntryType = 1 then Begin
if Close > Average(Close,TrendL) and Close < Average(Close,RetraceL) and Countif(Close < Close[1],5) >= 4 then Buy next bar at Market ;
{if MP > 0 and Close > Average(Close,5) then ExitLong this bar at Close ;}
if Close < Average(Close,TrendS) and Close > Average(Close,RetraceS) and Countif(Close > Close[1],5) >= 4 then Sell next bar at Market ;
{if MP < 0 and Close < Average(Close,5) then ExitShort this bar at Close ;}
end;
if EntryType = 2 then Begin
if Close > Average(Close,TrendL) and Close < Average(Close,RetraceL) and Countif(Close < Close[1],Ref_L) >= Value1 then Buy next bar at Market ;
{if MP > 0 and Close > Average(Close,5) then ExitLong this bar at Close ;}
if Close < Average(Close,TrendS) and Close > Average(Close,RetraceS) and Countif(Close > Close[1],Ref_S) >= Value2 then Sell next bar at Market ;
{if MP < 0 and Close < Average(Close,5) then ExitShort this bar at Close ;}
end;
if ExitType = 1 then SetStopLoss(PL * BigPointValue) ;
if ExitType = 2 then Begin
SetStopLoss(PL * BigPointValue) ;
SetProfitTarget(PF * BigPointValue) ;
end;
if ExitType = 3 then Begin
if MP > 0 and BarsSinceEntry = NBarL then ExitLong next bar at Market ;
if MP < 0 and BarsSinceEntry = NBarS then ExitShort next bar at Market ;
end;
if ExitType = 4 then Begin
SetStopLoss(PL * BigPointValue) ;
SetProfitTarget(PF * BigPointValue) ;
if MP > 0 and BarsSinceEntry = NBarL then Sell {ExitLong} next bar at Market ;
if MP < 0 and BarsSinceEntry = NBarS then Buy {ExitShort} next bar at Market ;
end;
if ExitType = 5 then Begin
if ExitType = 2 then Begin
SetStopLoss(PL * BigPointValue) ;
SetProfitTarget(PF * BigPointValue) ;
end;
if ExitType = 3 then Begin
if MP > 0 and BarsSinceEntry = NBarL then ExitLong next bar at Market ;
if MP < 0 and BarsSinceEntry = NBarS then ExitShort next bar at Market ;
end;
if ExitType = 4 then Begin
SetStopLoss(PL * BigPointValue) ;
SetProfitTarget(PF * BigPointValue) ;
if MP > 0 and BarsSinceEntry = NBarL then Sell {ExitLong} next bar at Market ;
if MP < 0 and BarsSinceEntry = NBarS then Buy {ExitShort} next bar at Market ;
end;
if ExitType = 5 then Begin
{Inputs: ATRs_L(3);}
Variables: PosHigh(0), ATRVal_L(0);
ATRVal_L = AvgTrueRange(10) * ATRs_L;
If BarsSinceEntry = 0 Then PosHigh = High;
If MarketPosition = 1 Then Begin
If High > PosHigh Then PosHigh = High;
ExitLong ("ATR") Next Bar at PosHigh - ATRVal_L Stop;
End else ExitLong ("ATR eb") Next bar at High - ATRVal_L Stop;
{Inputs: ATRs_S(3);}
Variables: PosLow(0), ATRVal_S(0);
ATRVal_S = AvgTrueRange(10) * ATRs_S;
If BarsSinceEntry = 0 Then PosLow = Low;
If MarketPosition = -1 Then Begin
If Low < PosLow Then PosLow = Low;
ExitShort ("ATR_1") Next Bar at PosLow + ATRVal_S Stop;
End else ExitShort ("ATR_1 eb") Next bar at Low + ATRVal_S Stop;
end;
Variables: PosLow(0), ATRVal_S(0);
ATRVal_S = AvgTrueRange(10) * ATRs_S;
If BarsSinceEntry = 0 Then PosLow = Low;
If MarketPosition = -1 Then Begin
If Low < PosLow Then PosLow = Low;
ExitShort ("ATR_1") Next Bar at PosLow + ATRVal_S Stop;
End else ExitShort ("ATR_1 eb") Next bar at Low + ATRVal_S Stop;
end;
if IsBalanceDay then setExitonClose ;
台指期 日K 留倉 2004/5/31 ~2014/5/31 交易成本 1200
讀者有興趣也可使用台灣50 ETF作測試~
MagicQS090
沒有留言:
張貼留言