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

RSI的第一個值是怎么來的 [開拓者 TB]

  • 咨詢內(nèi)容: 剛開始學(xué)TB,請教一下RSI的計算。
    If(CurrentBar <= Length - 1)的時候Close[Length] 的值都是空的,那么NetChgAvg = ( Close - Close[Length] ) / Length 應(yīng)該也是空值,那么第一個NetChgAvg的值是怎么計算來的,謝謝。
    1. //------------------------------------------------------------------------
    2. // 簡稱: RSI
    3. // 名稱: 相對強弱指數(shù)
    4. // 類別: 公式應(yīng)用
    5. // 類型: 內(nèi)建應(yīng)用
    6. //------------------------------------------------------------------------

    7. Params
    8.         Numeric Length(14) ;
    9.         Numeric OverSold(30) ;
    10.         Numeric OverBought(70) ;
    11. Vars
    12.         NumericSeries NetChgAvg( 0 );
    13.         NumericSeries TotChgAvg( 0 );
    14.         Numeric SF( 0 );
    15.         Numeric Change( 0 );       
    16.         Numeric ChgRatio( 0 ) ;
    17.         Numeric RSIValue;
    18. Begin       
    19.         If(CurrentBar <= Length - 1)
    20.         {
    21.                 NetChgAvg = ( Close - Close[Length] ) / Length ;
    22.                 TotChgAvg = Average( Abs( Close - Close[1] ), Length ) ;
    23.         }Else
    24.         {
    25.                 SF = 1/Length;
    26.                 Change = Close - Close[1] ;
    27.                 NetChgAvg = NetChgAvg[1] + SF * ( Change - NetChgAvg[1] ) ;
    28.                 TotChgAvg = TotChgAvg[1] + SF * ( Abs( Change ) - TotChgAvg[1] ) ;       
    29.         }
    30.        
    31.         If( TotChgAvg <> 0 )
    32.         {
    33.                 ChgRatio = NetChgAvg / TotChgAvg;
    34.         }else
    35.         {
    36.                 ChgRatio = 0 ;
    37.         }       
    38.         RSIValue = 50 * ( ChgRatio + 1 );       
    39.         PlotNumeric("RSI",RSIValue);
    40.         PlotNumeric("超買",OverBought);
    41.         PlotNumeric("超賣",OverSold);
    42. End

    43. //------------------------------------------------------------------------
    44. // 編譯版本        GS2010.12.08
    45. // 版權(quán)所有        TradeBlazer Software 2003-2010
    46. // 更改聲明        TradeBlazer Software保留對TradeBlazer平
    47. //                        臺每一版本的TradeBlazer公式修改和重寫的權(quán)利
    48. //------------------------------------------------------------------------

     

  • TB技術(shù)人員: 自己搞明白了,原來Bar數(shù)據(jù)、序列變量在回溯越界時用該數(shù)據(jù)源的第1個值代替,而不是返回空值。

     

  • TB客服:
    if(hitoday>=ssetup and marketposition>-1 and GetGlobalVar(1)<1)
            {
                    If(Low<=(senter+(hitoday-ssetup)/div))
                    {
                            SellShort(1,senter+(hitoday-ssetup)/div);
                            SetGlobalVar(1,Time);
                            Return;
                    }
            }
            if(ltoday<=bsetup and marketposition<1  and GetGlobalVar(1)<1)
            {
                    If(High>=(benter-(bsetup-ltoday)/div))
                    {
                            Buy(1,benter-(bsetup-ltoday)/div);
                            SetGlobalVar(1,Time);
                           Return;
                    }
            }
    這一段可能會出現(xiàn)同一根BAR既滿足high值高于ssetup,又滿足Low<=(senter+(hitoday[1]-ssetup)/div)的情況,但實際無法判斷先后。

    改成
            if(hitoday[1]>=ssetup and marketposition>-1 and GetGlobalVar(1)<1 &&date==date[1])
            {
                  If(Low<=(senter+(hitoday[1]-ssetup)/div))
                    {
                            SellShort(1,senter+(hitoday[1]-ssetup)/div);
                            SetGlobalVar(1,Time);
                            Return;
                    }
            }
            if(ltoday[1]<=bsetup and marketposition<1  and GetGlobalVar(1)<1 &&date==date[1])
            {
                    If(High>=(benter-(bsetup-ltoday[1])/div))
                    {
                            Buy(1,benter-(bsetup-ltoday[1])/div);
                            SetGlobalVar(1,Time);
                    Return;
                    }
            }
    這樣子會不會好一點?還有后面的if(marketposition==0)那一段貌似也得加上跳空判斷~    本人在實盤觀察過的確有實盤閃爍過。還要自己仔細(xì)看一看啦!

     

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

    if(hitoday>=ssetup and marketposition>-1 and GetGlobalVar(1)<1)
            {
                    If(Low<=(senter+(hitoday-ssetup)/div))
                    {
                            SellShort(1,senter+(hitoday-ssetup)/div);
                            SetGlobalVar(1,Time);
                            Return;
                    }
            }
            if(ltoday<=bsetup and marketposition<1  and GetGlobalVar(1)<1)
            {
                    If(High>=(benter-(bsetup-ltoday)/div))
                    {
                            Buy(1,benter-(bsetup-ltoday)/div);
                            SetGlobalVar(1,Time);
                           Return;
                    }
            }
    這一段可能會出現(xiàn)同一根BAR既滿足high值高于ssetup,又滿足Low<=(senter+(hitoday[1]-ssetup)/div)的情況,但實際無法判斷先后。

    改成
            if(hitoday[1]>=ssetup and marketposition>-1 and GetGlobalVar(1)<1 &&date==date[1])
            {
                  If(Low<=(senter+(hitoday[1]-ssetup)/div))
                    {
                            SellShort(1,senter+(hitoday[1]-ssetup)/div);
                            SetGlobalVar(1,Time);
                            Return;
                    }
            }
            if(ltoday[1]<=bsetup and marketposition<1  and GetGlobalVar(1)<1 &&date==date[1])
            {
                    If(High>=(benter-(bsetup-ltoday[1])/div))
                    {
                            Buy(1,benter-(bsetup-ltoday[1])/div);
                            SetGlobalVar(1,Time);
                    Return;
                    }
            }
    這樣子會不會好一點?還有后面的if(marketposition==0)那一段貌似也得加上跳空判斷~    本人在實盤觀察過的確有實盤閃爍過。還要自己仔細(xì)看一看啦!

 

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

