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

請問老師如何實現模型組合后的交易次數 [金字塔]

  • 咨詢內容:  

     

    下面是2個模型組合,圖表交易。請問老師模型1與模型2分別交易不超過2次,如何改編呢?

     

    input: cang2(1,0,10,1);
    variable:cc1=0,cc2=0;

     

    runmode:0;

    variable:zs=0,cc1=0;

    ma5:=ma(c,5);

    ma20:=ma(c,20);

    entertime:=time>100000 and time<144500;

    if holding>0 and cc1<=0 then sell(1,1,limitr,o);

    if holding<0 and cc1>=0 then sellshort(1,1,limitr,o);

    if holding=0 and cc1>0 then buy(1,1,limitr,o);

    if holding=0 and cc1<0 then buyshort(1,1,limitr,o);

    if cc1>0 and l<zs then begin

    sell(1,1,limitr,min(o,zs-0.6));

    cc1:=0;

    end

    if cc1<0 and h>zs then begin

    sellshort(1,1,limitr,max(o,zs+0.6));

    cc1:=0;

    end

    if cc1>0 and ma5<ma20 then cc1:=0;

    if cc1<0 and ma5>ma20 then cc1:=0;

    if cc1=0 and ma5>ma20 and entertime then begin

    cc1:=1;

    zs:=c-10;

    end

    if cc1=0 and ma5<ma20 and entertime then begin

    cc1:=-1;

    zs:=c+10;

    end

    if time>=150000 then begin

    cc1:=0;

    end

    /////////////////////////////////以上是模型1

    /////////////////////////////////模型2——20周期反手
    hi:=ref(hhv(h,20),1);
    lo:=ref(llv(l,20),1);
    if cc2>0 and l<lo then begin
    pc:=min(max(holding,0),cang2);
    kc:=cang2-pc;
    if pc>0 then sell(1,pc,limitr,min(o,lo-0.2)-0.6);
    if kc>0 then buyshort(1,kc,limitr,min(o,lo-0.2)-0.6);
    cc2:=0;
    end
    if cc2<0 and h>hi then begin
    pc:=min(abs(min(holding,0)),cang2);
    kc:=cang2-pc;
    if pc>0 then sellshort(1,pc,limitr,max(o,hi+0.2)+0.6);
    if kc>0 then buy(1,kc,limitr,max(o,hi+0.2)+0.6);
    cc2:=0;
    end
    if cc2=0 and h>hi then begin
    pc:=min(abs(min(holding,0)),cang2);
    kc:=cang2-pc;
    if pc>0 then sellshort(1,pc,limitr,max(o,hi+0.2)+0.6);
    if kc>0 then buy(1,kc,limitr,max(o,hi+0.2)+0.6);
    cc2:=1;
    end
    if cc2=0 and l<lo then begin
    pc:=min(max(holding,0),cang2);
    kc:=cang2-pc;
    if pc>0 then sell(1,pc,limitr,min(o,lo-0.2)-0.6);
    if kc>0 then buyshort(1,kc,limitr,min(o,lo-0.2)-0.6);
    cc2:=-1;
    end

    /////////////////////////////////以上是模型2

     

     

  • 金字塔客服:

    模型1與模型2分別交易不超過2

    這句話是什么意思呢?

     

  • 用戶回復: 以下是引用klc在2014/2/16 17:55:26的發言:

    模型1與模型2分別交易不超過2

    這句話是什么意思呢?

    就是模1開倉不超過2次,模2開倉不超過2次。

     

  • 網友回復:

    variable:num=0;// 全局變量,控制交易次數,沒開倉一次把這個值加1。

     

    if holding=0 and cc1>0 and num<2 then

    begin

    buy(1,1,limitr,o);

    num:=num+1;

    end

     

    if holding=0 and cc1<0 and num<2 then

    being

    buyshort(1,1,limitr,o);

    num:=num+1;

    end

     

  • 網友回復: 以下是引用yukizzc在2014/2/17 9:08:18的發言:

    variable:num=0;// 全局變量,控制交易次數,沒開倉一次把這個值加1。

     

    if holding=0 and cc1>0 and num<2 then

    begin

    buy(1,1,limitr,o);

    num:=num+1;

    end

     

    if holding=0 and cc1<0 and num<2 then

    being

    buyshort(1,1,limitr,o);

    num:=num+1加在開倉語句控制交易次數,結果交易信號幾乎看不到了;如num:=num+1加在平倉語句中控制交易次數又控制不住,即交易超過2次,如模型不組合在一起分別運行則正常即不超過2次。昨天我已都試過了。老師上面的方法你實際試驗的結果如何呀?

    num:=num+1;

    end

 

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

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


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

相關文章

    沒有相關內容
主站蜘蛛池模板: 动漫精品一区二区三区四区| 一本久久A久久免费精品不卡| 亚洲av产在线精品亚洲第一站| 久久天天躁狠狠躁夜夜avapp| 亚欧免费无码aⅴ在线观看| 久久精品成人免费观看| 久久久久88色偷偷| 一区二区三区免费电影| 91精品国产免费入口| 四虎最新永久免费视频| 色欲久久久天天天综合网精品 | 美女大黄三级视频在线观看| 五月激情综合网| 老司机在线精品| 欧美黄成人免费网站大全| 晚上一个人看的www| 日本护士69xxxx免费| 成年女人毛片免费视频| 好吊色青青青国产在线观看 | 无码人妻丰满熟妇区毛片18| 在线观看亚洲一区| 国产一区二区福利| 亚洲午夜久久久精品电影院| 你懂的免费视频| 久久夜色精品国产噜噜麻豆 | 三级中文有码中文字幕| 欧美jizz18性欧美年轻| 狠狠色噜噜狠狠狠狠97| 日本动态120秒免费| 国产精品夜间视频香蕉| 免费看黄的网页| 久久婷婷五月综合97色一本一本| 99日精品欧美国产| 美雪艾莉丝番号| 日韩精品国产另类专区| 在线精品无码字幕无码av| 嘟嘟嘟www在线观看免费高清| 五十路亲子中出在线观看| 99久在线国内在线播放免费观看| 羞羞漫画在线成人漫画阅读免费| 日韩精品电影在线|