| --  作者:zm71212302 --  发布时间:2014/11/24 13:58:39
 --  请管理进来帮忙查看一下代码是否有问题
 
 huichechangliang:=3;//回撤值常量开仓点差:h-TENTERPRICE,LINETHICK0;
 if cross(TOPENPROFIT,3000) THEN extgbdataset(\'huichechangliang\',3.5);
 {多头回撤平仓}
 if h-TENTERPRICE>huichechangliang and tbuyholding(0)>0 and extgbdata(\'jiluqi22\')=0 then begin
 extgbdataset(\'tiqujia\',h);//
 extgbdataset(\'jiluqi22\',1);
 end//记录器
 if h>extgbdata(\'tiqujia\') and tbuyholding(0)>0 then extgbdataset(\'tiqujia\',h);
 if l<(extgbdata(\'tiqujia\')-huichechangliang) and tbuyholding(0)>0 then begin
 tsell(1,0,mkt),orderqueue;
 extgbdataset(\'jiluqi22\',0);
 DEBUGFILE(\'C:\\st1\\ST11.TXT\',\'多头回撤平仓%.2f\',1);
 end
 {空头回撤平仓}
 if TENTERPRICE-l>huichechangliang and TSELLHOLDING(0)>0 and extgbdata(\'jiluqi22\')=0 then begin
 extgbdataset(\'tiqujia\',l);
 extgbdataset(\'jiluqi22\',1);
 end
 if l<extgbdata(\'tiqujia\') and TSELLHOLDING(0)>0 then extgbdataset(\'tiqujia\',l);
 if h>(extgbdata(\'tiqujia\')+huichechangliang) and TSELLHOLDING(0)>0 then begin
 TSELLSHORT(1,0,mkt),orderqueue;
 extgbdataset(\'jiluqi22\',0);
 DEBUGFILE(\'C:\\st1\\ST11.TXT\',\'空头回撤平仓%.2f\',1);
 end
 {------------------停损交易-----------------------}zhisunjiaoyi:=0;//停止交易
 if date<>ref(date,1) then dangqianzich:=tasset;//当前资产
 kechengshouk:=dangqianzich*0.025;//可亏损承受
 if cross(dangqianzich-tasset,kechengshouk) then begin
 tsell(TBUYHOLDING(1)>0,0,mkt);
 tsellshort(TSELLHOLDING(1)<0,0,mkt);
 extgbdataset(\'zhisunjiaoyi\',1);
 DEBUGFILE(\'C:\\st1\\ST11.TXT\',\'停损交易%.2f\',1);
 end
 {----------------------移动止损----------------------}
 zhisunch:=5;//止损常量
 kaidansu:=1;//kaidansu
 if cross(tasset-dangqianzich,1800) THEN zhisunch:=5;
 止损位:TENTERPRICE-zhisunch,LINETHICK0;
 if TENTERPRICE-zhisunch and TBUYHOLDING(1)>0 then tsell(1,0,mkt);//多清
 if TENTERPRICE+zhisunch and TSELLHOLDING(1)>0 then tsellshort(1,0,mkt);//空清
 {------------------------------------------------------}
 平仓历时:TEXITBARS(1),LINETHICK0;
 实际持仓:tholding2,LINETHICK0;
 if tholding>0 then tsell(平多 or 平多1 or 开空,0,lmt,l),orderqueue;//多平
 if tholding<0 then tsellshort(平空 or 平空1 or 开多,0,lmt,h),orderqueue;//空平
 fenmiaok:TIMETOT0(DYNAINFO(207))-TEXITBARS(1),LINETHICK0;//分秒
 huansuan:=2;//换算
 if TEXITBARS(1)>0 and fenmiaok<10 THEN extgbdataset(\'huansuan\',0);
 if TEXITBARS(1)>0 and fenmiaok>10 then extgbdataset(\'huansuan\',1);
 if entertime then BEGIN
 if tholding2=0 and zhisunjiaoyi=0 and huansuan>0 then Tbuyshort(开空,kaidansu,lmt,l),orderqueue;//多平
 if tholding2=0 and zhisunjiaoyi=0 and huansuan>0 then tbuy(开多,kaidansu,lmt,h),orderqueue;//空平
 end
 {--------------------时间平仓----------------------}
 if  exittime then BEGIN
 tsell(TBUYHOLDING(1)>0,0,mkt);//多清
 tsellshort(TSELLHOLDING(1)>0,0,mkt);//空清
 end
 
 |