variable:mypos=0;
ma5:ma(c,5);
ma10:ma(c,10);
ma20:ma(c,20);
if mypos=2 and cross(ma10,ma5) then begin
sell(1,50%);
mypos:=1;
end;
if mypos>0 and cross(ma20,ma5) then begin
sell(1,100%);
mypos:=0;
end;
if mypos=0 and cross(ma5,ma20) then begin
buy(1,200);
mypos:=2;
end;
未测试,自己测试看看是否正确。