策略思路:
LLT择时模型,低延迟趋势线,利用最近20个LLT指标数值,大部分LLT呈现上涨(斜率为正),做多;大部分下跌(斜率为负),做空;反向出场。
回测曲线(由Auto-Trader提供回测报告):
2017-3-17 11:28:34 上传
下载附件 (259.65 KB)
策略代码:
function LLTg(freq)targetList = traderGetTargetList();HandleList = traderGetHandleList();for i=1:length(targetList) marketposition=traderGetAccountPosition(HandleList(1),targetList(i).Market,targetList(i).Code); barnum=traderGetCurrentBar(targetList(i).Market,targetList(i).Code); len=60; dlen=60; [time,open,high,low,close,volume,turnover,openinterest] = traderGetKData(targetList(i).Market,targetList(i).Code,'min',freq, 0-len, 0,false,'FWard'); [Dtime,Dopen,Dhigh,Dlow,Dclose,Dvolume,Dturnover,Dopeninterest] = traderGetKData(targetList(i).Market,targetList(i).Code,'day',1, 0-dlen, 0,false,'FWard'); if length(close)lltv(1:end-1); con1=sum(k(end-20:end))>=fix(0.9*21)&&k(end)==1;%斜率为正,上升阶段 con2=sum(k(end-20:end))>=fix(0.1*21)&&k(end)==0; %斜率为负,下降阶段 shareNum=1; %% if marketposition==0 if con1 % traderBuy(HandleList(1),targetList(i).Market,targetList(i).Code,shareNum,0,'market','buy');%开多单 orderID = traderBuy(HandleList(1),targetList(i).Market,targetList(i).Code,shareNum,0,'market','1'); elseif con2 orderID = traderSellShort(HandleList(1),targetList(i).Market,targetList(i).Code,shareNum,0,'market','1'); end end if marketposition>0 &&con2 order= traderPositionTo(HandleList(1),targetList(i).Market,targetList(i).Code,0,0,'market','sell');%平多单 end if marketposition<0 &&con1 traderBuyToCover(HandleList(1),targetList(i).Market,targetList(i).Code,shareNum,0,'market','buytocover');%平空单 end endendfunction LLTv=LLT(price,a)LLTv=zeros(length(price),1);LLTv(1:2)=price(1:2);for i=3:length(price) LLTv(i)=(a-a^2/4)*price(i)+(a^2/2)*price(i-1)-(a-3*a^2/4)*price(i-2)+2*(1-a)*LLTv(i-1)-(1-a)^2*LLTv(i-2);endend
更多免费策略源码下载请登录DigQuant社区-策略资源下载~