美國交易冠軍Mark Minervini取得驚人的績效成績,
在台灣寰宇有將他的書翻譯,
一共有3本,其中1與2詳細介紹他的方法,3為問答形式,
詳細不再贅述,大致上是
股價再噴出之前會經過波動率收縮的過程,當波動率驟升突破壓力區時便是追進的時刻,
在書中稱為波動率收縮(VCP),馬克也是參考威廉歐尼爾的杯狀帶柄型態,
除此之外還有勝率、盈虧比、部位控制等概念,
技術分析上來說在上升一段漲勢後,重新盤整整理籌碼的過程,在即將整理完成時會有波動性收縮的特徵,
和李佛摩所說的最小阻力線相似,還有和常見的一段漲勢後常見的整理型態(上升旗型,杯狀代柄)類似,接有整理到後面波動收縮的特徵
而應用在台股的範例中有2021/04/07的中鋼
形成這種太大致分成幾個階段
1)一段漲勢
而要用程式去辨別常見的有 a.均線多頭排列 b.須贏過大盤一定的強度 c.量能開始增加
2)開始波動收縮洗籌碼
a.在洗籌碼的過程量慢慢縮減 b.波動性收縮(可以用布林通道寬度收縮辨別)
3)一根長紅K漲勢
a.量能突然增加 b.創新高
那用XQ來寫入,回測富櫃200
其中加入籌碼的濾網,程式碼如下
var:top(0),bbuycount(0),ssellcount(0),count(0),bbuyy(0),ssell(0);
var: long_condition(false),out_condition(false);
variable: intrabarpersist Xtime(0);
var: intrabarpersist day_count(0);
value1 = Average(TrueRange, 5)[1];
value2=value1/close[1]*100;
value3=GetField("主力買賣超張數", "D");
value4=GetField("散戶買賣超張數","D");
for count = 1 to 20
Begin
if value3[count]<=0 then begin
ssell=ssell+value3[count];
ssellcount+=1;
end;
if value3[count]>0 then begin
bbuyy=bbuyy+value3[count];
bbuycount+=1;
end;
End;
long_condition= value4[1]<0 and value3[1]>0 and close[1]<100 and close[1]>50 and Volume[1]>3000 and close[1]>close[2]*1.05 and average(close,50)[1]>average(close,100)[1] and average(close,100)[1]>average(close,200)[1]
and AVerage(Volume,3)[1]>=highest(volume,120)[4]*0.7 and Volume[1]>AVerage(volume,120)[1]*3 and close[1]>=highest(close,20)[2] and bollingerBandWidth(close,9,2,2)[2]<15 and bbuyy>ssell*2 ;
out_condition= close>=FilledAvgPrice*1.15 or close<=FilledAvgPrice*0.94 or day_count>=15;
if filled <> 0 and getfield("Time", "1") = 090000 then day_count+=1;
if long_condition and filled = 0 then begin
setposition(1, market);
day_count = 1;
end;
if filled > 0 and out_condition then begin
day_count = 1;
setposition(0, market);
end;
回測結果如下
獲利前幾名
虧損前幾名
改進方案:
交易次數不納入考慮,因為僅回測富櫃200,基本上目標將盈虧比拉高,在持倉規則上改進,並將其應用到1700檔全部股票中
------------------------------------------------------------------------------------------------------------------------------------
改進之程式碼如下
input:period(20,"計算TrueRange的區間"),N(2,"N倍通道");
input:period2(10,"計算TrueRange的區間"),N2(2,"N倍通道");
var:long_condition(false),out_condition(false) ;
var: intraBarPersist stoploss(1000);
var: intraBarPersist count(1000);
var: sttop(0),up(0),down(0),down2(0);
// 資料讀取筆數設定
settotalbar(period + 3);
value5=GetField("主力買賣超張數", "D");
value6=GetField("融資維持率");
up = bollingerband(Close, 20, 1.8);
down = bollingerband(Close, 20, -1);
down2 = average(close,10)[1];
long_condition=value5[1]>Volume[1]*0.1 and close[1]<100 and close[1]>50 and volume[1]>3000 and average(close,100)>average(close,200) and average(close,50)>average(close,100) and close[1]>=highest(close[2],120) and average(volume[1],120)>1000
and close[1] > up[1] and close[2] < up[2] and bollingerBandWidth(close,20,2,2)[2]<20 and bollingerBandWidth(close,20,2,2)[2]<highest(bollingerBandWidth(close,20,2,2)[2],30)*0.5 and (value6[2]+value6[3]+value6[4])/3<175;
if filled <> 0 and getfield("Time", "1") = 090000 then count+=1;
if close[1]<filledAvgPrice*1.1 then begin
if down2<=filledAvgPrice*0.9 then begin
stoploss=filledAvgPrice*0.9;
end else if down2>filledAvgPrice*0.9 then stoploss=down2;
out_condition=close<stoploss;
end;
if close[1]>=filledAvgPrice*1.1 then begin stoploss=down2;
out_condition=close[1]<stoploss or close>filledAvgPrice*1.35;
end;
if long_condition and filled=0 and getfield("Time", "1") = 090000 then begin
stoploss=filledAvgPrice*0.9;
setposition(1);
count=1;
end;
if filled>0 and out_condition then begin
setposition(0);
count=1;
end;
if filled>0 and count=4 and close[1]<filledAvgPrice then setposition(0);
只回測50~100股價的股票
進場條件有
1.主力買超超過長紅K成交量10% 2.成交量長紅K超過3000張 3.多頭排列(100均>200均,50均>100均)但這裡事後看寫得不太好,應該用close[1]來算比較準確
4.長紅K收盤價創120日新高 5.120日平均成交量大於1000,為了避免冷門股 6.長紅K剛突破20日布林通道(標準差1.8) 7.布林通道寬度長紅K前天<20%
8.布林通道寬度長紅K前天為最近30日最高的布林寬度的一半,目的為波動度收縮濾網 9.融資維持率最近三日需<175%,怕融資維持率過高融資人獲利了結
出場條件有
1.虧損超過10% 2.獲利超過35% 3.若第三天收盤價低於成本價,第四天開盤出場
4.取昨日十日均線值和成本價*0.9較高者作為停損點
回測結果
交易成本設為0.6% 每次皆以一張為單位下單
獲利前幾名
虧損前幾名
改進目標:將均線寫法更改average(close,100)改成average(close[1],100)
------------------------------------------------------------------------------------------------------------------------------------
程式碼同上做更改結果
交易次數變稍多些,獲利因子2.7也不錯,勝率3成多和馬克書上寫得差不多,基本上趨勢策略勝率不會太高
但盈虧比4.36把低勝率凹回。
而將回測股價設為20~50之間,成交量濾網提高為兩倍結果
成果稍差些,但還算能接受。
改進目標:將進出場數量改為20萬能買的最大張數,因為計算報酬率用100萬起始資金計算,每次買入1/5部位為20萬。
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
程式如上更改結果
計算報酬率上更為準確些