2018-04-20 16:19:03.236 20170407
2018-04-20 16:19:03.236 鲁西化工 :d1:390.60
2018-04-20 16:19:03.237 鲁西化工 :zg:383.80
2018-04-20 16:19:03.237 鲁西化工 :d0:390.60
2018-04-20 16:19:03.237 鲁西化工 :close:6.00
2018-04-20 16:19:03.237 20170407
2018-04-20 16:19:03.237 金禾实业 :d1:390.60
2018-04-20 16:19:03.237 金禾实业 :zg:383.80
2018-04-20 16:19:03.238 金禾实业 :d0:390.60
2018-04-20 16:19:03.238 金禾实业 :close:19.58
2018-04-20 16:19:03.238 20170407
2018-04-20 16:19:03.238 中国平安 :d1:390.60
2018-04-20 16:19:03.238 中国平安 :zg:383.80
2018-04-20 16:19:03.238 中国平安 :d0:390.60
2018-04-20 16:19:03.239 中国平安 :close:35.88
2018-04-20 16:19:03.245 20170410
2018-04-20 16:19:03.245 贵州茅台 :d1:243.77
2018-04-20 16:19:03.245 贵州茅台 :zg:382.22
2018-04-20 16:19:03.246 贵州茅台 :d0:390.60
2018-04-20 16:19:03.246 贵州茅台 :close:383.41
2018-04-20 16:19:03.246 20170410
2018-04-20 16:19:03.246 鲁西化工 :d1:390.60
2018-04-20 16:19:03.246 鲁西化工 :zg:382.22
2018-04-20 16:19:03.247 鲁西化工 :d0:390.60
2018-04-20 16:19:03.247 鲁西化工 :close:5.96
2018-04-20 16:19:03.247 20170410
2018-04-20 16:19:03.247 金禾实业 :d1:390.60
2018-04-20 16:19:03.247 金禾实业 :zg:382.22
2018-04-20 16:19:03.247 金禾实业 :d0:390.60
2018-04-20 16:19:03.248 金禾实业 :close:19.64
代码如下:
globalvariable:holdh=0;
globalvariable:jycs=0;
globalvariable:kscs=0;
v1:=intpart(100000/open/100)*100;
zg:=zig(4,20);
zt:=(c+0.01)/ref(c,1)>=1.1;
//zg
refzg1:=ref(zg,1);
refzg2:=ref(zg,2);
d1dian:=zg<refzg1 and refzg1>refzg2,noaxis;
d0bars:=barslast(d1dian)+1;
d0:=ref(refzg1,d0bars-1);
d1:=if(sum(l/d0<=0.8,d0bars)=0,ref(d0,d0bars+1),d0);
d1bars:=if(sum(l/d0<=0.8,d0bars)=0,ref(d0bars,d0bars+1)+d0bars,d0bars);
if cross(sum(l/d0<=0.8,d0bars),1) then kscs:=0;
if cross(sum(l/d0<=0.8,d0bars),1) then jycs:=0;
if d1dian then kscs:=0;
ma120:=ma(c,120);
kd:=d1=ref(d1,1) and c>d1 and llv(c,d1bars)/d1>=0.6 and c/d1<1.4,noaxis;
kd2:=sum(zt,3)=0 and h>ref(hhv(h,30),1) and jycs<1 and TBUYHOLDINGEX('','',2)=0 and kscs<1;
if kd2 and kd then begin
tbuy(1,v1,lmt,close);
holdh:=h;
jycs:=jycs+1;
end
enp:=tenterprice;
zs:=0.90;
izhisun:=enp*zs;
//止损
if TBUYHOLDINGEX('','',2)>0 and l/enp<=zs and tenterbars>0 then begin
tsell(1,0,lmt,min(enp*zs,open),0,'','');
end
//止损ma120
if TBUYHOLDINGEX('','',2)>0 and c<ma120 and tenterbars>0 and c>enp then begin
tsell(1,0,lmt,min(enp*zs,open),0,'','');
if c<enp then kscs:=kscs+1;
end
//多回调:止损+移动止赢
huitiao:=holdh*0.2;//回调20%止损
if TBUYHOLDINGEX('','',2)>0 and tenterbars>0 then
begin
if (holdh-l)>=huitiao then begin
if c<enp then kscs:=kscs+1;
tsell(1,0,lmt,min(holdh-huitiao,open),0,'','');
end
end
//最高浮动利润
if TBUYHOLDINGEX('','',2)>0 and tenterbars>0 then
begin
if high>holdh then holdh:=h;
end
if islastbar then begin
rq:=stkname;
DEBUGFILE('D:\test2\TEST.TXT',NUMTOSTR(YEAR*10000+MONTH*100+DAY,0),1);
debugfile('D:\test2\TEST.TXT',rq+' :d1:%.2f',d1);
debugfile('D:\test2\TEST.TXT',rq+' :zg:%.2f',zg);
debugfile('D:\test2\TEST.TXT',rq+' :d0:%.2f',d0);
debugfile('D:\test2\TEST.TXT',rq+' :close:%.2f',close);
end