pine-script - Pine Script:脚本 SMA 与主图表上的等价物不匹配
问题描述
我编写了一个简单的 Pine Script 图表,它只是模仿了我已经在 TradingView 中使用的图表。
但是,当我叠加我的时,我注意到 Pine Script SMA 的行为与现有图表上的相同 SMA 不同。
它们的创建方式相同:
松脚本:
sma250 = sma(close,250)
plot(sma250, color=color.red)
TVK线走势图:sma250采用收盘来源,时间范围与图表相同。
但是当我叠加它的时候,我的SMA在一个完全不同的地方,角度也和现有的SMA不同。它们似乎都更具反应性。我错过了什么吗?
谢谢。
解决方案
晚上好,先生,
下面是内置平滑移动平均线脚本和您的代码行。正如你所看到的,它们是不同的,所以输出也会不同。在右侧添加内置脚本时,会出现一个 (?),它将进一步解释该脚本。
//@version=4
study(title="Smoothed Moving Average", shorttitle="SMMA", overlay=true, resolution="")
////Trading View In-Built code
len = input(250, minval=1, title="Length")
src = input(close, title="Source")
smma = 0.0
smma := na(smma[1]) ? sma(src, len) : (smma[1] * (len - 1) + src) / len
plot(smma, color=color.red)
//Link from Trading View Code -> The (?) to the right when you add the script to your chart
//https://uk.tradingview.com/chart/?solution=43000591343
///Your Code
sma250 = sma(close,250)
plot(sma250, color=color.blue)
推荐阅读
- mysql - MySQL select 语句没有按名称查找列,我错过了什么?
- python-3.x - 在一行上进行多个字符替换(在字符串中)
- c# - 在运行单元测试时将作为参数传递给注入接口时验证对 Func 的调用
- mysql - MySQL查询返回多行
- ios - Xcode 10.2.1 界面生成器 - 无法在视图控制器(或文档大纲)上移动(拖动)UI 元素
- android - 未来
- > 迭代图像列表时返回 null
- javascript - 从 Node API 到 PHP 服务器的 Axios 调用导致套接字挂断
- r - 将变量名作为参数传递给 data.table
- css - react-native 中的样式化组件大小和性能
- yaml - 创建时间戳 YAML 日志文件