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

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

加入交易次數(shù)限制后結(jié)果異常 [金字塔]

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

    早盤(pán)突破系統(tǒng),1分鐘上測(cè)試2年,

    剛開(kāi)始寫(xiě)完交易次數(shù)是1700多;后來(lái)添加了一個(gè)每天只能交易一手的條件,結(jié)果交易次數(shù)只有3次了!

    添加了交易次數(shù)限制的代碼如下,是我寫(xiě)的邏輯出錯(cuò)了嗎?

     

    input:T(30,5,60,5),
    SS(1,1,10,1),
    U(1,1,10,1),
    D(1,1,10,1),
    CS(1,1,5,1);//交易次數(shù)限制
    VARIABLE:NUM=0;//統(tǒng)計(jì)開(kāi)倉(cāng)動(dòng)作

     

    n:=barslast(date<>ref(date,1))+1;//開(kāi)盤(pán)以來(lái)的K線數(shù)量
    hh:=hhv(high,n);//開(kāi)盤(pán)以來(lái)的高價(jià)
    H30:=valuewhen(time>=opentime(1) and time<=opentime(1)+T*100,hh);//30分鐘內(nèi)的高價(jià)
    ll:=llv(low,n);//開(kāi)盤(pán)以來(lái)的低價(jià)
    L30:=valuewhen(time>=opentime(1) and time<=opentime(1)+T*100,ll);//30分鐘內(nèi)的低價(jià)
    上軌:H30+U*MINDIFF,linethick2;
    下軌:L30-D*MINDIFF,linethick2;
    buycond:=cross(high,上軌);//做多條件
    buyshortcond:=cross(下軌,low);//做空條件
    buyprice:=max(open,上軌)+1*mindiff;//開(kāi)多價(jià)格
    buyshortprice:=min(open,下軌)-1*mindiff;//開(kāi)空價(jià)格

     

    stopbuy:max(valuewhen(n=1,open),ref(high,1)*(1-0.5/100)),linedot;//多頭止損價(jià)位

    stopshort:min(valuewhen(n=1,open),ref(low,1)*(1-0.5/100)),linedot;//空頭止損價(jià)位
    sellcond:=cross(stopbuy,low);//平多條件
    sellshortcond:=cross(high,stopshort);//平空條件
    sellprice:=min(open,stopbuy)-1*mindiff;//平多價(jià)格
    sellshortprice:=max(open,stopshort)+1*mindiff;//平空價(jià)格


    entertime:=time>opentime(1)+T*100 and time<closetime(0)-10*100;//入場(chǎng)交易時(shí)間
    exittime:=time>=closetime(0)-10*100;//平倉(cāng)離場(chǎng)時(shí)間

     

    if entertime and holding=0 and num<CS then  {開(kāi)倉(cāng)入場(chǎng)}
    begin 
     if buycond then
        BEGIN
        buy(1,ss,limitr,buyprice);
        NUM:=NUM+1;
        END
     else if buyshortcond then
        BEGIN
        buyshort(1,ss,limitr,buyshortprice);
        NUM:=NUM+1;
        END
    end

     

    if enterbars>1 and holding<>0 then {止損離場(chǎng)}
    begin
     if holding>0 and sellcond then
        sell(1,ss,limitr,sellprice);
     else if holding<0 and sellshortcond then
        sellshort(1,ss,limitr,sellshortprice);
    end

     

    if exittime and holding<>0 then  {收盤(pán)平倉(cāng)}
    begin
      sell(holding>0,ss,limitr,open-1*mindiff);
      sellshort(holding<0,ss,limitr,open+1*mindiff);
      NUM:=0;
    end

     

    持倉(cāng):holding,linethick0;
    凈利潤(rùn):netprofit,linethick0;
    資產(chǎn):asset,linethick0;
    資金:cash(0),linethick0;


     
     

     

     

     

     

     

     

     

     

     

  • 金字塔客服: 并且檢查了一下圖表,本來(lái)當(dāng)天是數(shù)據(jù)是滿足交易條件的,卻沒(méi)有顯示也沒(méi)有執(zhí)行交易信號(hào)。

     

  • 用戶回復(fù):

    if exittime and holding<>0 then  {收盤(pán)平倉(cāng)}
    begin
      sell(holding>0,ss,limitr,open-1*mindiff);
      sellshort(holding<0,ss,limitr,open+1*mindiff);
      NUM:=0;
    end

     

    改成

     

    if exittime and holding<>0 then  {收盤(pán)平倉(cāng)}
    begin
      sell(holding>0,ss,limitr,open-1*mindiff);
      sellshort(holding<0,ss,limitr,open+1*mindiff);
    end

    if exittime then   NUM:=0;

     

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

    試了一下,的確糾正過(guò)來(lái)了謝謝、、

 

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

可聯(lián)系技術(shù)人員 QQ: 511411198  點(diǎn)擊這里給我發(fā)消息進(jìn)行 有償 編寫(xiě)!不貴!點(diǎn)擊查看價(jià)格!


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

相關(guān)文章

    沒(méi)有相關(guān)內(nèi)容
主站蜘蛛池模板: 成人爽视频 | 五月天色婷婷在线 | 99热久久国产综合精品久久国产 | 日韩精品一区二区三区在线观看l | 激情影院a| 亚洲欧美二区三区久本道 | 国产在线不卡视频 | 国产美女久久久亚洲 | 四虎影院在线 | 欧美xxxx狂喷水喷水 | 久久久久久人精品免费费看 | 欧美真人毛片动作视频 | 五月天中文在线 | 狠狠躁夜夜躁人人爽天天3 狠狠躁夜夜躁人人爽天天miya | 香蕉国产一区二区 | 免费爱爱| 香蕉视频黄在线观看 | 亚洲不卡 | 欧美精品成人 | 天天射天天干天天操 | 欧美一区二区三区东南亚 | 国产亚洲精品网站 | 很黄很色的小视频在线网站 | 天天插天天射天天干 | 99热这里有精品 | 精品亚洲视频在线 | 干夜夜| 久久伊人久久亚洲综合 | 人成xxxwww免费视频 | 天堂男人在线 | 97午夜精品 | 日韩精品一区二区三区中文字幕 | 久久涩综合 | 欧美啪啪毛片一区二区 | 天天干影院 | 久久精品国产亚洲aa | 3d动漫免费一区二区三区 | 久久久久久综合成人精品 | 9久9久热精品视频在线观看 | 久久久噜噜噜久噜久久 | 久久色亚洲 |