-- 作者:zg611029
-- 发布时间:2012/6/20 14:55:41
-- [分享]小二子交易法(附源码)
这是一个非常简单的交易方法,他揭示了期货交易的真低:顺势而为,有错必纠。
交易原理:阳线开多仓,阴线开空仓。
参数:止损点数:8
此主题相关图片如下:qq截图20120620144049.png
 (3分钟周期,没有考虑交易滑点,手续费0.05%%)
代码如下:
//股指期货自动交易程序 //编制: //日期:2012年6月20日
{ //加密及期限 有效期:1121230,linethick0; 账号:11111,linethick0; qq1:=strtonum(taccount( 1)); if qq1<>账号 or date>=有效期 or datatype<>18 then exit; } if datatype<>17 then exit;
//交易控制变量 variable:a1=0; variable:a2=0;
//交易手数: tn:=1;
//持续下单次数 cx:=1;
//提前下单量(秒) xd:=3;
//交易时间区间 p1:=time>091500 and time<=150000; p2:=if(islastbar,dynainfo(207),time); p3:time0-timetot0(p2)linethick0;
// r1:=barslast(date<>ref(date,1)); r2:=ref(o,r1);
if c>o and p1 and p3<=xd then begin buy(holding=0,tn,thisclose); end if c<o and p1 and p3<=xd then begin buyshort(holding=0,tn,thisclose); end
//止损 r20:=enterbars+1; r21:=ref(hhv(c,r20),1); r22:=ref(llv(c,r20),1); r23:=8; if holding>0 and r21-l>r23 and r20>1 and p3<=xd then begin sell(1,tn,thisclose); end if holding<0 and h-r22>r23 and r20>1 and p3<=xd then begin sellshort(1,tn,thisclose); end
//收盘前清仓 r50:=abs(holding); if p2>150800 then begin sellshort(holding<0,r50,limitr,c); sell(holding>0,r50,limitr,c); end 持仓:holding,colorwhite,linethick0; 交易总数:totaltrade,colorwhite,linethick0; 盈亏:asset-1000000,noaxis,colorred,linethick1; 日盈亏:asset-ref(asset,r1),noaxis,colorred,linethick0;
//状态1:a1,linethick0,colorwhite; //状态2:a2,linethick0,colorwhite;
[此贴子已经被作者于2012-6-20 15:01:55编辑过]
|