老师:收盘价上穿日线开盘价做多,100跳止盈,30跳止损反手做空,100跳止盈,30跳反手做多,100跳止盈,30跳反手做空;一天多空各做两单,收盘前清仓
VARIABLE:ct1:=0,ct2:=0;//全局变量用来限制交易次数
dayclose:CALLSTOCK('',vtCLOSE,6,0);
jc:cross(c,DAYCLOSE);
if jc and holding=0 and ct1<=1 then
begin
buy(jc and holding=0 and CT1<=1,1,market);
ct1:=ct1+1;
end
dyzy:c-ENTERPRICE>=100*MINDIFF;
dtzs:ENTERPRICE-c>=30*MINDIFF;
sell(dyzy and holding>0,holding,market);
if dtzs and holding>0 then
begin
sell(dtzs and holding>0,holding,market);
buyshort(holding=0 and ct2<=1,1,market);
ct2:=ct2+1;
end
ktzy:=ENTERPRICE-c>=100*MINDIFF;//空头止盈
ktzs:=c-ENTERPRICE>=30*MINDIFF;
sellshort(ktzy and holding<0,holding,market);
if ktzs and holding<0 then
begin
sellshort(ktzs and holding<0,holding,market);
buy(holding=0 and ct1<=1,1,market);
ct1:=ct1+1;
end
if time=CLOSETIME(0) then //收盘K重置全局变量 2点全平仓 这个收盘时间自行调整下。
begin
ct1:=0;
ct2:=0;
sellshort(holding<0,holding,market);
sell(holding>0,holding,market);
end
自行调整下收盘那个时间,如果是国内期货就不用改了。