1、以沪深300指数为信号,当收盘价在20天线以上时,开当月期指多单;2、当收盘价在20天线以下时,平多单,开当月期指空单。
ma20:ma(c,20);
if c>ma20 then begin
sellshort(holding<0,holding,market);
buy(holding=0,1,market);
end
if c<ma20 then begin
sell(holding>0,holding,market);
buyshort(holding=0,1,market);
end