以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  当日平掉仓单以后,不再开反向仓单怎么写全局变量  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=61359)

--  作者:sdrzhq
--  发布时间:2014/1/28 21:42:44
--  当日平掉仓单以后,不再开反向仓单怎么写全局变量
当日平掉仓单以后,不开反向仓单,同向仓单可以开,怎么全局做全局变量
--  作者:sdrzhq
--  发布时间:2014/1/28 21:57:59
--  

也就是平掉当日仓单以后,出现反向信号,不再开仓。如果日内再出现开同向信号,可以继续再开


--  作者:sdrzhq
--  发布时间:2014/1/29 6:16:01
--  

模型是日内交易


--  作者:jinzhe
--  发布时间:2014/1/29 9:12:25
--  

variable:n=0;

variable:m=0;

 

if n=0 and 开多条件 then buy..........;

 

if m=0 and 开空条件 then buyshort.........;

 

if 平多条件 and holding>0 then begin

    sell.........;

    n:=0;

    m:=1;

end

 

if 平空条件 and holding<0 then begin

   sellshort.........;

   n:=1;

   m:=0;

end


--  作者:sdrzhq
--  发布时间:2014/1/29 20:08:20
--  

怎么加上以后没有信号了?

 


--  作者:sdrzhq
--  发布时间:2014/1/29 20:54:08
--  

如果平仓指令比较多,是不是需要逐一,设定变量的开关

 


--  作者:sdrzhq
--  发布时间:2014/1/29 21:03:20
--  
还是不行,加上边变量,就没信号了
--  作者:jinzhe
--  发布时间:2014/1/30 9:12:11
--  
把你的代码贴出来
--  作者:sdrzhq
--  发布时间:2014/1/30 9:53:04
--  

Variable:a=0;
Variable:b=0;


BIAS60 : -(MA(C,60)-C);
bias10:(ma(c,10)- c);
MA10:=MA(C,10);
MA60:=MA(C,60);

BIAS2 : =AVGENTERPRICE-MA60;

 
W1:=-100*(HHV(H,32)-C)/(HHV(H,32)-LLV(L,32))+48;
T1:=TIME>=094000 AND TIME<143500;
T2:=TIME>=15050;
con1:= W1>45  and REF(ANY(W1>45,9),1) AND T1  and a=0 and holding=0 

con2:= W1<-45  and REF(ANY(W1<-45,9),1) AND T1  and b=0 and holding=0  

Con3:= HHV(H,5)>1.0094*C;
Con4:=C>1.0094*LLV(L,5)
con5:=REF(ANY(bias60>40,15),1);
con6:=REF(ANY(bias60<-40,15),1);
con7:=BIAS2>32 AND enterbars<=5 and cross(ma10,c)
con8:=BIAS2<-32 AND enterbars<=5 and cross(c,ma10)
con9:=REF(ANY(bias60>28,24),1);
con10:=REF(ANY(bias60<-28,24),1);
con11:=C<REF(LLV(C,12),1)
con12:=C>REF(HHV(C,12),1)
con13:=C<MA10
con14:=C>MA10
con15:=bias60<0
con16:= bias60>0


Input:tq(3,1,60,1);
abb:=(time0-timetot0(dynainfo(207))<=tq) or not(islastbar);
if abb then begin

if con1 then begin
 sellshort(holding<0, 0, market);
 buy(1 ,1, market);
 
 end
 
 if con5 then begin
 if con13 then begin sell(holding>0, 0, market);
 end
 end
 
  if con9 then begin
 if con11 then begin sell(holding>0, 0, market);
 end
 end
 
If  con3 OR con7 OR T2 or con15 or w1<0 then sell(holding>0, 0, market);

if con2 then begin
 sell(holding>0, 0, MARKET);
 buyshort(1 , 1,market);

 end
 
 if con6  then begin
 if con14 then begin sellshort(holding<0, 0, market);
 end
 end
 
 
 if con10  then begin
 if con12 then begin sellshort(holding<0, 0, market);
 end
 end
 
if con4 OR con8 OR T2 or con16 or w1>0  then sellshort(holding<0, 0, market);

 

if L<ref(LLv(L,todaybar),1)-5*mindiff  and holding>0 then begin sell(1,0,market);
a:=1;
end

if H>ref(hhv(h,todaybar),1)+5*MINDIFF  and holding<0 then begin sellshort(1,0,market);
b:=1;
end


if time>=150000 then a:=0;
if time>=150000 then b:=0;部分代码,如果加上上边的变量会没有信号

[此贴子已经被作者于2014/1/30 9:54:10编辑过]

--  作者:jinzhe
--  发布时间:2014/1/30 10:24:22
--  
把加上后的代码帖一下,我的是加在开平条件里面的,你的代码里面没有体现出来