您現(xiàn)在的位置:程序化交易>> 期貨公式>> 交易開拓者(TB)>> 開拓者知識>>正文內(nèi)容

在模擬盤測試,為何系統(tǒng)并沒有給我在收盤前平倉? - TradeBlazer公式 [開拓者 TB]

  • 咨詢內(nèi)容: 本帖最后由 slarkmonk 于 2011-8-25 15:05 編輯

    做了一個日內(nèi)交易系統(tǒng),要求時間過了14.58之后要平倉。

    Params
    ........(省略)
    Numeric endtime(14.58);
    Vars
    ........(省略)
    Begin
         ......(省略前面部分,最后部分如下)

    If(time>=endtime/100)
    {
        If(marketposition==1)
            {
                Sell(0,Q_AskPrice);
            }Else If(marketposition==-1)
            {
                BuyToCover(0,Q_BidPrice);
            }Else
            {
                return;
            }
    }
    End

    結(jié)果有些品種卻沒有平倉 為何?
    附圖
    未命名1.jpg (11.44 KB, 下載次數(shù): 0) 2011-8-25 14:59:52 上傳

     

  • TB技術(shù)人員: 完整程序如下:

    //------------------------------------------------------------------------
    // 簡稱: zigdaytrade
    // 名稱: 日內(nèi)交易系統(tǒng)
    // 類別: 公式應(yīng)用
    // 類型: 用戶應(yīng)用
    // 輸出:
    //------------------------------------------------------------------------
    Params   
            Numeric endTime(14.58);                     //結(jié)束交易時間
        Numeric RiskRatio(1);                       //風(fēng)險(xiǎn)率(0-100)
        Numeric boLength(18);                       //突破周期
        Numeric ATRLength(20);                      //平均波動周期
            Numeric Quitlength(10);                     //離市周期
            Numeric weightnumber(1);                    //加權(quán)參數(shù)
            Numeric Limitednumber(3);                   //交易限制次數(shù)(能交易的次數(shù)為limitednumber+1次)
        Bool Filtercondition(True);                 //入市過濾條件
    Vars
        Numeric Minpoint;                           //最小變動單位
            NumericSeries AvgTR;                        //ATR
            Numeric F;                                  //表示市場波動性的F值
            Numeric Capital;                            //入市資本
            Numeric scale;                              //買賣規(guī)模
            NumericSeries Passwayhi;                    //通道上軌
            NumericSeries Passwaylo;                    //通道下軌
            NumericSeries quithighprice;                //離市時判斷需要的離市周期最高價(jià)
            NumericSeries quitlowprice;                 //離市時判斷需要的離市周期最低價(jià)
            Numeric myEntryPrice;                       //開倉價(jià)格
            Numeric myExitPrice;                        //平倉價(jià)格
            NumericSeries tempnum(0);                   //臨時計(jì)數(shù)器
            Bool Sendorderthisbar(False);               //當(dāng)前Bar是否有過交易
            NumericSeries preEntryprice(0);             //前一次開倉的價(jià)格
    Begin
            Minpoint=Minmove*PriceScale;
            AvgTR=XAverage(TrueRange,ATRlength);
            F=weightnumber*AvgTR[1];
            Capital=Portfolio_CurrentCapital()+Portfolio_UsedMargin();
            scale=(Capital*RiskRatio/100)/(F*ContractUnit()*BigPointValue());
            scale=IntPart(scale);
           
            Passwayhi=HighestFC(High[1],boLength);
            Passwaylo=LowestFC(Low[1],boLength);
           
            quitlowprice=LowestFC(Low[1],Quitlength);
            quithighprice=HighestFC(High[1],Quitlength);
           
            Commentary("scale="+Text(scale));
            Commentary("preEntryprice="+Text(preEntryprice));
           
            If(Date!=currentdate)                       //只限于當(dāng)日交易
            {return;}                                 
            If((Date!=Date[1])or(CurrentBar==0))
            {
            //當(dāng)日的第一個Bar
            preEntryprice=InvalidNumeric;
            tempnum=Limitednumber;
            return;
            }
           
            If(tempnum[1]<1)
            {
            tempnum=limitednumber;
            }
           
            //開倉
    If(time<endtime/100)
    {       
            If(MarketPosition==0 And Filtercondition)
            {
                If(High>Passwayhi And scale>=1)
                    {
                    myEntryPrice=Min(high,passwayhi+minpoint);
                    myentryprice=IIF(myentryprice<open,open,myentryprice);
                    preentryprice=myentryprice;
                    Buy(scale,myentryprice);
                    sendorderthisbar=True;
                    }
                   
                    If(Low<passwaylo And scale>=1)
                    {
                    myentryprice=Max(low,passwaylo-Minpoint);
                    myentryprice=IIF(myentryprice>open,open,myentryprice);
                    preentryprice=myentryprice;
                    SellShort(scale,myentryprice);
                    sendorderthisbar=True;
                    }
            }
           
           
            If(Marketposition==1)
            {
                Commentary("quitlowprice="+Text(quitlowprice));
                    If(Low<quitlowprice)
                    {
                        myexitprice=Max(low,quitlowprice-Minpoint);
                            myexitprice=IIF(myexitprice>open,open,myexitprice);
                            Sell(0,myexitprice);
                            tempnum=limitednumber;
                    }Else
                    {
                        tempnum=tempnum[1];
                            If(preentryprice!=Invalidnumeric And scale>=1)
                            {
                                If((open>=preentryprice+0.5*F) And (tempnum>=1))
                                    {
                                        myentryprice=open;
                                            preentryprice=myentryprice;
                                            Buy(scale,myentryprice);
                                            sendorderthisbar=True;
                                            tempnum=tempnum-1;
                                    }
                                   
                                    While((High>=preentryprice+0.5*F) And (tempnum>=1))
                                    {
                                        myentryprice=preentryprice+0.5*F;
                                            preentryprice=myentryprice;
                                            Buy(scale,myentryprice);
                                            sendorderthisbar=true;
                                            tempnum=tempnum-1;
                                    }
                            }
                           
                            If(low<=preentryprice-2*F And sendorderthisbar==false)
                            {
                            myexitprice=preentryprice-2*F;
                            Sell(0,myexitprice);
                            tempnum=limitednumber;
                            }
                    }
            }Else If(marketposition==-1)
            {
                Commentary("quithighprice="+Text(quithighprice));
                    If(high>quithighprice)
                    {
                        myexitprice=Min(High,quithighprice+Minpoint);
                            myexitprice=IIF(myexitprice<open,open,myexitprice);
                            BuyToCover(0,myexitprice);
                            tempnum=limitednumber;
                    }Else
                    {   tempnum=tempnum[1];
                        If(preentryprice!=Invalidnumeric And scale>=1)
                            {
                                If((open<=preentryprice-0.5*F) And (tempnum>=1))
                                    {
                                        myentryprice=Open;
                                            preentryprice=myentryprice;
                                            SellShort(scale,myentryprice);
                                            sendorderthisbar=True;
                                            tempnum=tempnum-1;
                                    }
                                   
                                    While((Low<=preentryprice-0.5*F) And (tempnum>=1))
                                    {
                                        myentryprice=preentryprice-0.5*F;
                                            preentryprice=myentryprice;
                                            SellShort(scale,myentryprice);
                                            sendorderthisbar=True;
                                            tempnum=tempnum-1;
                                    }
                            }
                           
                           
                            If(High>=preentryprice+2*F And sendorderthisbar==False)
                            {
                                myexitprice=preentryprice+2*F;
                                    BuyToCover(0,myexitprice);
                                    tempnum=limitednumber;
                            }
                    }
            }
    }


    If(time>=endtime/100)
    {
        If(marketposition==1)
            {
                Sell(0,Q_AskPrice);
            }Else If(marketposition==-1)
            {
                BuyToCover(0,Q_BidPrice);
            }Else
            {
                return;
            }
    }
    End

    //------------------------------------------------------------------------
    // 編譯版本        GS2010.12.08
    // 用戶版本        2011/08/24 08:48
    // 版權(quán)所有        slarkmonk
    // 更改聲明        TradeBlazer Software保留對TradeBlazer平臺
    //                        每一版本的TrabeBlazer公式修改和重寫的權(quán)利
    //------------------------------------------------------------------------

     

  • TB客服: 沒平倉的品種加載的周期是不是5min以上周期?

     

  • 網(wǎng)友回復(fù): 回復(fù) 3# kingforestcn
    是的
    怎么了?

     

  • 網(wǎng)友回復(fù): 如果加載5min的周期,收盤平倉的endtime要設(shè)為14.55,試試看。

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

