RicardoSantos

Function Geometric Mean Oscillator

Using a formula that is generally used for calculating investment over time to check gains on a commodity.

Geometric mean as described here: www.investopedia.com...06/geometricmean.asp
開源腳本

本著真正的TradingView精神,該腳本的作者將其開源發布,以便交易者可以理解和驗證它。為作者喝彩吧!您可以免費使用它,但在出版物中重複使用此代碼受網站規則的約束。 您可以收藏它以在圖表上使用。

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。

想在圖表上使用此腳本?
//@version=2
study(title='Function Geometric Mean Oscillator', overlay=false)
//  ||-----------------------------------------------------------------------------------------||
//  ||---   As described here:
//  ||      http://www.investopedia.com/ask/answers/06/geometricmean.asp
//  ||-----------------------------------------------------------------------------------------||

src = input(close)
length = input(10)

f_gmo(_src, _length)=>
    _length_adjusted = _length < 1 ? 0 : _length
    _perc_change = change(_src) / _src
    _sum = 1
    for _i = 0 to (_length_adjusted)
        _sum := _sum * (1 + _perc_change[_i])
    _return = pow(_sum, (1 / _length_adjusted)) - 1

//plot(ema(src, length), color=color(gray, 0), linewidth=5)
plot(f_gmo(src, length), color=color(blue, 0), linewidth=1)
hline(0)