//开空部分自行添加,代码只提供参考学习,如有其它需求请自行完善
INPUT:N1(10,10,30,1);
ma10:=ma(c,10);
VARIABLE:高点1=0,高点2=0,num=0;
KD:cross(c,ma10);
buy(KD and holding=0,1,market);
if KD then num:=1;
refc:=ref(c,1);
if ref(c,1)>c and ref(c,1)>ref(c,2) and num=2 then
BEGIN
高点2:=refc;
num:=3;
end
if ref(c,1)>c and ref(c,1)>ref(c,2) and num=1 then
begin
高点1:=refc;
num:=2;
end
if 高点1>高点2 and num=3 then
begin
sell(holding>0,1,market);
num:=0;
END
if 高点1<高点2 and num=3 then
begin
高点1:=高点2;
高点2:=0;
num:=2;
end
DTYDZS:=(HHV(H,ENTERBARS)-CLOSE)/AVGENTERPRICE>=N1/100;
SELL(DTYDZS and holding=1,0,MARKET);