老师这是开平仓条件,在持仓的情况下,再次符合开仓条件加仓,而且只加一次仓,加仓手数为M,该怎么表达?
if DEA>0 and macd>0 and macd>ref(macd,1) and abb then buy(holding=0,ss,marketr);
if macd<0 and abb and holding>0 then sell(1,0,marketr);
if DEA<0 and macd<0 and macd<ref(macd,1) and abb then buyshort(holding=0,ss,marketr);
if macd>0 and abb and holding<0 then sellshort(1,0,marketr);
if DEA>0 and macd>0 and macd>ref(macd,1) and abb then buy(holding<=ss,ss,marketr);
if macd<0 and abb and holding>0 then sell(1,0,marketr);
if DEA<0 and macd<0 and macd<ref(macd,1) and abb then buyshort(holding<=abs(ss),ss,marketr);
if macd>0 and abb and holding<0 then sellshort(1,0,marketr);
再麻烦一下老师,这是开平仓条件,在开仓走完第5根K线依然盈利的情况下,则加仓M手,而且只加一次仓,该怎么表达?
if DEA>0 and macd>0 and macd>ref(macd,1) and abb then buy(holding=0,ss,marketr);
if macd<0 and abb and holding>0 then sell(1,0,marketr);
if DEA<0 and macd<0 and macd<ref(macd,1) and abb then buyshort(holding=0,ss,marketr);
if macd>0 and abb and holding<0 then sellshort(1,0,marketr);
if DEA>0 and macd>0 and macd>ref(macd,1) and abb then buy(holding=0,ss,marketr);
if DEA>0 and macd>0 and macd>ref(macd,1) and abb and holding=ss and openprofit>0 and enterbars=5 then buy(holding=ss,ss,marketr);
if macd<0 and abb and holding>0 then sell(1,0,marketr);
if DEA<0 and macd<0 and macd<ref(macd,1) and abb then buyshort(holding=0,ss,marketr);
if DEA<0 and macd<0 and macd<ref(macd,1) and abb and holding=-ss and openrpfit>0 and enterbars=5 then buyshort(holding=-ss,ss,marketr);
if macd>0 and abb and holding<0 then sellshort(1,0,marketr);