您現(xiàn)在的位置:程序化交易>> 期貨公式>> 金字塔等>> 金字塔知識(shí)>>正文內(nèi)容

請(qǐng)教:當(dāng)贏利>=1%,回吐到70%平倉(cāng),問(wèn)題在哪 [金字塔]

  • 咨詢(xún)內(nèi)容:

    基本思路,就是根據(jù)開(kāi)盤(pán)價(jià),比開(kāi)盤(pán)價(jià)高N1就開(kāi)多,低N1開(kāi)空,價(jià)格虧損N2元就止損,贏利超過(guò)0.5%-1% ,回吐到50%平倉(cāng),贏利超過(guò)1%,回吐到70%平倉(cāng),第一次平倉(cāng)是對(duì)的,再次開(kāi)倉(cāng)之后的平倉(cāng)就不行了,開(kāi)倉(cāng)即平。


    variable:HigherAfterEntry=0,LowerAfterEntry=999999;


    input:n1(10,5,30,1);
    input:n2(20,5,40,1);
    input:n6(6,4,30,1);
    input:n7(2,1,20,1);


    //9點(diǎn)開(kāi)倉(cāng)

    open5_1:callstock('',vtopen,2,-1);//5分鐘周期的開(kāi)盤(pán)價(jià)
    close5_1:callstock('',vtclose,2,-1);//5分鐘周期的收盤(pán)價(jià)

    open3_1:callstock('',vtopen,17,-1);//3分鐘周期的開(kāi)盤(pán)價(jià)
    close3_1:callstock('',vtclose,17,-1);//3分鐘周期的收盤(pán)價(jià)

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


    dayopen:=valuewhen(time=130100,open);

    開(kāi)盤(pán)價(jià):=dayopen,noaxis,linethick0;
    成交量:=REF(vol,1),noaxis,linethick0;

    if time=130100 then
    begin

    loss:=0; //限制開(kāi)倉(cāng)方式一,只開(kāi)一次
    count1:=1;
    count2:=1;

    end

    計(jì)數(shù)一:=count1,noaxis,linethick0;
    計(jì)數(shù)二:=count2,noaxis,linethick0;
    計(jì)數(shù)三:=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 time>=130000 and holding=0 and count1=1 and loss=0 then

     begin
     
     if h>=dayopen+n1 
     then
     begin
     buy(1,lots,limitr,dayopen+n1);  //如果9:00走勢(shì)超過(guò)開(kāi)盤(pán)價(jià)n1元就開(kāi)多單
     count1:=0;
     loss:=1;
     end
     
     if l<=dayopen-n1 
     
       then
       begin
       buyshort(1,lots,limitr,dayopen-n1); //9:00走勢(shì)低于開(kāi)盤(pán)
    價(jià)n1元就開(kāi)空單
       count1:=0;
       loss:=1;
       end
     
     end
     
     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 time>=130101 and time<180000  then
     
     BEGIN
     
     if holding>0  and  l<=ENTERPRICE-n2
     
     then 
     begin
     sell(1,holding,limitr,enterprice-n2); //9.00開(kāi)多單,止損設(shè)置低于成交價(jià)n2元

     end
     
     if holding<0  and  h>=ENTERPRICE+n2
     then 
     begin
     sellshort(1,holding,limitr,enterprice+n2); //9.00開(kāi)空單,止損設(shè)置高于成交價(jià)n2元

     end
     
     end 
     
     
     再次開(kāi)多、空倉(cāng)

    ………………

     

     
     //開(kāi)多單的平倉(cāng)
     
     if holding>0 and enterbars>0  then
     
     begin
     
     

     
     if  enterbars>=1  and HigherAfterEntry>=enterprice*(1+1/100)       //成交贏利超過(guò)1%,回吐到70%出場(chǎng)
     then
     begin
     price:=EnterPrice+(HigherAfterEntry-EnterPrice)*70/100;
     if low<=price then
     begin
     sell(1,holding,limitr,min(open,price)) ;
     count2:=1;
     end;
     end;
     
    if  enterbars>=1   and HigherAfterEntry<=enterprice*(1+1/100) and HigherAfterEntry>=enterprice*(1+0.5/100)       //成交贏利不超過(guò)1%,大于0.5%,回吐到50%出場(chǎng)
     then
     begin
     price:=EnterPrice+(HigherAfterEntry-EnterPrice)*50/100;
     if low<=price then
     begin
     sell(1,holding,limitr,min(open,price)) ;
      count2:=1;
     end;
     end;
     
     end
     
     
    //開(kāi)空單的平倉(cāng)
     
     if holding<0 and enterbars>0  then
     
     begin
     
     
     
     if  enterbars>=1    and lowerAfterEntry<=enterprice*(1-1/100)       //成交贏利超過(guò)1%,回吐到70%贏利出場(chǎng)
     then
     begin
     price:=EnterPrice - (EnterPrice-LowerAfterEntry)*70/100;
     if high>=price then
     begin
     sellshort(1,holding,limitr,max(open,price)) ;
      count2:=1;
     end;
     end;
     
      if  enterbars>=1   and lowerAfterEntry>=enterprice*(1-1/100)  and lowerAfterEntry<=enterprice*(1-0.5/100)      //成交贏利不超過(guò)1%,大于0.5%,回吐到50%出場(chǎng)
     then
     begin
     price:=EnterPrice - (EnterPrice-LowerAfterEntry)*50/100;
     if high>=price then
     begin
     sellshort(1,holding,limitr,max(open,price)) ;
     count2:=1;
     end;
     end;
     
     end
     
     

     
     
     //收盤(pán)平倉(cāng)
    if time>=183000 then begin
      sell(1,holding,thisclose);
      sellshort(1,holding,thisclose);
    end
     

     

  • 金字塔客服:

    下單價(jià)格不合理,價(jià)格超出k線范圍,導(dǎo)致了該單子被系統(tǒng)檢測(cè)為無(wú)法成交的單子,所以要在所有下單函數(shù)語(yǔ)句后面加上,IGNORECHECKPRICE

     

    下面是經(jīng)過(guò)修改后的代碼:

     

    variable:HigherAfterEntry=0,LowerAfterEntry=999999;


    input:n1(10,5,30,1);
    input:n2(20,5,40,1);
    input:n6(6,4,30,1);
    input:n7(2,1,20,1);


    //9點(diǎn)開(kāi)倉(cāng)

    open5_1:callstock('',vtopen,2,-1);//5分鐘周期的開(kāi)盤(pán)價(jià)
    close5_1:callstock('',vtclose,2,-1);//5分鐘周期的收盤(pán)價(jià)

    open3_1:callstock('',vtopen,17,-1);//3分鐘周期的開(kāi)盤(pán)價(jià)
    close3_1:callstock('',vtclose,17,-1);//3分鐘周期的收盤(pán)價(jià)

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


    dayopen:=valuewhen(time=130100,open);

    開(kāi)盤(pán)價(jià):=dayopen,noaxis,linethick0;
    成交量:=REF(vol,1),noaxis,linethick0;

    if time=130100 then
    begin

    loss:=0; //限制開(kāi)倉(cāng)方式一,只開(kāi)一次
    count1:=1;
    count2:=1;

    end

    計(jì)數(shù)一:=count1,noaxis,linethick0;
    計(jì)數(shù)二:=count2,noaxis,linethick0;
    計(jì)數(shù)三:=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 time>=130000 and holding=0 and count1=1 and loss=0 then

     begin
     
     if h>=dayopen+n1 
     then
     begin
     buy(1,lots,limitr,dayopen+n1),IGNORECHECKPRICE;  //如果9:00走勢(shì)超過(guò)開(kāi)盤(pán)價(jià)n1元就開(kāi)多單
     count1:=0;
     loss:=1;
     end
     
     if l<=dayopen-n1 
     
       then
       begin
       buyshort(1,lots,limitr,dayopen-n1),IGNORECHECKPRICE; //9:00走勢(shì)低于開(kāi)盤(pán)價(jià)n1元就開(kāi)空單
       count1:=0;
       loss:=1;
       end
     
     end
     
     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 time>=130101 and time<180000  then
     
     BEGIN
     
     if holding>0  and  l<=ENTERPRICE-n2
     
     then 
     begin
     sell(1,holding,limitr,enterprice-n2),IGNORECHECKPRICE; //9.00開(kāi)多單,止損設(shè)置低于成交價(jià)n2元

     end
     
     if holding<0  and  h>=ENTERPRICE+n2
     then 
     begin
     sellshort(1,holding,limitr,enterprice+n2),IGNORECHECKPRICE; //9.00開(kāi)空單,止損設(shè)置高于成交價(jià)n2元

     end
     
     end
     
     

     

     
     //開(kāi)多單的平倉(cāng)
     
     if holding>0 and enterbars>0  then
     
     begin
     
     

     
     if  enterbars>=1  and HigherAfterEntry>=enterprice*(1+1/100)       //成交贏利超過(guò)1%,回吐到70%出場(chǎng)
     then
     begin
     price:=EnterPrice+(HigherAfterEntry-EnterPrice)*70/100;
     if low<=price then
     begin
     sell(1,holding,limitr,min(open,price)),IGNORECHECKPRICE ;
     count2:=1;
     end;
     end;
     
    if  enterbars>=1   and HigherAfterEntry<=enterprice*(1+1/100) and HigherAfterEntry>=enterprice*(1+0.5/100)       //成交贏利不超過(guò)1%,大于0.5%,回吐到50%出場(chǎng)
     then
     begin
     price:=EnterPrice+(HigherAfterEntry-EnterPrice)*50/100;
     if low<=price then
     begin
     sell(1,holding,limitr,min(open,price)),IGNORECHECKPRICE ;
      count2:=1;
     end;
     end;
     
     end
     
     
    //開(kāi)空單的平倉(cāng)
     
     if holding<0 and enterbars>0  then
     
     begin
     
     
     
     if  enterbars>=1    and lowerAfterEntry<=enterprice*(1-1/100)       //成交贏利超過(guò)1%,回吐到70%贏利出場(chǎng)
     then
     begin
     price:=EnterPrice - (EnterPrice-LowerAfterEntry)*70/100;
     if high>=price then
     begin
     sellshort(1,holding,limitr,max(open,price)) ,IGNORECHECKPRICE;
      count2:=1;
     end;
     end;
     
      if  enterbars>=1   and lowerAfterEntry>=enterprice*(1-1/100)  and lowerAfterEntry<=enterprice*(1-0.5/100)      //成交贏利不超過(guò)1%,大于0.5%,回吐到50%出場(chǎng)
     then
     begin
     price:=EnterPrice - (EnterPrice-LowerAfterEntry)*50/100;
     if high>=price then
     begin
     sellshort(1,holding,limitr,max(open,price)) ,IGNORECHECKPRICE;
     count2:=1;
     end;
     end;
     
     end
     
     

     
     
     //收盤(pán)平倉(cāng)
    if time>=183000 then begin
      sell(1,holding,thisclose);
      sellshort(1,holding,thisclose);
    end

     

  • 用戶(hù)回復(fù): 添加了IGNORECHECKPRICE函數(shù),也沒(méi)有用,是怎么回事,請(qǐng)幫幫忙,圖形仍是一樣的

 

