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

Aberration交易系統源碼整理: [開拓者 TB]

  • 咨詢內容: Aberration交易系統源碼整理:青蜂俠 微信adu3341 ;QQ 994206922 ;
    交易開拓者 代碼
    Params
    ? ? ? ? Numeric Length(90);
    ? ? ? ? Numeric StdDevUp(2.0);??//標準差參數
    ? ? ? ? Numeric StdDevDn(-2.0); //標準差參數
    ? ? ? ? Numeric Lots(1);
    Vars
    ? ? ? ? Series<Numeric> UpperBand;
    ? ? ? ? Series<Numeric> LowerBand;
    ? ? ? ? Series<Numeric> AveMa;
    ? ? ? ? Numeric StdValue;
    Events
    ? ? onBar(ArrayRef<Integer> indexs)
    ? ? {? ?
    ? ?? ???//布林指標計算
    ? ? ? ? ? ? AveMa=Average(Close[1],Length);
    ? ? ? ? ? ? StdValue = StandardDev(Close[1],Length);
    ? ? ? ? ? ?
    ? ? ? ? ? ? UpperBand=Avema+StdDevUp*StdValue;? ?//標準差參數
    ? ? ? ? ? ? LowerBand=Avema-StdDevUp*StdValue;? ?//標準差參數
    ? ? ? ? ? ?
    ? ? ? ? ? ? PlotNumeric("UpperBand",UpperBand);
    ? ? ? ? ? ? PlotNumeric("LowerBand",LowerBand);
    ? ? ? ? ? ? PlotNumeric("AveMa",AveMa);
    ? ? ? ? ? ? //
    ? ? ? ? ? ? If(MarketPosition!=1 &&CrossOver(Close[1],UpperBand[1]))
    ? ? ? ? ? ? {
    ? ?? ?? ?? ? Buy(Lots,Open);
    ? ? ? ? ? ? }
    ? ???
    ? ? ? ? ? ? If(MarketPosition!=-1 &&CrossUnder(Close[1],LowerBand[1]))
    ? ? ? ? ? ? {
    ? ?? ?? ?? ? SellShort(Lots,Open);
    ? ? ? ? ? ? }
    ? ???
    ? ? ? ? ? ? If(MarketPosition==1 && Close[1]<AveMa[1])
    ? ? ? ? ? ? {
    ? ?? ?? ?? ? Sell(Lots,Open);
    ? ? ? ? ? ? }
    ? ???
    ? ? ? ? ? ? If(MarketPosition==-1 && Close[1]>AveMa[1])
    ? ? ? ? ? ? {
    ? ???
    ? ?? ?? ?? ?BuyToCover(Lots,Open);
    ? ? ? ? ? ? }
    ? ???
    }

    ===========================================================

    TBQuant
    Params
    ? ? ? ? //此處添加參數
    ? ? ? ? Numeric lots(0);
    ? ? ? ? Numeric Length(80);
    Vars
    ? ? ? ? //此處添加變量
    ? ? ? ? Series<Numeric> UpperBand;
    ? ? ? ? Series<Numeric> LowerBand;
    ? ? ? ? Series<Numeric> AveMa;
    ? ? ? ? Numeric StdValue;
    ? ? ? ? bool buycon;
    ? ? ? ? bool sellcon;
    Defs
    ? ? ? ? //此處添加公式函數
    Events
    ? ? ? ? //此處實現事件函數
    ? ? ? ? //初始化事件函數,策略運行期間,首先運行且只有一次
    ? ? ? ? OnInit()
    ? ? ? ? {? ? ? ?
    ? ? ? ? }
    ? ? ? ? //Bar更新事件函數,參數indexs表示變化的數據源圖層ID數組
    ? ? ? ? OnBar(ArrayRef<Integer> indexs)
    ? ? ? ? {
    ? ? ? ? //布林指標計算
    ? ? ? ? ? ? ? ? AveMa=Average(close[1],Length);
    ? ? ? ? ? ? ? ? StdValue=StandardDev(close[1],Length);
    ? ? ? ? ? ? ? ? UpperBand=AveMa+2*StdValue;
    ? ? ? ? ? ? ? ? LowerBand=AveMa-2*StdValue;
    ? ? ? ? ? ? ? ? PlotNumeric("UpperBand",UpperBand);
    ? ? ? ? ? ? ? ? PlotNumeric("LowerBand",LowerBand);
    ? ? ? ? ? ? ? ? PlotNumeric("AveMa",AveMa);
    ? ? ? ? //開倉條件計算
    ? ? ? ? ? ? ? ? buycon=CrossOver(close[1],UpperBand[1]);
    ? ? ? ? ? ? ? ? sellcon=CrossUnder(close[1],LowerBand[1]);
    ? ? ? ? //突破中軌平倉
    ? ? ? ? ? ? ? ? If(MarketPosition==1 && close[1]<AveMa[1])sell(0,Open);
    ? ? ? ? ? ? ? ? If(MarketPosition==-1 && close[1]>AveMa[1])BuyToCover(0,Open);
    ? ? ? ? //突破上下軌道開倉
    ? ? ? ? ? ? ? ? If(MarketPosition!=1 && buycon)buy(lots,Open);
    ? ? ? ? ? ? ? ? If(MarketPosition!=-1 && sellcon)SellShort(lots,Open);? ? ? ? ? ? ? ?
    ? ? ? ? }
    ===========================================================
    在Tradestation下
    Input: Length(35), StdDevUp(2.0), StdDevDn(-2.0);
    Vars: UpBand(0), DnBand(0), Ave(0);
    UpBand=BollingerBand(Close, Length, StdDevUp);
    DnBand=BollingerBand(Close, Length, StdDevDn);
    Ave=Average(Close, Length);
    {--------Enter Long--------}
    if (MarketPosition=0) and (Close > UpBand) then
    Buy("BE") tomorrow at market;
    {--------Enter Short--------}
    if (MarketPosition=0) and (Close < DnBand) then
    Sell("SE") tomorrow at market;
    {--------Exit Long--------}
    if (MarketPosition=1) and (Close < Ave) then
    ExitLong("LX") today at Close;
    {--------Exit Short--------}
    if (MarketPosition=-1) and (Close > Ave) then
    ExitShort("SX") today at Close;
    ==========================================================
    MC(MultiCharts)平臺上的源碼:
    inputs: Len(35),Dev(2),type(0);
    variables: ma(0),std(0),up(0),down(0);
    ma = AverageFC(Close,Len);
    std = StandardDev(Close, Len,1); //StandardDev( Close, Period, 1 ) ;
    up = ma + Dev * std;
    down = ma - Dev * std;
    if(type=0) then
    begin
    ? ? if(marketposition=0 and close>up) then
    ? ? begin
    ? ?? ???buy("b") next bar at market;
    ? ? end;
    ? ? if(marketposition=0 and close<down) then
    ? ? begin
    ? ?? ???sellshort("s") next bar at market;
    ? ? end;
    ? ? if(marketposition>0 and close<ma) then sell("sp") next bar at market;
    ? ? if(marketposition<0 and close>ma) then buytocover("bp") next bar at market;
    end
    else
    begin
    ? ? if(marketposition=0) then
    ? ? begin
    ? ?? ???buy("b2") next bar at up stop;
    ? ?? ???sellshort("s2") next bar at down stop;
    ? ? end;? ?
    ? ? if(marketposition>0) then sell("sp2") next bar at ma stop;
    ? ? if(marketposition<0) then buytocover("bp2") next bar at ma stop;
    end;
    =========================================================

 

