MA1:=MA(CLOSE,A);
MA2:=MA(CLOSE,B);
DIFF :=EMA(CLOSE,S) - EMA(CLOSE,P);
DEA :=EMA(DIFF,M);
MACD :=2*(DIFF-DEA);
手数:=ss;
variable:bj=0;
if cross(ma1,ma2) then bj:=1;
if cross(ma2,ma1) then bj:=-1;
if cross(macd,0) and bj=1 then begin
sellshort(1,0,marketr);
buy(holding=0,ss,marketr);
end
if cross(0,macd) and bj=-1 then begin
sell(1,0,marketr);
buyshort(holding=0,ss,marketr);
end