//kdj
input:n(20,10,100,1);
input:dd(60,50,100,5);
input:xx(40,0,50,5);
input:zs(10,2,20,1);
input:zf(10,5,20,1);
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;
M1:=EMA(CLOSE,20);
M2:=EMA(CLOSE,80);
DIFF : =EMA(CLOSE,12) - EMA(CLOSE,26);
ss:=1;
tk:= time >=090500 and time <=145500;
tg:=time >=145500;
VARIABLE :pdzy=0;
if m1>m2 and ((j<xx AND REF(J,1)>=xx and diff>0) or (j>d AND REF(J,1)<ref(d,1) and diff<0)) and tk and pdzy=0 and holding=0 then BEGIN
BUY(1,ss,MARKET);
end
if m1<m2 and ref(m1,1)>ref(m2,1) and AVGENTERPRICE-c>=zs*MINDIFF then BEGIN
SELL(1,holding,MARKET);
end
if c-AVGENTERPRICE>=n*MINDIFF then BEGIN
SELL(1,holding,MARKET);
pdzy:=1;
end
当前持仓:HOLDING,COLORGRAY,LINETHICK0;
if holding >0 and tg then begin
sell(1,holding,MARKET);
end
if tg then BEGIN
pdzy:=0;
end
是什么逻辑?
上面的就是多头代码,下面的是空头代码(空头没问题,但多头就出了问题,不知为什么?)
//kdj
input:n(20,10,100,1);
input:dd(60,50,100,5);
input:xx(40,0,50,5);
input:zs(10,5,20,1);
input:zf(10,5,20,1);
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;
M1:EMA(CLOSE,20);
M2:EMA(CLOSE,80);
DIFF : =EMA(CLOSE,12) - EMA(CLOSE,26);
ss:=1;
tk:= time >=090500 and time <=145500;
tg:=time >=145500;
VARIABLE :pkzy=0;
if m1<m2 and ((j>dd AND REF(J,1)<=dd and diff<0) or (j<d AND REF(J,1)>ref(d,1) and diff>0)) and tk and pkzy=0 and holding=0 then BEGIN
BUYSHORT(1,ss,MARKET);
end
if m1>m2 and ref(m1,1)<ref(m2,1) and C-AVGENTERPRICE>=zs*MINDIFF then BEGIN
SELLSHORT(1,holding,MARKET);
end
IF AVGENTERPRICE-C>n*MINDIFF THEN BEGIN
SELLshort(1,ss,MARKET);
pkzy:=1;
END
当前持仓:HOLDING,COLORGRAY,LINETHICK0;
if holding <0 and tg then begin
sellshort(1,holding,MARKET);
end
if tg then BEGIN
pkzy:=0;
end
你是用在有夜盘的品种上了吗?交易时间坐标修改过吗?
不管日盘、夜盘,就是多单不能出信号,空单可以出信号。