這個網誌, 主要是記錄我個人在期權方面的投資記錄和心得.
想透過忠實地紀錄, 確實檢討自己在投機路上的學習過程.....
執行 --> 結果 --> 檢討 --> 修正.
以期早日達到財富自由的目標.
至於生活周遭的其他事情, 不管是旅遊, 美食, 讀書...等等.
會記錄在這裡的, 僅會是少量文章.
讓這 BLOG 多點人性罷了~
在這裡, 除了網誌文章之外, 我還放了一些物件, 我認為值得推薦給各位 :
寫在最前面 - 2009.2.21 update
執行 --> 結果 --> 檢討 --> 修正.
以期早日達到財富自由的目標.
至於生活周遭的其他事情, 不管是旅遊, 美食, 讀書...等等.
會記錄在這裡的, 僅會是少量文章.
讓這 BLOG 多點人性罷了~
在這裡, 除了網誌文章之外, 我還放了一些物件, 我認為值得推薦給各位 :
TSTS星人在聚財網曾發佈一篇很不錯的程式教學文.
建議對程式交易有興趣的人一定要去看看.
網址 : EasyLanguage懶人包_CDP當沖實例講解.
我把原程式改為 TS8 的 programming code, 方便我做回測, 程式碼如下 :
input : stoploss(0.01),LengthL(30),LengthS(30);
variables : cdp(0),ah(0),nh(0),nl(0),al(0),longcount(0),shortcount(0);
if d<>d[1] then begin
cdp = (highD(1)+lowD(1)+2*CloseD(1))/4;
ah = cdp+(highD(1)-LowD(1));
//nh = cdp*2-LowD(1); no use this !
//nl = 2*cdp-highD(1); no use this !
al = cdp-(highD(1)-LowD(1));
longcount = 0;
shortcount = 0;
end;
condition1 = time > 0850 and time < 1340 and Close > Highest(high,LengthL)[1] and Longcount = 0;
condition2 = time > 0850 and time < 1340 and Close < Lowest(low,LengthS)[1] and shortcount = 0;
if condition1 then begin
Buy("CDP_B") 1 contracts next bar at ah+1 stop;
end;
if condition2 then begin
Sellshort("CDP_S") 1 contracts next bar at al-1 stop;
end;
if marketposition = 1 then begin
longcount = 1;
end;
if marketposition = -1 then begin
shortcount = -1;
end;
if marketposition = 1 then begin
Sell("S1L") 1 contracts next bar at entryprice*(1-stoploss) stop;
end;
if marketposition = -1 then begin
BuytoCover("S1S") 1 contracts next bar at entryprice*(1+stoploss) stop;
end;
{ ----- TSTS Original code -----}
if time = 1340 then begin
Sell("exitL") 1 contracts this bar at close;
Buytocover("exitS") 1 contracts this bar at close;
cdp = 0;
ah = 0;
nh = 0;
nl = 0;
al = 0;
end;
我將這個策略程式套進這八年的台指期貨指數, Total Net Profit 為 NT956000.
(買賣來回一趟含滑價, 共設 NT2000).
詳細績效如下 :
終於找到一個 windows live 套件, 可以順利在 Pixnet Blog 貼程式碼.
而且, 不用擔心程式碼有多長, 利用捲軸功能, 不會讓版面落落長.
這個套件是 : Code Snippet plugin for Windows Live Writer.
下載網址 : http://gallery.live.com/liveItemDetail.aspx?li=d4409446-af7f-42ec-aa20-78aa5bac4748&pl=8&bt=9
推薦給有使用 Pixnet 的格主.
試貼的程式碼簡介:(網路上抓來的)
Murrey Maths for Tradestation , 莫瑞數字密碼是現代江恩理論的典型應用.
研究江恩, 原作很重要, 但新江恩派在美國更具有吸引力.
以下是基於 TS 的原代碼.
試想一個簡單的日K線突破策略.
以昨日區間(最高價-最低價) 為 X.
如果今日開盤後漲過 X 的某個比例, 表示今日盤強, 於是買進做多.
如果今日開盤後跌破 X 的某個比例, 表示今日盤弱, 則賣出做空.
於是對這個極簡單的策略, 先要考慮兩點:
(1)比例多少?
設定太小, 策略太敏感, 交易次數會過於頻繁.
設定太大, 則要等到極強或極弱盤, 才會啟動買賣動作, 交易次數會很低.
粗略估計(憑手感), 這個比例先設為 0.8.
(2)停損:
因為這個策略的買賣觸發點僅靠當日盤勢 vs 昨日區間.
如果買進/賣出後, 每天盤勢緩緩跌/漲, 造成的虧損不可不小心.
所以, 停損方面先設個簡單數字 10000元(50點).
如上說明, 策略程式如下:
inputs : ST(0);
inputs : ratio(0.5);
value1=(high-low)*ratio;
if marketposition <> 1 then
buy next bar at open next bar + value1 + ST point stop;
if marketposition <>-1 then
sellshort next bar at open next bar - value1 + ST point stop;
setstoploss(10000);
試著建立一個指標和買賣策略如下:
如果開盤後漲 100點就買, 跌 100點就賣.
(注意: 是指以當日開盤為基準, 盤中走勢掌或跌 100點論, 而非以昨天收盤當基準點).
HTS 的用戶都知道, HTS 存在著 this bar 的 bug.
大概是太受了這個出了名的 bug 影響吧~ 所以…連在一些拍賣網兜售的程式都一定要註明該程式使用 next bar 而非 this bar.
所以, 你可能指標會這麼寫 :
plot1(open+100,"O+R");
plot2(open-100,"O-R");
買賣策略會這麼寫 :
buy next bar at (open+100) stop;
sellshort next bar at (open-100) stop;
程式都很短, 花五秒鐘看一下程式…
乍看之下, 好像沒什麼問題.
投資理財(6)
閱讀心得_書/電影/其他(3)