此主题相关图片如下:qq截图20121221144952.png

各位高手,我想写一个20日均线的交易模型,也就是说,一根20日均线,如图,低的时候就买进,高的时候就卖出!!要怎么写?请帮忙!
照收盘价在20日均线上买入,收盘价跌破20日均线卖出
ma20:=ma(c,20);
sell(holding>0 and cross(ma20,c),holding,market);
sellshort(holding<0 and cross(c,ma20),holding,market);
buy(holding=0 and cross(c,ma20),1,market);
buyshort(holding=0 and cross(ma20,c),1,market);