1.
ma60:ma(c,60);
cond1:cross(c,ma60);
cond2:cross(ma60,c);
if cond2 then
begin
buyshort(holding=0,1,market);
end
if cond1 then
begin
sellshort(holding<0,holding,market);
end
2.
ma60:ma(c,60);
cond1:cross(c,ma60);
cond2:cross(ma60,c);
if cond1 then
begin
buy(holding=0,1,market);
end
if cond2 then
begin
sell(holding>0,holding,market);
end
3.
ma60:ma(c,60);
cond1:cross(c,ma60);
cond2:cross(ma60,c);
if cond2 then
begin
sell(holding>0,holding,market);
buyshort(holding=0,1,market);
end
if cond1 then
begin
sellshort(holding<0,holding,market);
buy(holding=0,1,market);
end
3和4代码上是一样的。