在开盘价上方设置5条线,每条线间隔5个单位,开盘时,在开盘价and60日均线处买开1手,上去盈利3个点平仓,返回来来时,则在第1次开仓的地方重新买开1手,如果没有被平仓,在这个地方则不在买入,如果上去盈利3个点平仓后继续往上走,则在第2条线上买开1手,平仓后到第2条线中间不在开仓,后面继续重复以上操作
variable:n=0,m1=0,m2=0,m3=0;
oo:=VALUEWHEN(todaybar=1,o);
ma60:=ma(c,60);
if c>oo+5 and c>ma60 then begin
buy(1,1,market);
end
if c>oo+10 and c>ma60 then begin
buy(1,1,market);
end
if c>oo+15 and c>ma60 then begin
buy(1,1,market);
end
if c>oo+20 and c>ma60 then begin
buy(1,1,market);
end
if c>oo+25 and c>ma60 then begin
buy(1,1,market);
end
就会这么点,老师,麻烦了,谢谢老师
variable:n=0,m1=0,m2=0,m3=0;
oo:=VALUEWHEN(todaybar=1,o);
ma60:=ma(c,60);
if c>oo+5 and c>ma60 and holding=0 then begin
buy(1,1,market);
end
if c>oo+10 and c>ma60 and holding=0 then begin
buy(1,1,market);
end
if c>oo+15 and c>ma60 and holding=0 then begin
buy(1,1,market);
end
if c>oo+20 and c>ma60 and holding=0 then begin
buy(1,1,market);
end
if c>oo+25 and c>ma60 and hodling=0 then begin
buy(1,1,market);
end
if c>enterprice+3 then then sell(1,0,market);
如果开空,则就是;variable:n=0,m1=0,m2=0,m3=0;
oo:=VALUEWHEN(todaybar=1,o);
ma60:=ma(c,60);
if c<oo-5 and c<ma60 and holding=0 then begin
buyshort(1,1,market);
end
if c<oo-10 and c<ma60 and holding=0 then begin
buyshort(1,1,market);
end
if c<oo-15 and c<ma60 and holding=0 then begin
buyshort(1,1,market);
end
if c<oo-20 and c<ma60 and holding=0 then begin
buyshort(1,1,market);
end
if c<oo-25 and c<ma60 and holding=0 then begin
buyshort(1,1,market);
end
if c<enterprice-3 then sellshort(1,0,market);
那老师,如果加1个条件每天3点钟之前30秒清仓,怎么写??
if ((timetot0(dynainfo(207))>=time0-30) or not(islastbar)) and time=closetime(0) then begin
sell(1,0,market);
sellshort(1,0,market);
end
[此贴子已经被作者于2015/11/16 13:30:39编辑过]
老师,你看一下,我的这个命令怎么在同一价位成交了2次
GLOBALVARIABLE:n1=0,n2=0,n3=0;
GLOBALVARIABLE:tt1=0,tt2=0,tt3=0;
oo:=VALUEWHEN(todaybar=1,o);
ma60:=ma(c,60);
if c>oo+1*mindiff and c>ma60 and n1=0 and
time<>tt1 then begin
tbuy(1,1,mkt);
n1:=1;
tt1:=time;
end
if c>oo+2*mindiff and c>ma60 and n2=0 and
time<>tt2 then begin
tbuy(1,2,mkt);
n2:=1;
tt2:=TIME;
END
if c>oo+3*mindiff and c>ma60 and n3=0 and
time<>tt3 then begin
tbuy(1,3,mkt);
n3:=1;
tt3:=time;
end
if time=closetime(0) then begin
n1:=0;
n2:=0;
n3:=0;
tt1:=0;
tt2:=0;
tt3:=0;
end
什么叫“成交了2次”?一个单子分两次成交的?
[此贴子已经被作者于2015/11/16 14:12:16编辑过]
不是,我写的达到条件后一个命名只成交1次,为什么它执行了2次,还有,平仓的时候亏着平仓呢,
GLOBALVARIABLE:num=0;
PD:=(DYNAINFO(7)-TAVGENTERPRICEEX2('','',0))*TBUYHOLDING(1)*DYNAINFO(209)>500;
debugfile('D:\test.txt','当前盈亏为%.2f',TOPENPROFIT);
盈亏:=(DYNAINFO(7)-TAVGENTERPRICEEX2('','',0))*TBUYHOLDING(1)*DYNAINFO(209);
debugfile('D:\test2.txt','当前盈亏为%.2f',盈亏);
if PD
and tbuyholding(1)>0 and num=0 THEN begin
tsell(1,5,mkt);
num:=1;
end
PD2:=(DYNAINFO(7)-TAVGENTERPRICEEX2('','',0))*TBUYHOLDING(1)*DYNAINFO(209)>1000;
if PD2
and tbuyholding(1)>0 and num=1 THEN begin
tsell(1,10,mkt);
num:=2;
end
PD3:=(DYNAINFO(7)-TAVGENTERPRICEEX2('','',0))*TBUYHOLDING(1)*DYNAINFO(209)>2000;
if PD3
and tbuyholding(1)>0 THEN begin
tsell(1,TbuyHOLDING(1),mkt);
end
1为什么下单了两次:看下单日志里面的记录情况
2为什么不满足条件但是平仓了:贴调试记录,看看调试的情况是什么样的