有思路,想編寫(xiě)各種指標(biāo)公式,程序化交易模型,選股公式,預(yù)警公式的朋友

可聯(lián)系技術(shù)人員 QQ: 1145508240  有需要幫忙請(qǐng)點(diǎn)擊這里留言!!!不貴!點(diǎn)擊查看價(jià)格!


【字體: 】【打印文章】【查看評(píng)論

相關(guān)文章

    沒(méi)有相關(guān)內(nèi)容
主站蜘蛛池模板: 国产精品jizz在线观看直播| 一级毛片视频在线| 波多野结衣在线观看一区| 国产亚洲美女精品久久久2020| 999这里只有精品| 成人精品一区二区三区中文字幕| 亚洲av日韩av不卡在线观看| 猫扑两性色午夜视频免费| 国产乱子伦农村xxxx| 亚洲伊人久久网| 在线观看免费宅男视频| 中文字幕久久久人妻无码| 日韩精品一卡2卡3卡4卡三卡 | 巨大欧美黑人xxxxbbbb| 久久精品国产99久久99久久久| 欧美精品亚洲精品日韩专区 | 日本精品高清一区二区| 亚洲午夜精品久久久久久人妖| 王雨纯脱得一点不剩| 四虎永久免费地址ww484e5566| 国产精品亚洲w码日韩中文| 国产高清在线免费| www.亚洲日本| 成人白浆超碰人人人人| 久久人妻少妇嫩草av蜜桃| 欧美bbbbxxxx| 亚洲日韩小电影在线观看| 狼友av永久网站免费观看| 午夜精品久久久久久| 蜜桃麻豆www久久国产精品| 国产成人精品综合久久久久| 2019天天做天天拍天天夜| 天天拍天天干天天操| 三上悠亚中文字幕在线| 日本chinese人妖video| 久久老子午夜精品无码怎么打| 欧美性另类高清极品| 亚洲精品乱码久久久久久蜜桃不卡| 精品91自产拍在线| 另类国产ts人妖系列| 苍井苍空A免费井线在线观看|