--
下面例子的ma均线以10周期均线举例;下一根K的收盘价大于前一根K的条件其实包含了未来函数,建议可以改成当根K线收盘价大于前一根收盘价,下面例子还是以您的要求为准。
MA5:MA(C,10);//10周期的MA均线
//KDJ指标
INPUT:N(9,1,100,10),P1(3,2,40,4),P2(3,2,40,4);
RSV:=(CLOSE-LLV(LOW,N))/(HHV(HIGH,N)-LLV(LOW,N))*100;
K:=SMA(RSV,P1,1);
D:=SMA(K,P2,1);
J:=3*K-2*D ;
SELLSHORT(CROSS(K,D),0,MARKET);
BUY( CROSS(K,D) AND C >MA5 AND C < REFX(C,1) AND HOLDING=0,1,MARKET);
SELL(CROSS(D,K) ,0,MARKET );
BUYSHORT( HOLDING=0 AND CROSS(D,K) AND C<MA5 AND C>REFX(C,1) ,1,MARKET);