Rss & SiteMap

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

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

标题:holding 源代码有问题,开多 开空的第一根k线holding不一致,导致程序无法按设计运行。

1楼
nima337 发表于:2012/12/11 20:59:48

holding 源代码有问题,开多 开空的第一根k线holding不一致,导致程序无法按设计运行。

开空的所在k线上holding是 -1

开多的所在k线上holding是0 次一根k线才是1

这样就导致程序编写开多开空不一致无法达到设计。版主holding源代码出问题啦。

2楼
nima337 发表于:2012/12/11 21:02:30
五分钟 十五分钟周期上holding是这样的问题。多空条件一致,但是holding显示不一致。
3楼
nima337 发表于:2012/12/11 21:12:16

holding的问题出现在空翻多和多翻空上面,多翻空正常,平多时达到开空条件即能当根就开空。空翻多就有问题了,当根达到开多条件不仅不能马上开多,只能在次周期之后达到条件才能开多,且开仓一根上多和空holding显示不一样。

4楼
admin 发表于:2012/12/11 21:51:57
有说明问题的示例代码吗?明日让客服测试一下看看
5楼
nima337 发表于:2012/12/11 21:54:55
简单点说就是多翻空,空翻多holding前后不一致,因为holding不一致,同样在平的一根k线上达到反向开仓条件,多能马上翻空,但空不能翻多。
6楼
admin 发表于:2012/12/11 23:30:17
请给出一段能说明此问题的代码谢谢合作
7楼
fly 发表于:2012/12/12 10:16:29

多翻空,和空翻多

下单指令写的有问题,

 

以下为MARKET价反手的简单示例,LIMIT的类似

//5日均线上穿10日均线,平空开多
long:=CROSS(ma5,ma15

if long then
begin
sellshort(holding<0,1,market);

buy(holding=0,1,market);

end

 

//5日均线下破10日均线,平多开空
short:=CROSS(ma15,ma5);

if short then
begin
sell(holding>0,1,market);

buyshort(holding=0,1,market);

end

[此贴子已经被作者于2012-12-12 10:19:48编辑过]
8楼
nima337 发表于:2012/12/12 10:17:28

didian:=llv(l,2);
gaodian:=hhv(h,2);
Kcj3:=ref(hhv(h,enterbars+1),1);
if h>=gaodian and holding=0  then buy(1,1,thisclose);
If holding>0 and ref(h>=gaodian,enterbars)=1 and ENTERBARS>=2 then zy:kcj3-5;
if  holding>0  and ref(h>=gaodian,enterbars)=1 and enterbars>=2 and l-zy<-0.1
 then sell(1,0,thisclose);
kKcj3:=ref(llv(l,enterbars+1),1);
if l<=didian and holding=0  then buyshort(1,1,thisclose);
If holding<0 and ref(l<=didian,enterbars)=1 and ENTERBARS>=2 then kzy:kkcj3+5;
if  holding<0  and ref(l<=didian,enterbars)=1 and enterbars>=2  and h-kzy>0.1
 then sellshort(1,0,thisclose);

 

同样是这样一堆代码就能检测出问题,双向都达到条件时,同根k线只能多翻空,而不能空翻多,因为holding多空持仓前后标准不一样。

9楼
nima337 发表于:2012/12/12 10:20:36
我不是这样写的,我代码写出来了,你看看吧,放到15分钟螺纹钢连续上就看到当根k线只有多翻空,没有空翻多,即便当根达到空翻多的条件,却不会像当根达到多翻空的条件一样去执行。
10楼
fly 发表于:2012/12/12 10:27:31

代码次序问题,请注意先平后开原则

改为以下既可

 

didian:=llv(l,2);
gaodian:=hhv(h,2);
Kcj3:=ref(hhv(h,enterbars+1),1);
kKcj3:=ref(llv(l,enterbars+1),1);

If holding<0 and ref(l<=didian,enterbars)=1 and ENTERBARS>=2 then kzy:kkcj3+5;
if  holding<0  and ref(l<=didian,enterbars)=1 and enterbars>=2  and h-kzy>0.1
 then sellshort(1,0,thisclose);
 
if h>=gaodian and holding=0  then buy(1,1,thisclose);
If holding>0 and ref(h>=gaodian,enterbars)=1 and ENTERBARS>=2 then zy:kcj3-5;
if  holding>0  and ref(h>=gaodian,enterbars)=1 and enterbars>=2 and l-zy<-0.1
 then sell(1,0,thisclose);
 

if l<=didian and holding=0  then buyshort(1,1,thisclose);

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


Powered By Dvbbs Version 8.3.0
Processed in 0.03906 s, 2 queries.