這應該算是基本的當沖交易策略,邏輯很簡單,取開盤一段時間之後的高低點,突破高點就買進跌破低點就賣出,幾乎每個使用程式的操盤人都有一個類似這樣的交易策略
以下範例是寫成Multicharts的語法
input:tt(0945);
vars:Ho(0),Lo(0);
在開盤後一段時間之內取高低點 設定為變數
if time>=0845 and time<tt then begin
Ho=highD(0);
Lo=lowD(0);
end;
if EntriesToday(date)=0 and time>tt and time<1300 then buy next bar at Ho stop; 當天交易次數為0 且突破設定的最高點買進多單
if EntriesToday(date)=0 and time>tt and time<1300 then sellshort next bar at Lo stop; 當天交易次數為0 且突破設定的最高低買進空單
當然也可以加上一些濾網 或是其他的條件
if marketposition=0 and time>tt and time<1245 then buy next bar at Ho+Ho*0.002 stop;
if marketposition=0 and time>tt and time<1245 then sellshort next bar at Lo-Lo*0.002 stop;
設定停損,可以用固定點數或是用百分比
if marketposition=1 then sell next bar at entryprice*(1-stoploss) stop;
if marketposition=-1 then buytocover next bar at entryprice*(1+stoploss) stop;
setstoploss(30*bigpointvalue);
也可以加上移動停損停利,假設從高點折返一定的ATR當作出場
if marketposition=1 then sell next bar at highD(0)-avgtruerange(10) stop;
if marketposition=-1 then buytocover next bar at lowD(0)+avgtruerange(10) stop;
如果是當沖要加上收盤前出場
if time>1330 and marketposition<>0 then begin
sell next bar at market;
buytocover next bar at market;
end;
setexitonclose;
這個策略用在2014的台指期是不會賺錢的,因為區間波動太小了,如果太晚進來這個市場也不要覺得遺憾,未來還是有機會,建議套用到其他的市場或其他商品,也許有更好的可能
最近看了一部日劇,阿部寬演的下町火箭;描述的是一群對研發火箭有興趣的人員,對追求夢想的熱情,對專業的堅持,以及對工作的態度。看完了之後真的是熱血沸騰啊,想想在同一個工作領域待了很久的自己,是否還保有當初的那份理想呢? 對於研發程式交易的興趣是否還存在~~就算前面100次的研發都失敗,只要最後一次成功,一切的努力都是值得的