Rss & SiteMap

金字塔客服中心 - 专业程序化交易软件提供商 http://www.weistock.com/bbs/

专业程序化软件提供商
共30 条记录, 每页显示 10 条, 页签: [1] [2][3]
[浏览完整版]

标题:请问KDJ的一上问题

1楼
haizxj 发表于:2013/11/20 13:30:27

假定我用KD金死叉来开平仓

如果是上一欠亏损,我就开

应当怎么编

谢谢

[此贴子已经被作者于2013/11/20 13:30:48编辑过]
2楼
lichenghu 发表于:2013/11/20 13:40:11

NUMPROFIT(1) 具体参考函数说明

 

IF NUMPROFIT(1)<0 AND 开仓条件 THEN

BUY(,,);

3楼
haizxj 发表于:2013/11/20 14:00:59

如果连续两次以上亏损怎么写,再开

[此贴子已经被作者于2013/11/20 14:01:19编辑过]
4楼
jinzhe 发表于:2013/11/20 14:08:45
if numprofit(1)<0 and numprofit(2)<0 then buy....;
5楼
haizxj 发表于:2013/11/20 22:05:59

IF HOLDING=0  and NUMPROFIT(1)<0 THEN BEGIN
BUY (kd ,2,THISCLOSE);
BUYSHORT(KK ,2,THISCLOSE);

END

回测时没有反应

 

 

 

6楼
jinzhe 发表于:2013/11/21 9:09:02
代码就这4句?
7楼
haizxj 发表于:2013/11/25 9:57:31

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;

 

KD:=cross(k,d);          //开多条件
PD:=cross(d,k);          //平多条件
KK:=pd;          //开空条件
PK:=kd;          //平空条件
if NUMPROFIT(1)<0 then BEGIN
BUY (kd and holding=0,1,thisclose);
buyshort(KK and holding=0,1,thisclose);
end

if holding>0  THEN begin
sell(PD,1,THISCLOSE);
ENd

if holding<0 then BEGIN
SELLSHORT(PK,1,THISCLOSE)
end

 

 

怎么不开仓

8楼
jinzhe 发表于:2013/11/25 10:00:09

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;

 variable:n=0;

variable:m=0;

KD:=cross(k,d);          //开多条件
PD:=cross(d,k);          //平多条件
KK:=pd;          //开空条件
PK:=kd;          //平空条件

 

if kd and holding=0 and  n=0 then begin

  buy(1,1,market);

  n:=1;

end

 

if kk and holding=0 and m=0 then begin

   buyshort(1,1,market);

   m:=1;

end

 


if NUMPROFIT(1)<0  and n<>0then BEGIN
buyshort(KK and holding=0,1,thisclose);
end

if NUMPROFIT(1)<0  and m<>0then BEGIN
buy(Kdand holding=0,1,thisclose);
end

 

 

if holding>0  THEN begin
sell(PD,1,THISCLOSE);
ENd

if holding<0 then BEGIN
SELLSHORT(PK,1,THISCLOSE)
end

9楼
haizxj 发表于:2013/11/25 10:17:18
回测股指12没反应,没成交明细
10楼
jinzhe 发表于:2013/11/25 10:26:30

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;

variable:n=0;

variable:m=0;

KD:cross(k,d);          //开多条件
PD:cross(d,k);          //平多条件
KK:=pd;          //开空条件
PK:=kd;          //平空条件

 

if kd and holding=0 and  n=0 then begin

  buy(1,1,market);

  n:=1;

end

 

if kk and holding=0 and m=0 then begin

   buyshort(1,1,market);

   m:=1;

end

 


if NUMPROFIT(1)<0  and n<>0 then BEGIN
buyshort(KK and holding=0,1,thisclose);
end

if NUMPROFIT(1)<0  and m<>0 then BEGIN
buy(Kd and holding=0,1,thisclose);
end

 

 

if holding>0  THEN begin
sell(PD,1,THISCLOSE);
ENd

if holding<0 then BEGIN
SELLSHORT(PK,1,THISCLOSE);
end

 

 

这个是上个平仓一旦没有亏损,那么后面就不会有后续开仓

共30 条记录, 每页显示 10 条, 页签: [1] [2][3]


Powered By Dvbbs Version 8.3.0
Processed in 0.28101 s, 3 queries.