Pine script TradingView船体移动平均线指示器的变化率

Pine script TradingView船体移动平均线指示器的变化率,pine-script,trading,Pine Script,Trading,我是新来的松树编辑。有人能帮我为TradingView编写船体移动平均线指示器的变化率代码吗?这是一个非常有用的指标。Thx您可以将内置船体移动平均线和roc功能组合在一起,如下例所示 // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © e2e4mfck //@version=4 study("Rate of

我是新来的松树编辑。有人能帮我为TradingView编写船体移动平均线指示器的变化率代码吗?这是一个非常有用的指标。Thx

您可以将内置船体移动平均线和
roc
功能组合在一起,如下例所示

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © e2e4mfck

//@version=4
study("Rate of Hull Change", overlay = false)

// Inputs
i_hullLength    = input(9, "Hull Length", minval=1)
i_rocLength     = input(1, "Rate of Change Length", minval=1)
i_src           = input(close, title="Source")

hullma  = wma(2*wma(i_src, i_hullLength/2)-wma(i_src, i_hullLength), round(sqrt(i_hullLength)))
rocHull = roc(hullma, i_rocLength)

plot(rocHull)