首页 > 解决方案 > TradingView 的船体移动平均线指标的变化率

问题描述

我是 Pine Editor 的新手。谁能帮我为 TradingView 的船体移动平均线指标的变化率编写代码?它是一个非常有用的指标。谢谢

标签: pine-scripttrading

解决方案


您可以将内置船体移动平均线和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)

推荐阅读