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

請(qǐng)問(wèn)老師如何實(shí)現(xiàn)模型組合后的交易次數(shù) [金字塔]

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

     

    下面是2個(gè)模型組合,圖表交易。請(qǐng)問(wèn)老師模型1與模型2分別交易不超過(guò)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分別交易不超過(guò)2

    這句話(huà)是什么意思呢?

     

  • 用戶(hù)回復(fù): 以下是引用klc在2014/2/16 17:55:26的發(fā)言:

    模型1與模型2分別交易不超過(guò)2

    這句話(huà)是什么意思呢?

    就是模1開(kāi)倉(cāng)不超過(guò)2次,模2開(kāi)倉(cāng)不超過(guò)2次。

     

  • 網(wǎng)友回復(fù):

    variable:num=0;// 全局變量,控制交易次數(shù),沒(méi)開(kāi)倉(cāng)一次把這個(gè)值加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

     

  • 網(wǎng)友回復(fù): 以下是引用yukizzc在2014/2/17 9:08:18的發(fā)言:

    variable:num=0;// 全局變量,控制交易次數(shù),沒(méi)開(kāi)倉(cāng)一次把這個(gè)值加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加在開(kāi)倉(cāng)語(yǔ)句控制交易次數(shù),結(jié)果交易信號(hào)幾乎看不到了;如num:=num+1加在平倉(cāng)語(yǔ)句中控制交易次數(shù)又控制不住,即交易超過(guò)2次,如模型不組合在一起分別運(yùn)行則正常即不超過(guò)2次。昨天我已都試過(guò)了。老師上面的方法你實(shí)際試驗(yàn)的結(jié)果如何呀?

    num:=num+1;

    end

 

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

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


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

相關(guān)文章

    沒(méi)有相關(guān)內(nèi)容
主站蜘蛛池模板: 日韩美视频网站| 乱子伦农村xxxx视频| 久久久综合中文字幕久久| 99re热视频在线| 老八吃屎奥利给原视频带声音的| 粉嫩虎白女P虎白女在线| 欧美性色黄大片www| 无遮挡1000部拍拍拍免费凤凰| 最近2018免费中文字幕视频| 无遮挡边吃摸边吃奶边做| 国内精品久久久久久99| 国产午夜福利精品一区二区三区 | 国产午夜精品理论片| 伊人久久大香线蕉综合影院首页| 久操视频在线免费观看| 一本色道久久88亚洲综合 | a级毛片免费网站| 香蕉视频在线免费| 狠狠色噜噜狠狠狠狠69| 日本老师和同学xxxx| 在线私拍国产福利精品| 国产一区二区精品久久| 亚洲国产成人片在线观看| 东北疯狂xxxxbbbb中国| 五月丁六月停停| 狠狠穞老司机的福67194| 日本亚洲精品色婷婷在线影院| 国内精品视频一区二区三区| 四虎www成人影院| 亚洲av成人一区二区三区| 99久久亚洲综合精品成人网| 老司机深夜网站| 最好的中文字幕2018免费视频| 在线综合 亚洲 欧美中文字幕| 国产一区二区三区久久| 久精品国产欧美亚洲色aⅴ大片| AV无码免费一区二区三区| 耻辱にまみれた失禁调教| 最近在线观看视频2019| 国产边摸边吃奶叫床视频| 全彩口工彩漫画无遮漫画|