Rss & SiteMap

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

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

标题:请教平仓代码的问题

1楼
punkcat401 发表于:2013/12/6 9:18:44

variable:maxprofit=0;
variable:win=0;
variable:win2=0;

 

IF holding>0 and enterbars>0 THEN BEGIN
win:=high-enterprice;
IF win>maxprofit THEN maxprofit:=win;
win2:=maxprofit-win;
END


盈利大于50,小于100时,回撤30%平多 win2>=0.3*maxprofit then sell();

 

盈利大于50,小于100,这个条件描述是用 maxprofit>50 and maxprofit<100,还是 win>50 AND win<100 呢?

 

我之前用的maxprofit,但空头(enterprice-L)止盈结果不对,用win反而对了,但是多头止盈又不正常了。

2楼
jinzhe 发表于:2013/12/6 9:41:27

maxprofit_duo:=hhv(h-enterprice,enterbars+1);

maxprofit_kong:=llv(enterprice-l,enterbars+1);

 

if maxprofit_duo>100 and maxprofit_duo<50 and holding>0 and c-enterpcie<=0.3*maxprofit_duo then sell;

if maxprofit_kong>100 and maxprofit_kong<50 and holding<0 and enterpcie-c<=0.3*maxprofit_kong then sell;

3楼
punkcat401 发表于:2013/12/6 11:32:00
以下是引用jinzhe在2013/12/6 9:41:27的发言:

maxprofit_duo:=hhv(h-enterprice,enterbars+1);

maxprofit_kong:=llv(enterprice-l,enterbars+1);

 

if maxprofit_duo>100 and maxprofit_duo<50 and holding>0 and c-enterpcie<=0.3*maxprofit_duo then sell;

if maxprofit_kong>100 and maxprofit_kong<50 and holding<0 and enterpcie-c<=0.3*maxprofit_kong then sell;

c-enterpcie<=0.3*maxprofit_duo then sell

回撤超过30%,应该是 c-enterpcie <= (1-0.3)*maxprofit_duo 吧?

4楼
jinzhe 发表于:2013/12/6 13:05:32
这个数学上的定义,用户自己斟酌吧,我主要给出思路
5楼
punkcat401 发表于:2013/12/6 14:50:09
以下是引用jinzhe在2013/12/6 13:05:32的发言:

if maxprofit_kong>100 and maxprofit_kong<50 and holding<0 and enterpcie-c<=0.3*maxprofit_kong then sell;

 

多头没问题,空头仍然不对,不出信号,空头如果去掉“maxprofit_kong>100 and maxprofit_kong<50” 这个条件就正常了

 

这也太怪了吧,为啥呢

6楼
jinzhe 发表于:2013/12/6 15:00:00

maxprofit_duo:=hhv(h-enterprice,enterbars+1);

maxprofit_kong:=llv(enterprice-l,enterbars+1);

 

 

这个要改一改

 

maxprofit_duo:=hhv(henterbars+1)-enterprice,;

maxprofit_kong:=enterprice-llv(l,enterbars+1);

7楼
punkcat401 发表于:2013/12/6 15:10:30
以下是引用jinzhe在2013/12/6 15:00:00的发言:

maxprofit_duo:=hhv(h-enterprice,enterbars+1);

maxprofit_kong:=llv(enterprice-l,enterbars+1);

 

 

这个要改一改

 

maxprofit_duo:=hhv(henterbars+1)-enterprice,;

maxprofit_kong:=enterprice-llv(l,enterbars+1);

信号是有了,但是后面“enterpcie-c<=0.3*maxprofit_kong ” 不对,用>=或<=都不对

8楼
jinzhe 发表于:2013/12/6 15:17:58
有什么不对的地方?
9楼
punkcat401 发表于:2013/12/6 15:31:40
以下是引用jinzhe在2013/12/6 15:17:58的发言:
有什么不对的地方?

maxprofit_kong:=llv(enterprice-l,enterbars+1);

if maxprofit_kong>100 and holding<0 and enterprice-c<=0.3*maxprofit_kong then sell;

 

这两行平空的代码,有的地方是回撤参数不管填多少都不变,有的是回撤比例完全和参数不对,有的是开仓后第二根就平掉但没有回撤

 

 

之前的代码只是空头有问题,多头没问题,这是什么原因呢,和我最开始的写法一样,都是空头没信号

[此贴子已经被作者于2013/12/6 15:32:41编辑过]
10楼
jinzhe 发表于:2013/12/6 15:42:43
100是具体的资金还是点数?
共21 条记录, 每页显示 10 条, 页签: [1] [2][3]


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