1501  

程式交易語法範例,用RSI指標當做進出場依據的當沖程式

if time>CalcTime(sess1starttime,15) and time<calctime(sess1endtime,-45) then begin (sess1starttime指開盤時間, sess1endtime指收盤時間)
if RSI(14)<20 then sellshort("S") next bar at market;   RSI<20就買進空單
if RSI(14)>80 then buy("B") next bar at market;    RSI>80就買進多單
end;
if marketposition=1 then begin  多單停利停損
sell next bar entryprice - 30 stop;
sell next bar entryprice + 60 limit;
end;
if marketposition=-1 then begin  空單停利停損
buytocover next bar entryprice + 30 stop;
buytocover next bar entryprice - 60  limit;
end;
if time>1330 and marketposition<>0 then begin  過了13:30之後 所有部位平倉
sell next bar at market;
buytocover next bar at market;
end;
setexitonclose;

回測績效評估,績效表現差強人意,但事實證明了RSI的指標用法不是像書上所說的80以上找空點,20下找買點,反而是要逆向思考

1498  

勝率和盈虧比: 通常勝率高,盈虧比會下降,勝率低,盈虧比反而高;所以不要太迷信高勝率的程式

1499  

input: XX  YY  (開放成可修改的參數,可以最佳化調整)

sell next bar entryprice - XX stop;
sell next bar entryprice + YY limit;

buytocover next bar entryprice + XX stop;
buytocover next bar entryprice - YY  limit;

multicharts的好處之一就是可以透過回測印證交易邏輯的可行性,找到適合的操作方式,運用科學的計量方法統計出一套可行的交易。

之前聽前輩說過,在股市裡面要學習成長,最好老師就是市場~~嗯嗯

 

arrow
arrow

    元大期貨楊宗儒 發表在 痞客邦 留言(0) 人氣()