可聯(lián)系技術(shù)人員 QQ: 1145508240  有需要幫忙請點擊這里留言!??!進(jìn)行 有償 編寫!不貴!點擊查看價格!


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

相關(guān)文章

    沒有相關(guān)內(nèi)容
主站蜘蛛池模板: 亚洲欧美日韩中文字幕在线| 国产成人亚洲综合无码精品| 久久久久久亚洲精品成人| 波多野结衣制服诱惑| 国产丝袜无码一区二区三区视频| 5555在线播放免费播放| 怡红院一区二区三区| 久久精品成人一区二区三区| 污污的网站免费观看| 啊轻点灬大ji巴太粗太长h| 欧美h片在线观看| 在线亚洲精品视频| 丝瓜草莓www在线观看| 日韩欧美在线视频| 亚洲成av人片在线观看| 番茄视频在线观看免费完整| 国产一区二区三区在线观看免费| 亚洲一区二区三区在线网站| 处破女18分钟完整版| 中文字幕www| 日韩在线一区高清在线| 亚洲国产精品网| 特级毛片www| 午夜精品久久久久久| 青娱乐欧美视频| 国产精品久久久久一区二区| 99热这里只有精品免费播放| 性色欲网站人妻丰满中文久久不卡 | 向日葵app下载视频免费| 麻豆视频免费播放| 国产视频xxx| www..com色| 成人精品视频一区二区三区| 久久精品中文字幕第一页| 欧美大尺度电影| 亚洲精品成人网站在线播放| 精品亚洲一区二区| 四虎永久免费网站免费观看| 香蕉97碰碰视频免费| 国产日韩欧美中文字幕| 57pao一国产成永久免费|