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

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

開拓者突破型日內(nèi)交易策略源碼 [開拓者 TB]

  • 源碼:


    Params   
            Numeric endTime(14.55);                    //結(jié)束交易時間
           Numeric RiskRatio(1);                       //風(fēng)險率(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;                //離市時判斷需要的離市周期最高價
            NumericSeries quitlowprice;                 //離市時判斷需要的離市周期最低價
            Numeric myEntryPrice;                       //開倉價格
            Numeric myExitPrice;                        //平倉價格
            NumericSeries tempnum(0);                   //臨時計(jì)數(shù)器
            Bool Sendorderthisbar(False);               //當(dāng)前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)                       //只限于當(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==0.145500 && /*CurrentTime>0.145800 &&*/ MarketPosition<>0)  //收盤平倉用于5Min
            {
                    Sell(0,Close);
                    BuyToCover(0,Close);
            
            }
            


    End

     

 

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

可聯(lián)系技術(shù)人員 QQ: 262069696  點(diǎn)擊在線交流進(jìn)行 有償 編寫!不貴!點(diǎn)擊查看價格!


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

相關(guān)文章

    沒有相關(guān)內(nèi)容
主站蜘蛛池模板: 六月丁香婷婷激情国产 | 国产成人高清在线观看播放 | 国产午夜精品久久久久九九 | 99热在线精品观看 | 男女免费视频 | 成人在线免费视频播放 | 免费区一级欧美毛片 | 国产精品美女久久久久网站 | 欧美特黄a级猛片a级 | 久久精品综合免费观看 | 久久九九99热这里只有精品 | 国产亚洲精品在天天在线麻豆 | 欧美精品a毛片免费观看 | 五月天色婷婷在线 | 毛片免费观看成人 | 亚洲va在线va天堂成人 | 狠狠综合久久久久综合 | 免费可以直接观看的毛片 | 香蕉tv亚洲专区在线观看 | 久久国产香蕉一区精品 | 天天操天天摸天天射 | 国产欧美成人一区二区三区 | 国产成人免费高清视频 | 久久婷婷国产麻豆91天堂 | 男人天堂.com | 一级中国毛片 | 久久91| 天天爱夜夜做 | 四虎视频在线精品免费观看 | 国产精品成 | 四虎国产精品免费久久影院 | 成人欧美午夜视频毛片 | 国产成人免费视频精品一区二区 | 男人的天堂一区二区视频在线观看 | 亚洲欧美伦理 | 午夜视频在线免费看 | 在线中文字幕日韩 | 成人亚州 | 九九视频在线观看视频6偷拍 | 国产永久免费爽视频在线 | 久久久久免费观看 |