穿越均线平仓。 第N次穿越 同时距离上次穿越均线距离M个时间周期 平仓。怎么描述?
意思是必须满足开仓后 最新价已经穿越了均线N次,这个穿越是上穿还是下穿 还是说上下穿总计。
ma1:ma(c,5);
ma2:ma(c,10);
majc:cross(ma1,ma2);
masc:cross(ma2,ma1);
if holding<0 and count(masc,ENTERBARS+1)=N and BARSLAST(masc)>=M then sellshort(1,holding,market);
if holding>0 and count(majc,ENTERBARS+1)=N and BARSLAST(majc)>=M then sell(1,holding,market);
参考上面方式。
连续平仓这个。只能具体代码具体看。并非某个单独语句或若干条语句导致的。你代码完整贴下或者站内信私发。