以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  帮忙看看这个程序除了什么问题,为什么没有信号呢?公式测评也没结果?  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=13519)

--  作者: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);


--  作者:jinzhe
--  发布时间:2012/8/7 16:52:47
--  

这个策略是自己写的吗

看第一句开仓语句就能猜到哪里不对。

 


--  作者:RogarZ
--  发布时间:2012/8/8 9:06:59
--  

感觉楼主是不是之前学过其他的软件  用其他软件的思维方式来思考金字塔

//开仓

if cond then begin

  buy

end

//加仓

if cond then begin

buy

end

//止损

 

//平仓
你看下策略发布区的模板