[討論] 使用 DMI 進出
寫出來績效不是很好看, 單純跟大家討論討論
方法:
DATA 1: 台指 60分K
DATA 2: 加權指數 1 D
DMI 使用 DATA 2 計算
一口單, 多空對翻
手續費 800
回測區間: 2011/1/31--2015/6/2
規則: DMI+ 向上穿過 DMI- 進多單
DMI+ 向下穿越 DMI- 進空單
若 DMI+ 今日較昨日低, 且手上有多單, 則反手
(還有昨天跟前天比較)
若 DMI- 今日較昨日高, 且手上有空單, 則反手
(還有昨天跟前天比較)
出來的曲線 在2013年出現最高峰,
2015 根本是慘敗
有試過加入停損翻單的語法, 不過又是個 45度角向下的醜醜圖....
以下是 MC CODE
inputs:
Length( 14 );
condition1=dmiplus(length)of data2 crosses above dmiMinus(length)of data2;
condition2=dmiplus(length)of data2 crosses below dmiMinus(length)of data2;
if condition1 then
buy ("buy") next bar at market;
if condition2 then
sellshort ("short") next bar at market;
condition3=dmiplus(length) of data2 < dmiplus(length)of data2[1];
condition4=dmiplus(length) of data2[1] < dmiplus(length)of data2[2];
{condition5=dmiplus(length) [2] < dmiplus(length)[3];}
condition6=dmiminus(length) of data2> dmiminus(length)of data2[1];
condition7=dmiminus(length)[1]of data2 > dmiminus(length)of data2[2];
{condition8=dmiplus(length) [2] < dmiplus(length)[3];}
condition9=dmiplus(length)<DMIMinus(length);
if barssinceentry(0)>4 then begin
if marketposition=1 then
if condition3 and condition4 {and condition5} and condition9=true then
sellshort("Enter_short") next bar at market;
if marketposition=-1 then
if condition6 and condition7 {and condition8} and condition9=false then
buy("enter_long") next bar at market;
end;
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 123.192.240.248
※ 文章網址: https://www.ptt.cc/bbs/Trading/M.1436548778.A.DCD.html
→
07/11 12:15, , 1F
07/11 12:15, 1F
推
07/30 10:28, , 2F
07/30 10:28, 2F
→
07/30 10:28, , 3F
07/30 10:28, 3F
→
07/30 10:28, , 4F
07/30 10:28, 4F
→
07/30 10:28, , 5F
07/30 10:28, 5F
→
07/30 10:28, , 6F
07/30 10:28, 6F
推
07/31 00:45, , 7F
07/31 00:45, 7F
→
07/31 00:46, , 8F
07/31 00:46, 8F
→
08/02 17:11, , 9F
08/02 17:11, 9F
推
08/10 07:14, , 10F
08/10 07:14, 10F
→
08/10 07:14, , 11F
08/10 07:14, 11F
→
08/10 07:14, , 12F
08/10 07:14, 12F