20日均线上穿昨日收盘价,并且收盘价减去昨日收盘价小于20跳开多。(如果收盘价减去昨日收盘价大于20跳不开仓),50跳止损,浮动盈利大于100跳,当前高点N周期不创新高平仓;
如果价格回落到上次开仓点附近(正负5跳)且20日均线还大于昨日收盘价开多,20日均线下穿昨日收盘价平仓。
N:=20;
ma20:ma(c,20);
lastC:CALLSTOCK('',vtCLOSE,6,0);
cd1:cross(ma20,LASTC);
cd2:MA20-LASTC<=20*MINDIFF;
buy(cd1 and cd2 and holding=0,1,market);
止损:sell(AVGENTERPRICE-c>=50*MINDIFF,holding,market);
止盈:sell(c-AVGENTERPRICE>=100*MINDIFF and h<>hhv(h,N),holding,market);
加仓:buy(abs(c-AVGENTERPRICE)<=5*MINDIFF and holding>0 and ma20>LASTC,1,market);
sell(cross(LASTC,ma20),holding,market);
仅供参考。