本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。
//@version=4
////////////////////////////////////////////////////////////
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © HPotter 05/01/2021
// The signal-to-noise (S/N) ratio.
// Thank you for idea @BlockchainYahoo
////////////////////////////////////////////////////////////
SignalToNoise(length) =>
StN = 0.0
for i = 1 to length-1
StN := StN + (1/close[i])/length
StN := -10*log(StN)
study(title="Signal To Noise", shorttitle="StoN", overlay=false)
length = input(title="Days", type=input.integer, defval=7, minval=2)
StN = SignalToNoise(length)
plot(StN)