相關標簽:說明:1.這是一個基于boll的交易系統(tǒng);
模型策略源碼://股指期貨自動交易程序(2分鐘BOLL日內趨勢交易系統(tǒng)) //編制: //日期:2012年5月27日定稿。 { //加密及期限 drawtextex(1,1,200,800,engincode()); rzb:=strcmp(engincode(),\'aaaaaaaaaa\'); if rzb<>0 then begin drawtextex(1,1,500,500,\'程序不能在此計算機上運行\(zhòng)'); exit; end 有效期:1121230,linethick0; 賬號:11111,linethick0; zhh:=strtonum(taccount(1)); if zhh<>賬號 then begin drawtextex(1,1,500,500,\'授權賬號不正確,程序無法使用\'); exit; end if date>有效期 then begin drawtextex(1,1,500,500,\'已過授權時間,程序無法使用\'); exit; end if datatype<>14 then begin drawtextex(1,1,50,950,\'本程序使用2分鐘周期,請切換到Mn周期\'); exit; end } //======================================================== //交易控制變量 variable:a1=1; variable:a2=1; //********************************** //交易手數: tn:=1; //最大持倉量 cx:=6; //提前下單量(秒) xd:=3; //交易時間區(qū)間 p1:=time>091500 and time<151000; p2:=if(islastbar,dynainfo(207),time); p3:=time0-timetot0(p2),linethick0; //******************************** r1:=barslast(date<>ref(date,1)); r2:=ref(o,r1); //******************************** hd:=if(islastbar,3,1.2); hd1:=if(islastbar,3,0.1); //******************************** cc:=(h+l+o+c)/4; mid:=ma(cc,26); upper:=mid+1.7*std(cc,26); lower:=mid-1.7*std(cc,26); //******************************** r12:=asset-ref(asset,135); r13:=valuewhen(r1=134,r12); if r13>6000*cx and a2>0 then begin a1:=barpos; a2:=-1; end r16:=if(barpos-a1>810,1,-1); if r16>0 and r1<2 then a2:=1; if abs(r2-c)>34 or (abs(r2-c)>24 and r1<40) then c6:=1; r17:=r16>0 or c6>0; //******************************** q2:=valuewhen(r1=0,sum(h-l,270)/270); r20:=upper-lower<6.5*q2; //******************************** nn:=4*q2; if holding>0 and o-l>=nn and enterbars>0 then begin sell(holding>0,holding,limitr,o-nn-hd); end if holding<0 and h-o>=nn and enterbars>0 then begin sellshort(holding<0,abs(holding),limitr,o+nn+hd); end //******************************** if c>upper and r20 and h-upper<3.5*q2 and p1 and p3<=xd and r17>0 then begin buy(holding<cx,tn,limitr,c+hd1); end if c<lower and r20 and lower-l<3.5*q2 and p1 and p3<=xd and r17>0 then begin buyshort(abs(holding)<cx,tn,limitr,c-hd1); end //--------------------------------- if holding>0 and l<mid then begin sell(1,0,limitr,c-hd1); end if holding<0 and h>mid then begin sellshort(1,0,limitr,c+hd1); end //******************************** //收盤前清倉 www.kzuj.com.cn if p2>=151300 then begin sellshort(holding<0,0,limitr,c+hd1); sell(holding>0,0,limitr,c-hd1); c6:=-1; c1:=1; end //************************************* 交易總數:totaltrade,colorwhite,linethick0; 盈虧:asset-1000000,colorred,linethick1,noaxis; 日盈虧:asset-ref(asset,r1+1),noaxis,colorred,linethick0; 持倉:holding,colorwhite,linethick0; rr1:=barslast(month<>ref(month,1)); 月盈利:asset-ref(asset,rr1+1),linethick0; variable:hc=0; 回撤:hhv(盈虧,30000)-盈虧,linethick0,coloryellow; if 回撤>hc then hc:=回撤; 最大回撤:hc,linethick0,coloryellow; 點擊復制上述代碼粘貼到到公式管理器
{別忘了將本網告訴您身邊的朋友,向朋友傳達有用資料,也是一種人情,你朋友會感謝你的。}