if cross(ma5,ma10) and b1=0 then begin
buy(holding=0,1,market);
b1:=1;
end
//5日均线上穿10日的时候开仓
if c>=AVGENTERPRICE*1.05 then sell(holding>0,0,market);//上涨5%后平仓,也就是现价是持仓均价的1.05%时平仓
if openprofit<0 and cross(ma5,ma10) and holding>0 and b1=1 then begin
buy(1,1,market);
a1:=a1+1;
end //当亏损的时候持有接着补,记录补仓次数
s1:=numtostr(a1,1);
msgout(islastbar and holding<>ref(holding,1) ,s1);
ma5:=ma(c,5);
ma10:=ma(c,10);
variable:a1=0,b1=0;
if cross(ma5,ma10) and b1=0 then begin
buy(holding=0,1,market);
b1:=1;
end
//5日均线上穿10日的时候开仓
if c>=AVGENTERPRICE*1.05 then sell(holding>0,0,market);//上涨5%后平仓,也就是现价是持仓均价的1.05%时平仓
if openprofit<0 and cross(ma5,ma10) and holding>0 and b1=1 then begin
buy(1,1,market);
a1:=a1+1;
end //当亏损的时候持有接着补,记录补仓次数
s1:=numtostr(a1,1);
msgout(islastbar and holding<>ref(holding,1) ,s1);
发现少了几句,开头少了。。。