收盘价上20天线开多,下破5天线平仓;
收盘价下20天线开空,上破5天线平仓;
ma5:ma(c,5);
ma20:ma(c,20);
if cross(c,ma20) then buy(holding=0,1,market);
if cross(ma5,c) then sell(1,0,market);
if cross(ma20,c) then buyshort(holding=0,1market);
if cross(c,ma5) then sellshort(1,0,market);
未变量的定义 market
要怎么定义啊
然后引用MACD,在开仓条件里面加上MACd>0
麻烦把这个也加上吧,谢谢
ma5:ma(c,5);
ma20:ma(c,20);
macd:=stkindi('','macd.macd1',0,datatype);
if cross(c,ma20) and macd>0 then buy(holding=0,1,market);
if cross(ma5,c) then sell(1,0,market);
if cross(ma20,c) and macd<0 then buyshort(holding=0,1,market);
if cross(c,ma5) then sellshort(1,0,market);