大伊人青草狠狠久久-大伊香蕉精品视频在线-大伊香蕉精品一区视频在线-大伊香蕉在线精品不卡视频-大伊香蕉在线精品视频75-大伊香蕉在线精品视频人碰人

您現在的位置:程序化交易>> 期貨公式>> 金字塔等>> 金字塔知識>>正文內容

請教:當贏利>=1%,回吐到70%平倉,問題在哪 [金字塔]

  • 咨詢內容:

    基本思路,就是根據開盤價,比開盤價高N1就開多,低N1開空,價格虧損N2元就止損,贏利超過0.5%-1% ,回吐到50%平倉,贏利超過1%,回吐到70%平倉,第一次平倉是對的,再次開倉之后的平倉就不行了,開倉即平。


    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點開倉

    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分鐘周期的成交量


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

    開盤價:=dayopen,noaxis,linethick0;
    成交量:=REF(vol,1),noaxis,linethick0;

    if time=130100 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 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走勢超過開盤價n1元就開多單
     count1:=0;
     loss:=1;
     end
     
     if l<=dayopen-n1 
     
       then
       begin
       buyshort(1,lots,limitr,dayopen-n1); //9:00走勢低于開盤
    價n1元就開空單
       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開多單,止損設置低于成交價n2元

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

     end
     
     end 
     
     
     再次開多、空倉

    ………………

     

     
     //開多單的平倉
     
     if holding>0 and enterbars>0  then
     
     begin
     
     

     
     if  enterbars>=1  and HigherAfterEntry>=enterprice*(1+1/100)       //成交贏利超過1%,回吐到70%出場
     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)       //成交贏利不超過1%,大于0.5%,回吐到50%出場
     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
     
     
    //開空單的平倉
     
     if holding<0 and enterbars>0  then
     
     begin
     
     
     
     if  enterbars>=1    and lowerAfterEntry<=enterprice*(1-1/100)       //成交贏利超過1%,回吐到70%贏利出場
     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)      //成交贏利不超過1%,大于0.5%,回吐到50%出場
     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
     
     

     
     
     //收盤平倉
    if time>=183000 then begin
      sell(1,holding,thisclose);
      sellshort(1,holding,thisclose);
    end
     

     

  • 金字塔客服:

    下單價格不合理,價格超出k線范圍,導致了該單子被系統檢測為無法成交的單子,所以要在所有下單函數語句后面加上,IGNORECHECKPRICE

     

    下面是經過修改后的代碼:

     

    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點開倉

    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分鐘周期的成交量


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

    開盤價:=dayopen,noaxis,linethick0;
    成交量:=REF(vol,1),noaxis,linethick0;

    if time=130100 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 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走勢超過開盤價n1元就開多單
     count1:=0;
     loss:=1;
     end
     
     if l<=dayopen-n1 
     
       then
       begin
       buyshort(1,lots,limitr,dayopen-n1),IGNORECHECKPRICE; //9:00走勢低于開盤價n1元就開空單
       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開多單,止損設置低于成交價n2元

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

     end
     
     end
     
     

     

     
     //開多單的平倉
     
     if holding>0 and enterbars>0  then
     
     begin
     
     

     
     if  enterbars>=1  and HigherAfterEntry>=enterprice*(1+1/100)       //成交贏利超過1%,回吐到70%出場
     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)       //成交贏利不超過1%,大于0.5%,回吐到50%出場
     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
     
     
    //開空單的平倉
     
     if holding<0 and enterbars>0  then
     
     begin
     
     
     
     if  enterbars>=1    and lowerAfterEntry<=enterprice*(1-1/100)       //成交贏利超過1%,回吐到70%贏利出場
     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)      //成交贏利不超過1%,大于0.5%,回吐到50%出場
     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
     
     

     
     
     //收盤平倉
    if time>=183000 then begin
      sell(1,holding,thisclose);
      sellshort(1,holding,thisclose);
    end

     

  • 用戶回復: 添加了IGNORECHECKPRICE函數,也沒有用,是怎么回事,請幫幫忙,圖形仍是一樣的

 

有思路,想編寫各種指標公式,程序化交易模型,選股公式,預警公式的朋友

可聯系技術人員 QQ: 1145508240  有需要幫忙請點擊這里留言!!!進行 有償 編寫!不貴!點擊查看價格!


【字體: 】【打印文章】【查看評論

相關文章

    沒有相關內容
主站蜘蛛池模板: 久久综合图片 | 久久国产免费一区二区三区 | 中文字字幕乱码视频 | 大香伊人久久 | 第一色区| 欧美亚洲另类视频 | 欧美激情_区二区三区 | 国产精品美女久久久久网 | 国产精品毛片天天看片 | 久青草国产免费观看 | 一级香蕉视频在线观看 | 国产99视频精品草莓免视看 | 色姑娘桃花网 | 中文字幕亚洲色图 | 免费在线亚洲 | 亚洲免费视频一区二区三区 | 国产精品毛片一区二区三区 | 台湾一级毛片免费播放 | 欧美亚洲中日韩中文字幕在线 | 日韩欧美亚洲每的更新在线 | 欧美曰韩一区二区三区 | 美女在线视频观看影院免费天天看 | 日本免费一区视频 | 国产99高清一区二区 | www.黄色片| 欧美v亚洲v国产v | 手机看片高清日韩精品 | 在线日韩视频 | 国产成人性毛片 | 香蕉视频在线观看男女 | 日本最猛黑人xxxx猛交 | 久久免费激情视频 | av线上免费观看 | 欧美一级第一免费高清 | 国产香蕉尹人综合在线 | 911精品国产亚洲日本美国韩国 | 日韩欧美二区 | 欧美激情一区二区三区中文字幕 | 羞羞视频在线观看视频 | 国产午夜精品一区二区 | 午夜小视频网站 |