| --  作者:neowang007 --  发布时间:2012/8/7 14:45:21
 --  帮忙看看这个程序除了什么问题,为什么没有信号呢?公式测评也没结果?
 
 //定义开仓次数variable:kc:=0;
 variable:kcb:=0;
 input:X(3200,200,10000,100);
 input:N(4,2,50,2);
 input:TP(33,10,100,5);
 input:SL(33,10,100,5);
 a:=ref(date,1);
 b:=ref(c,N);
 //满足节点1->3->7/8,开3次仓
 if date<>a and time>=092000 and time<=151000 then begin
 if vol>X and c<b and kc=0 then
 begin
 buy(1,1,market);
 kc:=1;
 kcb:=barpos;
 if vol>X and c<b and kc=1 and kcb<>barpos then
 begin
 buy(1,1,market);
 kc:=2;
 kcb:=barpos;
 if vol>X and c<b and kc=2 and kcb<>barpos then
 begin
 buy(1,1,market);
 kc:=3;
 kcb:=barpos;
 end
 else if vol>X and c>b then  sellshort(1,0,market);
 end
 end
 end
 //满足节点1->4->9/10,开3次仓
 if date<>a and time>=092000 and time<=151000  then
 begin
 if vol>X and c<b and kc=0 then
 begin
 buy(1,1,market);
 kc:=1;
 kcb:=barpos;
 if vol>X and c>b and kc=1 and kcb<>barpos then
 begin
 sellshort(1,0,market);
 kcb:=barpos;
 if vol>X and c<b and kc=1 and kcb<>barpos then
 begin
 buy(1,1,market);
 kc:=2;
 kcb:=barpos;
 end
 else if vol>X and c>b then  buyshort(1,1,market);
 end
 end
 end
 //满足节点2->5->11/12,开3次仓if date<>a  and time>=092000 and time<=151000 then
 begin
 if  vol>X and c>b and kc=0 then
 begin
 buyshort(1,1,market);
 kc:=1;
 kcb:=barpos;
 if  vol>X and c<b and kc=1 and kcb<>barpos then
 begin
 sell(1,0,market);
 kcb:=barpos;
 if  vol>X and c<b and kc=1 and kcb<>barpos then
 begin
 buy(1,1,market);
 kc:=2;
 kcb:=barpos;
 end
 else if vol>X and c>b then  buyshort(1,1,market);
 end
 end
 end
 //满足节点2->6->13/14,开3次仓if date<>a and time>=092000 and time<=151000  then
 begin
 if  vol>X and c>b and kc=0 then
 begin
 buyshort(1,1,market);
 kc:=1;
 kcb:=barpos;
 if  vol>X and c>b and kc=1 and kcb<>barpos then
 begin
 buyshort(1,0,market);
 kc:=2;
 kcb:=barpos;
 if  vol>X and c<b and kc=2 and kcb<>barpos then
 begin
 sell(1,1,market);
 kcb:=barpos;
 end
 else if  vol>X and c>b then  buyshort(1,1,market);
 end
 end
 end
 //如果15点收盘,14点55分全部平仓if time>=145500 then
 begin
 sell(1,0,market);
 sellshort(1,0,market);
 end
 //如果指引或止损,则平仓
 if holding>0 and market <(enterprice-SL*5*mindiff)  then sell(1,0,limitr,enterprice-SL*5*mindiff);
 else if holding>0 and market >(enterprice+TP*5*mindiff) then
 sell(1,0,limitr,enterprice+TP*5*mindiff);
 if holding<0 and market >(enterprice+SL*5*mindiff)  then
 sellshort(1,0,limitr,enterprice+SL*5*mindiff);
 else if holding>0 and market <(enterprice-TP*5*mindiff) then
 sellshort(1,0,limitr,enterprice-TP*5*mindiff);
 
 
 |