2008年5月15日 星期四

Toby Crabel的當沖交易

聚財網看到一篇文章

內容是Toby Crabel著作中的其中一種交易方法

書名是

Day Trading With Short Term Price Patterns and Opening Range Breakout



圖片連結到亞瑪遜 賣的還真貴



聚財網友分享書中其中一種方法


原始連結點這




方法:

1. 每天計算期指的高低差(最高價-最低價)

2. 假設R7=(過去七個交易日的平均高低差)*0.5

3. 當天期指突破(開盤價+R7),則買進期指

4. 當天期指跌破(開盤價-R7),則放空期指

5. 假設以期指收盤價平倉,當沖不留倉。

6. 每天只交易一次,假設每次交易成本0.03%

7. 如果前一日高低差是過去七天的最大值,則當日不交易。



花一點時間寫成TS程式

回測條件 都跟以前一樣



說真的

不怎麼樣..900多次才120多萬

不過交易次數很高倒是真的..

在快1000次的交易下 還可已有這樣的獲利 實在是不錯..



附上TS原始碼 有興趣的自己玩

PS:程式加了停損條件..




vars:count(0);
vars:hldiff1(0),hldiff2(0),hldiff3(0),hldiff4(0),hldiff5(0),hldiff6(0),hldiff7(0);
vars:st(0),we(0),R7(0);

hldiff1=highd(1)-lowd(1);
hldiff2=highd(2)-lowd(2);
hldiff3=highd(3)-lowd(3);
hldiff4=highd(4)-lowd(4);
hldiff5=highd(5)-lowd(5);
hldiff6=highd(6)-lowd(6);
hldiff7=highd(7)-lowd(7);

R7=0.5*(hldiff1+hldiff2+hldiff3+hldiff4+hldiff5+hldiff6+hldiff7)/7;

st=opend(0)+r7;
we=opend(0)-r7;

if date[0] <> date[1] then begin
count = 0;
end;

if hldiff1>hldiff2 and hldiff1>hldiff3 and hldiff1>hldiff4 and hldiff1>hldiff5 and hldiff1>hldiff6 and hldiff1>hldiff7 then begin
count = 1;
end;

if time >845.00 and time<1345 .00="" and="" begin="" br="" count="0" marketposition="0" then="">
if h[1]>st and c>st then begin
buy("B") next bar at market;
count=count+1;
end;

if l[1] < we and c < we then begin
sell("S") next bar at market;
count=count+1;
end;

end;

if time >= 845.00 and time < 1340.00 and count = 1 then begin

if l[1] < we and c < we and marketposition > 0 then begin
exitlong("StopB") next bar at market;
end;

if h[1]>st and c>st and marketposition < 0 then begin
exitshort("StopS") next bar at market;
end;

end;

if marketposition > 0 and time = 1340.0 then begin
exitlong("XB") next bar at market;
end;
if marketposition < 0 and time = 1340.00 then begin
exitshort("XS") next bar at market;
end;
HEMiDEMi Technorati Del.icio.us MyShare?犖?貊惜 Yahoo