if cross(ma(c,5),ma(c,20)) then buy(holding=0,1,thisclose);
这个是个概念问题,不是写法问题,在盘中用thisclose,market之类的下单,都是按照当前价格下单
input:m(5),n(20);
ma5:ma(c,m);
ma10:ma(c,n);
if cross(ma5,ma10) then begin
sellshort(holding<0,0,thisclose);
buy(holding=0,1,thisclose);
end
if cross(ma10,ma5) then begin
sell(holding>0,0,thisclose);
buyshort(holding=0,1,thisclose);
end