老师,怎么写出如下程序:
在5分钟K线上,如果连续10个K线的收盘价大于(站在)20日均线上,下个周期开盘开多,跌破5日均线平仓;
如果连续10个K线的收盘价小于20日均线下,下个周期开盘开空,升破5日均线平仓;
十分感谢!
ma20:=ma(c,20);
ma5:=ma(c,5);
if ref(all(close>ma20,10),1) then buy(holding=0,1,market);
if holding>0 and cross(ma5,c) then sell(1,0,market);
if ref(all(close<ma20,10),1) then buyshort(holding=0,1,market);
if holding<0 and cross(c,ma5) then sellshort(1,0,market);