当TRIX金叉时,如果收盘价低于20日均线价格,以收盘价开多仓,等TRIX死叉时,平多仓。
如果收盘价高于20日均线价格,以20日均线价格(4舍5入)发指令开多仓,等TRIX死叉时,平多仓。
TR1: EMA(EMA(EMA(CLOSE,P),P),P);
TRIX : (TR1-REF(TR1,1))/REF(TR1,1)*100;
TRMA1 : MA(TRIX,N);
jc:=cross(trix,trma1);
sc:=cross(trma1,trix);
ma20:ma(c,20);
if jc and c<ma20 and holding=0 then buy(1,1,limitr,c);
if c>ma20 and holding=0 then buy(1,1,limitr,ma20);
if sc and holding>0 then sell(1,1,market);
TR1:= EMA(EMA(EMA(CLOSE,P),P),P);
TRIX : (TR1-REF(TR1,1))/REF(TR1,1)*100;
TRMA1 : MA(TRIX,N);
ma20:=ma(c,20);
if cross(trix,trma1) and c<ma20 then buy(holding=0,1,limitr,close);
if c>ma20 and cross(trix,trma1) then buy(holding=0,1,limitr,ma20),IGNORECHECKPRICE;
if cross(trma1,trix) then sell(1,0,marketr);