EasyTrader ArtNo 071
加權股價指數(簡稱加權指數、TAIEX)是由臺灣證券交易所所編製的股價指數,台灣證券交易所採用「柏謝加權算式」(Passche Formula),與美國S&P 500的公式相同,是反應整體市場股票價值變動的指標。其係以上市股票之市值當作權數來計算股價指數,採樣樣本為所有掛牌交易中的普通股。其計算公式為:
指數 = 當期總發行市值 ÷ 基值 × 100
K線圖(Rosokuashi Chart)又稱為陰陽線、酒井線或者是蠟燭線,在開始時是流行於日本,應用在米價價位圖形的繪製畫法。它在繪製的方式上,除了如同 Bar Chart 圖標出了行情的開高低收的價位外,甚至於應用陰陽明暗與顏色區分於圖形上,以明顯地表達出行情的上漲或下跌,因此被稱之為陰陽線。同時也因為它所繪製出的商品價位圖,樣子像是一根一根蠟燭所組合起來的線圖,所以又被稱之為蠟燭線。
在K線圖的繪製上,相對於每日行情的每一根線圖上,上影線的最高部位,即為當日行情最高價位值的所在處;而下影線的最低部位,則為當日行情最低價位值的所在處。中間的實體部份的二端,則代表著開盤價與收盤價位值的所在處,同時以陰(實心黑色)與陽(空心紅色)來表示收盤價位相較於開盤價是下跌或是上漲。
[紅K棒]
1號K線:開最低、收最高
2號K線:實體很長,留有短短的上下影線
3號K線:最高價=收盤價,留有一條下影線。彈性:容許很短的上影線
4號K線:最低價=開盤價,留有一條上影線。彈性:容許很短的下影線
[黑K棒]
1號K線:開最高、收最低
2號K線:實體很長,留有短短的上下影線
3號K線:開最高、留有下影線。彈性:容許很短的上影線
4號K線:收最低、留有上影線。彈性:容許很短的下影線
加權指數的K棒是否也能給我們一些多空交易的訊號呢?首先來看一個統計數據
平均每一年這四種狀況的加總為 75 次 若區分為多空力道 ,則各有約 150次的攻擊訊號,這樣的訊號能否成為台指期的策略元素呢 ?
基本設定: 台指期 60 min K ,留倉策略 ,回測日期 2001/1~2013/10/31 ,交易成本 1200
inputs: NbarExit(20),ShadowRatio(0.18),TradeProfit(0.045),TradeStopLoss(0.035) ;
variables: BuySetupA(false), SellSetupA(false),BuySetupB(false), SellSetupB(false),BuySetupC(false), SellSetupC(false),BuySetupD(false), SellSetupD(false) ;
Vars:PFpoint(0),LossPoint(0) ,MP(0),IsBalanceDay(False),HB(0),LB(0),ExitL(0),ExitS(0);
PFPoint = AvgPrice*TradeProfit ;
LossPoint = AvgPrice*TradeStopLoss ;
MP = MarketPosition ;
if DAYofMonth(Date) > 14 and DAYofMonth(Date) < 22 and DAYofWeek(Date)= 3 then isBalanceDay = True else isBalanceDay =False ;
{ Data2 為加權指數 }
if DataCompression > 1 then Begin { 日K}
BuysetupA = (Open of Data2 = Low of Data2) ;
SellSetupA = (Open of Data2 = High of Data2) ;
BuysetupB = (Open-Low) < (High-Low)*ShadowRatio ;
SellSetupB = (High-Open) < (High-Low)*ShadowRatio ;
BuysetupC = (Close of Data2 = High of Data2) ;
SellSetupC = (Close of Data2 = Low of Data2) ;
BuysetupD = (High-Close) < (High-Low)*ShadowRatio ;
SellSetupD = (Close - Low) < (High-Low)*ShadowRatio ;
{記錄符合條件 K棒的高低點作進出依據 }
if BuySetupA or BuySetupC then Begin
HB = High ;
ExitL = Low-1 ;
end ;
if SellSetupA or SellSetupC then Begin
LB = Low ;
ExitS = High+1 ;
end;
end else Begin { 分K }
BuysetupA = (OpenD(0) of data2 = LowD(0) of data2 ) ;
SellSetupA = (OpenD(0)of data2 = HighD(0) of data2 ) ;
BuysetupB = (OpenD(0)-LowD(0)) < (HighD(0)-LowD(0))*ShadowRatio ;
SellSetupB = (HighD(0)-OpenD(0)) < (HighD(0)-LowD(0))*ShadowRatio ;
BuysetupC = (CloseD(0) of data2 = HighD(0) of data2 ) ;
SellSetupC = (CloseD(0)of data2 = LowD(0) of data2 ) ;
BuysetupD = (HighD(0)-CloseD(0)) < (HighD(0)-LowD(0))*ShadowRatio ;
SellSetupD = (CloseD(0) - LowD(0)) < (HighD(0)-LowD(0))*ShadowRatio ;
if BuySetupA or BuySetupC then Begin
HB = HighD(0) ;
ExitL = LowD(0) - 1;
end;
if SellSetupA or SellSetupC then Begin
LB = LowD(0) ;
ExitS = HighD(0) + 1 ;
end;
end;
{ 進出場 }
if BuySetUpA then Buy next bar at HB stop ;
if BarsSinceEntry = NBarExit then Exitlong next bar at Market ;
setstoploss(LossPoint*BigPointValue) ;
if IsBalanceDay then SetExitonClose ;
結論:
1.只作單邊的狀況 - 多單比空單好 ,有反手單比單獨平倉好
2. A條件(開低作多/開高作空)的趨勢強度比C條件(收高作多/收低作空)強
3.多空組合條件搭配平倉出場的組合比搭配出場反手單好
4.台指期本身的 K棒,讀者也可以搭配大盤K棒作測試
variables: BuySetupA(false), SellSetupA(false),BuySetupB(false), SellSetupB(false),BuySetupC(false), SellSetupC(false),BuySetupD(false), SellSetupD(false) ;
Vars:PFpoint(0),LossPoint(0) ,MP(0),IsBalanceDay(False),HB(0),LB(0),ExitL(0),ExitS(0);
PFPoint = AvgPrice*TradeProfit ;
LossPoint = AvgPrice*TradeStopLoss ;
MP = MarketPosition ;
if DAYofMonth(Date) > 14 and DAYofMonth(Date) < 22 and DAYofWeek(Date)= 3 then isBalanceDay = True else isBalanceDay =False ;
{ Data2 為加權指數 }
if DataCompression > 1 then Begin { 日K}
BuysetupA = (Open of Data2 = Low of Data2) ;
SellSetupA = (Open of Data2 = High of Data2) ;
BuysetupB = (Open-Low) < (High-Low)*ShadowRatio ;
SellSetupB = (High-Open) < (High-Low)*ShadowRatio ;
BuysetupC = (Close of Data2 = High of Data2) ;
SellSetupC = (Close of Data2 = Low of Data2) ;
BuysetupD = (High-Close) < (High-Low)*ShadowRatio ;
SellSetupD = (Close - Low) < (High-Low)*ShadowRatio ;
{記錄符合條件 K棒的高低點作進出依據 }
if BuySetupA or BuySetupC then Begin
HB = High ;
ExitL = Low-1 ;
end ;
if SellSetupA or SellSetupC then Begin
LB = Low ;
ExitS = High+1 ;
end;
end else Begin { 分K }
BuysetupA = (OpenD(0) of data2 = LowD(0) of data2 ) ;
SellSetupA = (OpenD(0)of data2 = HighD(0) of data2 ) ;
BuysetupB = (OpenD(0)-LowD(0)) < (HighD(0)-LowD(0))*ShadowRatio ;
SellSetupB = (HighD(0)-OpenD(0)) < (HighD(0)-LowD(0))*ShadowRatio ;
BuysetupC = (CloseD(0) of data2 = HighD(0) of data2 ) ;
SellSetupC = (CloseD(0)of data2 = LowD(0) of data2 ) ;
BuysetupD = (HighD(0)-CloseD(0)) < (HighD(0)-LowD(0))*ShadowRatio ;
SellSetupD = (CloseD(0) - LowD(0)) < (HighD(0)-LowD(0))*ShadowRatio ;
if BuySetupA or BuySetupC then Begin
HB = HighD(0) ;
ExitL = LowD(0) - 1;
end;
if SellSetupA or SellSetupC then Begin
LB = LowD(0) ;
ExitS = HighD(0) + 1 ;
end;
end;
{ 進出場 }
if BuySetUpA then Buy next bar at HB stop ;
if BarsSinceEntry = NBarExit then Exitlong next bar at Market ;
setstoploss(LossPoint*BigPointValue) ;
if IsBalanceDay then SetExitonClose ;
結論:
1.只作單邊的狀況 - 多單比空單好 ,有反手單比單獨平倉好
2. A條件(開低作多/開高作空)的趨勢強度比C條件(收高作多/收低作空)強
3.多空組合條件搭配平倉出場的組合比搭配出場反手單好
4.台指期本身的 K棒,讀者也可以搭配大盤K棒作測試
沒有留言:
張貼留言