[PEL] 复制代码
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,NODRAW;
kdjjc:cross(k,d),NODRAW;//kdj金叉
kdjsc:cross(d,k),NODRAW;
input:p(26,20,100,8),s(12,5,40,4),m(9,2,60,6);
DIFF :=EMA(CLOSE,S) - EMA(CLOSE,P);
DEA :=EMA(DIFF,M);
MACD1 :=2*(DIFF-DEA), COLORSTICK;
macdjc:cross(diff,dea),NODRAW;//macd金叉
macdsc:cross(dea,diff),NODRAW;
VARIABLE:ct:=0;
if TODAYBAR=1 then ct:=0;//这个重置记录方式再后台里是不可取的。
if (macdjc or kdjjc) and holding=0 then
begin
buy(1,1,market);
ct:=ct+1;
end
if (macdsc or kdjsc) and holding>0 then
begin
sell(1,1,market);
end
jk:ct;