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

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

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

  • 咨詢內容: 剛開始學TB,請教一下RSI的計算。
    If(CurrentBar <= Length - 1)的時候Close[Length] 的值都是空的,那么NetChgAvg = ( Close - Close[Length] ) / Length 應該也是空值,那么第一個NetChgAvg的值是怎么計算來的,謝謝。
    1. //------------------------------------------------------------------------
    2. // 簡稱: RSI
    3. // 名稱: 相對強弱指數
    4. // 類別: 公式應用
    5. // 類型: 內建應用
    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. // 版權所有        TradeBlazer Software 2003-2010
    46. // 更改聲明        TradeBlazer Software保留對TradeBlazer平
    47. //                        臺每一版本的TradeBlazer公式修改和重寫的權利
    48. //------------------------------------------------------------------------

     

  • TB技術人員: 自己搞明白了,原來Bar數據、序列變量在回溯越界時用該數據源的第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;
                    }
            }
    這一段可能會出現同一根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)那一段貌似也得加上跳空判斷~    本人在實盤觀察過的確有實盤閃爍過。還要自己仔細看一看啦!

     

  • 網友回復:

    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;
                    }
            }
    這一段可能會出現同一根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)那一段貌似也得加上跳空判斷~    本人在實盤觀察過的確有實盤閃爍過。還要自己仔細看一看啦!

 

有思路,想編寫各種指標公式,程序化交易模型,選股公式,預警公式的朋友

可聯系技術人員 QQ: 1145508240  有需要幫忙請點擊這里留言!!!進行 有償 編寫!不貴!點擊查看價格!


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

相關文章

    沒有相關內容
主站蜘蛛池模板: 亚洲精品久久麻豆蜜桃 | 精品久久久久久久久久中文字幕 | 日本爱爱免费视频 | 日本大片久久久高清免费看 | 和日本免费不卡在线v | 黄色网址在线免费 | 色婷婷综合久久久久中文一区二区 | 日韩中文字幕在线免费观看 | 亚洲成人免费视频 | 国产亚洲欧美在在线人成 | 精品乱码一区二区三区在线 | 欧美wwwxxx| 伊人久久狼人 | 国产精品社区 | 奇米日日| 成年人色视频 | 日韩欧美亚洲国产精品字幕久久久 | 亚洲va欧美va国产va天堂影 | 成人在线精品 | 伊人天天操 | 午夜体验区 | 天天操天天干天天操 | 一区二区在线精品免费视频 | 天天操天天干天天爱 | 免费高h影片在线观看 | 黄色大全网站 | 奇米伊人| 91高清免费国产自产拍2021 | 久久午夜国产片 | 国产精品青草久久福利不卡 | 国产成人亚洲欧美三区综合 | 成人亚洲 | 免费国产小视频在线观看 | 亚洲日本视频在线 | 日本欧美一区二区三区不卡视频 | 久草在线色站 | 亚洲欧美成人综合久久久 | 久久久一区二区三区不卡 | 蘑菇视频绿巨人小黄鸭 | 久九色| 婷婷综合色伊人阁 |