以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  帮我看看,错在哪里?  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=9782)

--  作者:manbutianya
--  发布时间:2012/1/31 14:38:11
--  帮我看看,错在哪里?

以下是代码:多空乱开,duokong>0,照样开空,到底错在哪里?公式qushikaiguan:

RUNMODE:0;
duokong:EXTGBDATA(\'kaiguan\');
kaiduo2:=ref(l,1)<=l and ref(h,1)<=h and ABS(ref(c,1)-ref(o,1))/c<0.007;
if  kaiduo2 then
EXTGBDATAset(\'kaiguan\',1);
kaikong2:=ref(h,1)>=h and ref(l,1)>=l and ABS(ref(c,1)-ref(o,1))/c<0.007;
if  kaikong2 then
EXTGBDATAset(\'kaiguan\',-1);
//IF currenttime=closetime(0) then EXTGBDATASET(\'kaiguan\',0);// 收盘的同时,num赋值为0
RUNMODE:0;
交易系统:

kaicang:STKINDI(stklabel,\'qushikaiguan.duokong\',0,2,-1);
//kaicang:"qushikaiguan.duokong##MIN3";

if tholding=0 and kaicang>0 and ref(l,1)<l then
tbuy(1,1,mkt);
if tholding=0 and kaicang<0 and ref(h,1)>h then
tbuyshort(1,1,mkt);
if tholding>0 and TENTERBARS>5 then
tsell(1,1,mkt);
if tholding<0 and TENTERBARS>5 then
tsellshort(1,1,mkt);

[此贴子已经被作者于2012-1-31 14:50:00编辑过]

--  作者:26327756l
--  发布时间:2012/1/31 14:43:36
--  

帮你整理了一下

不知对不对

请问你编译通过吗 报什么错?

 

//qushikaiguan:
 RUNMODE:0;
duokong:EXTGBDATA(\'kaiguan\');
kaiduo2:=ref(l,1)<=l and ref(h,1)<=h and ABS(ref(c,1)-ref(o,1))/c<0.007;
if kaiduo2="kaiduo2" then EXTGBDATAset(\'kaiguan\',1);
 kaikong2:=ref(h,1)>=h and ref(l,1)>=l and ABS(ref(c,1)-ref(o,1))/c<0.007;
  if kaik then EXTGBDATAset(\'kaiguan\',-1);
//  交易系统:
kaicang:STKINDI(stklabel,\'qushikaiguan.duokong\',0,2,-1);
//kaicang:"qushikaiguan.duokong##MIN3";
if tholding="0" and="and" kaicang="kaicang" >0 and ref(l,1)h then tbuyshort(1,1,mkt);
if tholding>0 and TENTERBARS>5 then tsell(1,1,mkt);
 if tholding<0 and="and" TENTERBARS="TENTERBARS" >5 then tsellshort(1,1,mkt);

[此贴子已经被作者于2012-1-31 14:44:23编辑过]

--  作者:manbutianya
--  发布时间:2012/1/31 14:46:21
--  

改过来了,用代码模式发帖会乱,好心人帮看下,已经测试过了。


--  作者:fly
--  发布时间:2012/1/31 14:53:40
--  

1.把你的这两个公式,全局变量的值,不要用STKINDI调用,整合到一个策略里,看看

 

2.STKINDI的调用的第2个参数,是对指标线的调用,而不是对赋值的调用,多一个等号,情况就大不一样.


--  作者:manbutianya
--  发布时间:2012/1/31 15:02:41
--  

请版主详细看看:

1.公式是用5分钟周期,第二句是3分钟,两种方式调用都不行,调用的是指标不是变量。

2.交易系统用的是6秒,方便于测试,与公式是不同周期,不能整在同一策略吧。

 


--  作者:manbutianya
--  发布时间:2012/1/31 15:32:36
--  
既然这样,能请版主把公式改成符合调用要求的公式吗?
--  作者:manbutianya
--  发布时间:2012/1/31 16:04:38
--  
都去哪里了,有人帮忙吗?
--  作者:fly
--  发布时间:2012/1/31 16:09:45
--  

EXTGBDATA定义的全局变量的值,各个其它公式,都可以直接使用的.

 

同一个指标里的全局变量值,怎么能既在3分钟,又在5分钟.描述上有点混乱


--  作者:fly
--  发布时间:2012/1/31 16:13:50
--  

你干脆整理一下,你的思路,详细的说明一下.看看别人能否提供帮助,

也不用猜测您的意思了.


--  作者:manbutianya
--  发布时间:2012/1/31 16:23:28
--  

公式在3分钟周期,如果一低比一低高,同理,在多秒周期一低比一低高,就开多,不管什么条件,不得开空;反之,开空,不得开多。公式是长周期,交易系统是短周期。

也就是长周期控制开多开空信号,短周期控制开仓时机!

[此贴子已经被作者于2012-1-31 16:29:12编辑过]