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

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

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

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

    做了一個日內交易系統,要求時間過了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

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

     

  • TB技術人員: 完整程序如下:

    //------------------------------------------------------------------------
    // 簡稱: zigdaytrade
    // 名稱: 日內交易系統
    // 類別: 公式應用
    // 類型: 用戶應用
    // 輸出:
    //------------------------------------------------------------------------
    Params   
            Numeric endTime(14.58);                     //結束交易時間
        Numeric RiskRatio(1);                       //風險率(0-100)
        Numeric boLength(18);                       //突破周期
        Numeric ATRLength(20);                      //平均波動周期
            Numeric Quitlength(10);                     //離市周期
            Numeric weightnumber(1);                    //加權參數
            Numeric Limitednumber(3);                   //交易限制次數(能交易的次數為limitednumber+1次)
        Bool Filtercondition(True);                 //入市過濾條件
    Vars
        Numeric Minpoint;                           //最小變動單位
            NumericSeries AvgTR;                        //ATR
            Numeric F;                                  //表示市場波動性的F值
            Numeric Capital;                            //入市資本
            Numeric scale;                              //買賣規模
            NumericSeries Passwayhi;                    //通道上軌
            NumericSeries Passwaylo;                    //通道下軌
            NumericSeries quithighprice;                //離市時判斷需要的離市周期最高價
            NumericSeries quitlowprice;                 //離市時判斷需要的離市周期最低價
            Numeric myEntryPrice;                       //開倉價格
            Numeric myExitPrice;                        //平倉價格
            NumericSeries tempnum(0);                   //臨時計數器
            Bool Sendorderthisbar(False);               //當前Bar是否有過交易
            NumericSeries preEntryprice(0);             //前一次開倉的價格
    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)                       //只限于當日交易
            {return;}                                 
            If((Date!=Date[1])or(CurrentBar==0))
            {
            //當日的第一個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
    // 版權所有        slarkmonk
    // 更改聲明        TradeBlazer Software保留對TradeBlazer平臺
    //                        每一版本的TrabeBlazer公式修改和重寫的權利
    //------------------------------------------------------------------------

     

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

     

  • 網友回復: 回復 3# kingforestcn
    是的
    怎么了?

     

  • 網友回復: 如果加載5min的周期,收盤平倉的endtime要設為14.55,試試看。

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

相關文章

    沒有相關內容
主站蜘蛛池模板: 欧美亚洲精品一区二三 | 国产精品图片 | 日韩精品一区二区三区中文精品 | 经典国产乱子伦精品视频 | sese在线视频 | 国产欧美亚洲另类第一页 | 日韩一区二区视频 | 婷婷国产偷v国产偷v亚洲 | 国产福利在线 | 91亚洲精品成人一区 | 国产一区中文字幕 | 欧美.成人.综合在线 | 快射影院| 亚洲欧美在线观看91偷拍 | 久久久久这里只有精品 | 亚洲天天在线日亚洲洲精 | 中国美女日b | 外国一级黄色毛片 | 久久免费精品视频在线观看 | 日本爽快片100色毛片 | 视频一区国产 | 亚洲乱码在线观看 | 国产中日韩一区二区三区 | 日日噜噜夜夜狠狠久久丁香 | 国产在线精品香蕉综合网一区 | 免费观看成人羞羞视频网站观看 | 欧美高清一区 | 亚洲精品一区二区三区婷婷 | 亚洲第一视频在线播放 | x8x8国产日韩欧美 | 国产精品一区伦免视频播放 | 日本精品视频在线观看 | 日韩欧美精品有码在线观看 | 久久金8天国 | 欧美影院一区 | 99精品高清不卡在线观看 | 99热只有精品一区二区 | 午夜影院私人 | 日本不卡高清免费 | 黄色男人的天堂 | 日日撸夜夜撸网站 |