您现在的位置:程序化交易>> 期货公式>> 金字塔等>> 金字塔知识>>正文内容

求助:将程序修改为连亏两次就停止买卖30分钟,30分钟后再亏一次又停止买卖30分钟?可以吗?谢了 [金字塔]

  • 咨询内容:

    //2013-09-01

    variable:HigherAfterEntry=0,LowerAfterEntry=999999;


    input:n1(3,1,30,1);
    input:n2(24,5,40,1);
    input:n3(90,50,100,5);
    input:n4(1,1,4,1);
    input:n5(68,50,100,5);
    input:n6(2,1,30,1);
    input:n7(13,3,30,1);
    input:n8(13,3,30,1);


    open5_1:callstock('',vtopen,2,-1);//5分钟周期的开盘价
    close5_1:callstock('',vtclose,2,-1);//5分钟周期的收盘价

    open3_1:callstock('',vtopen,17,-1);//3分钟周期的开盘价
    close3_1:callstock('',vtclose,17,-1);//3分钟周期的收盘价

    vols20_1:=callstock('',vtvol,22,20);//20秒周期的成交量
    vol1_1:=callstock('',vtvol,1,-1);//1分钟周期的成交量

    avvol:ma(ref(vol,2),5),noaxis,linethick0;
    dayopen:=valuewhen(date<>ref(date,1),open);

    开盘价:=dayopen,noaxis,linethick0;
    成交量:=REF(vol,1),noaxis,linethick0;

    if date<>ref(date,1) then
    begin

    loss:=0; //限制开仓方式一,只开一次
    count1:=1;
    count2:=1;

    end

    计数一:=count1,noaxis,linethick0;
    计数二:=count2,noaxis,linethick0;
    计数三:=loss,noaxis,linethick0;

    h_1:=ref(h,1);
    l_1:=ref(l,1);

    c_1:=ref(c,1);

    o_1:=ref(o,1);

    vol_1:=ref(vol,1);

    vol_2:=ref(vol,2);

    vol_3:=ref(vol,3);

    vol_4:=ref(vol,4);

    sumvol:vol_2+vol_3+vol_4,noaxis,linethick0;

    lots:=1;

     
     If enterbars=0 then
     begin
     HigherAfterEntry:=enterprice;
     LowerAfterEntry:=enterprice;
     end;
    else If enterbars>=1 then
     begin
     HigherAfterEntry:=max(HigherAfterEntry,h_1);
     LowerAfterEntry:=min(LowerAfterEntry,l_1);
     end;
     hh:HigherAfterEntry,noaxis,linethick0;
    ll:LowerAfterEntry,noaxis,linethick0;


     
     if holding>0  and  l<=ENTERPRICE-n2
     
     then 
     begin
     sell(1,holding,limitr,enterprice-n2),IGNORECHECKPRICE;

     end
     
     if holding<0  and  h>=ENTERPRICE+n2
     then 
     begin
     sellshort(1,holding,limitr,enterprice+n2),IGNORECHECKPRICE;

     end
     
      

     
     if  holding=0  and count2=1 then
     
     begin
     
     if *************************
     then
     begin
     buy(1,lots,limitr,open),IGNORECHECKPRICE;
     HigherAfterEntry:=enterprice;
     LowerAfterEntry:=enterprice;
    end
     
     end
     
     
      if  holding=0  and count2=1
     
     then
     
     begin

     if  ***************************
     then
     begin
      buySHORT(1,lots,limitr,open),IGNORECHECKPRICE;
     HigherAfterEntry:=enterprice;
     LowerAfterEntry:=enterprice;
       end
      
     end
     
     
     //再次开多单的平仓
     
     if holding>0 and enterbars>0  then
     
     begin
     
     
     if  enterbars>=1   and *****************
     then
     begin
     price:=EnterPrice+(HigherAfterEntry-EnterPrice)*n5/100;
     if low<=price then
     begin
     sell(1,holding,limitr,min(open,price)),IGNORECHECKPRICE;
     count2:=1;
     end;
    end
     
     
     
     
    //再次开空单的平仓
     
     if holding<0 and enterbars>0  then
     
     begin
     
        if  enterbars>=1   and *****************************
     then
     begin
     price:=EnterPrice - (EnterPrice-LowerAfterEntry)*n5/100;
     if high>=price then
     begin
     sellshort(1,holding,limitr,max(open,price)),IGNORECHECKPRICE;
      count2:=1;
     end;
     end;
     
     

     

     

  • 金字塔客服:

    30分钟后无论开仓条件是否满足都要开仓?

    这个策略用在哪个周期上?

     

 

有思路,想编写各种指标公式,程序化交易模型,选股公式,预警公式的朋友

可联系技术人员 QQ: 1145508240  有需要帮忙请点击这里留言!!!进行 有偿 编写!不贵!点击查看价格!


【字体: 】【打印文章】【查看评论

相关文章

    没有相关内容