//新手学习用,以扩展编写思路
N:=45;P1:=3;P2:=3;P3:=5;
RSV:= (CLOSE-LLV(LOW,N))/(HHV(HIGH,N)-LLV(LOW,N))*100;
FASTK:=SMA(RSV,P1,1);
K:=SMA(FASTK,P2,1);
D:=SMA(K,P3,1);
long:=cross(k,50);
longend:=cross(50,k);
short:=cross(50,k);
shortend:=cross(k,50);
if holding>0 then begin
sell(longend,1,thisclose);
end
if holding<0 then begin
sellshort(shortend,1,thisclose);
end
////////
if holding=0 then begin
buy(long,1,thisclose);
buyshort(short,1,thisclose);
end