相關(guān)文章

    沒有相關(guān)內(nèi)容
主站蜘蛛池模板: 中文字幕在线看视频一区二区三区| 免费人成在线观看网站品爱网| 91在线看片一区国产| 日日噜噜夜夜狠狠va视频| 亚洲性图第一页| 精品一区二区高清在线观看| 国产小视频在线观看网站| 99ri在线观看| 成人精品一区二区三区校园激情| 五月综合色婷婷| 波多野结衣av无码| 向日葵app在线观看下载视频免费| 欧美日在线观看| 在线观看a网站| 中文字幕免费在线看线人动作大片 | 亚洲日本香蕉视频观看视频| 精品国产欧美sv在线观看| 国产卡一卡二卡三卡四| 18禁裸男晨勃露j毛免费观看| 天天摸天天舔天天操| 中文字幕无码无码专区| 暖暖免费中国高清在线| 亚洲欧洲精品成人久久曰影片| 窝窝视频成人影院午夜在线| 国产ts在线播放| 黄色一级毛片免费看| 国产精品对白交换视频| jizz18日本人在线播放| 打开腿让我添你下面小污文| 久久精品综合电影| 欧美成人亚洲高清在线观看| 人妻va精品va欧美va| 纯爱无遮挡h肉动漫在线播放| 国产在线中文字幕| 美女无遮挡拍拍拍免费视频| 在线播放亚洲第一字幕| 一本一本久久a久久精品综合| 无忧传媒视频免费观看入口| 久久男人的天堂色偷偷| 欧美va久久久噜噜噜久久| 亚洲欧洲精品成人久久曰影片 |