有思路,想編寫各種指標公式,交易模型,選股公式,還原公式的朋友

可聯系技術人員 QQ: 262069696  點擊在線交流或微信號:cxh99cxh99  進行 有償收費 編寫!

怎么收費,代編流程等詳情請點擊閱讀!

(注:由于人數限制,QQ或微信請選擇方便的一個聯系我們就行,加好友時請簡單備注下您的需求,否則無法通過。謝謝您!)


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

相關文章

    沒有相關內容
主站蜘蛛池模板: 精品香蕉在线观看免费| 中文字幕人妻高清乱码| 男人j桶进女人p无遮挡动态图二三| 国产欧美日产激情视频| www.henhencao.com| 日本成人在线网站| 亚洲日韩区在线电影| 精品国产免费观看| 国产又黄又爽视频| 4hu44四虎在线观看| 好男人官网资源在线观看| 久久国产精品99国产精| 欧美成人在线网站| 免费无码黄网站在线看| 黄a大片av永久免费| 国产精品视频yy9099| 一区二区三区四区在线视频| 日本特黄特色aa大片免费| 亚洲国产中文在线二区三区免| 白嫩奶水的乳奴| 国产一区二区三区乱码网站| 日本网址在线观看| 国内精品久久人妻互换| 一级黄色日b片| 日本精品一区二区三区在线视频一| 亚洲国产成人精品激情| 狂野小农民在线播放观看| 四库影院永久在线精品| 麻豆高清免费国产一区| 国产精品亚洲四区在线观看| 99热99操99射| 小雪校花的好大的奶好爽| 久久久xxxx| 日韩欧美亚洲另类| 亚洲国产成人va在线观看| 波多野结衣巨女教师6| 全彩无翼口工漫画大全3d| 荡女安然的yin乱生活| 国产无av码在线观看| 18禁成人网站免费观看| 在线观看的黄网|