ma9:ma(c,987);
if max(o,c)<ma9 and isdown then buyshort(holding=0,10,marketr);
if min(o,c)>ma9 and isup then sellshort(holding=10,10,marketr);
if min(o,c)>ma9 and isup then sellshort(holding=10,10,marketr);
红色部分。使用HOLDING作为限制,空仓是负数,多仓是正数,没有仓位时0
开空条件:=cross(ma(c,60),c) and c<o;
平空条件:=cross(c,ma(c,60)) and c>o;
buyshort(开空条件,1,marketr);
sellshort(平空条件,1,marketr);