RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100; K:SMA(RSV,3,1); D:SMA(K,3,1); J:3*K-2*D; ma1:=ma(c,5); kd:l-ma1<1 and k>=50 and k<=51;//当K线最低价-5均线小于1,K值在50和51之间,平空开多 kk:l-ma1<1 and k>=50 and k>=85;//当K线最低价-5均线小于1,K值大于85,平多开空 if kd and holding<0 then sellshort(1,1,marketr); if kd and holding=0 then buy(1,1,marketr); if kk and holding>0 then sell(1,1,marketr); if kk and holding=0 then buyshort(1,1,marketr);