以下是代码:多空乱开,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赋值为0RUNMODE: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);
帮你整理了一下
不知对不对
请问你编译通过吗 报什么错?
//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);
改过来了,用代码模式发帖会乱,好心人帮看下,已经测试过了。
1.把你的这两个公式,全局变量的值,不要用STKINDI调用,整合到一个策略里,看看
2.STKINDI的调用的第2个参数,是对指标线的调用,而不是对赋值的调用,多一个等号,情况就大不一样.
请版主详细看看:
1.公式是用5分钟周期,第二句是3分钟,两种方式调用都不行,调用的是指标不是变量。
2.交易系统用的是6秒,方便于测试,与公式是不同周期,不能整在同一策略吧。
EXTGBDATA定义的全局变量的值,各个其它公式,都可以直接使用的.
同一个指标里的全局变量值,怎么能既在3分钟,又在5分钟.描述上有点混乱
你干脆整理一下,你的思路,详细的说明一下.看看别人能否提供帮助,
也不用猜测您的意思了.
公式在3分钟周期,如果一低比一低高,同理,在多秒周期一低比一低高,就开多,不管什么条件,不得开空;反之,开空,不得开多。公式是长周期,交易系统是短周期。
也就是长周期控制开多开空信号,短周期控制开仓时机!