- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想了解 := 和 sum[1] 如何工作。这个总和返回 6093。但是总和是 0,也是 sum[1] = 0 ,对吗?它如何返回我 6093?我搜索了tradingview wiki,但我不明白。我想将此代码更改为另一种语言,例如 javascript、c#
testfu(x,y)=>
sum = 0.0
sum:= 1+ nz(sum[1])
sum
最佳答案
[]
在 pine-script 中被称为 History Referencing Operator 。这样,就可以引用任何系列类型变量的历史值(该变量在前一根柱线上的值)。例如,close[1]
返回昨天的收盘价 - 这也是一个系列。
所以,如果我们分解您的代码(从第一个小节开始):
testfu(x,y)=>
sum = 0.0 // You set sum to 0.0
sum:= 1+ nz(sum[1]) // You add 1 to whatever value sum had one bar ago
// which is 0, because it's the first bar (no previous value)
sum // Your function returns 1 + 0 = 1 for the very first bar
现在,第二个小节:
testfu(x,y)=>
sum = 0.0 // You set sum to 0.0
sum:= 1+ nz(sum[1]) // You add 1 to whatever value sum had one bar ago
// which is 1, because it was set to 1 for the first bar
sum // Your function now returns 1 + 1 = 2 for the second bar
等等。
看看下面的代码和图表。该图表有 62 个柱,和 sum
开始于 1
一直到 62
.
//@version=3
study("My Script", overlay=false)
foo() =>
sum = 0.0
sum:= 1 + nz(sum[1])
sum
plot(series=foo(), title="sum", color=red, linewidth=4)
关于pine-script - Tradingview Pinescript 使用 := operator,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52903577/
尝试在 Tradingview 中创建自定义研究,但在加载 tradeview 小部件时出现以下错误: Error: unexpected study id:abcd at Function.
在尝试实现 TradingView 的保存和加载低级 API 时,我无法让库在加载从后端返回的对象时刷新屏幕。 load() 只会导致屏幕闪烁,没有错误。图表不会更新。 如何在 Angular 前端的
在尝试实现 TradingView 的保存和加载低级 API 时,我无法让库在加载从后端返回的对象时刷新屏幕。 load() 只会导致屏幕闪烁,没有错误。图表不会更新。 如何在 Angular 前端的
export default class extends Component { render() { return (
我刚刚将比特币的实时数据添加到我的图表中。有一个高峰,甚至交易 View 都无法处理它......至少,在我的图表上。这是它的样子: 正如你在 6 月 2 日看到的那样,比特币涨得如此之高,以至于它走
使用 tradingview 图表小部件,我想在 js 中进行设置/选项更改并将其应用于图表,而无需完全重新加载 (chart.reload())在 tradingview 上小部件页面有一个应用按钮
有人能告诉我为什么我的 TradingView 图表不显示吗?我得到一个没有图表显示的空白页面。 我按照此处的所有安装说明进行操作: https://github.com/tradingview/li
我正在尝试覆盖 Advanced Real-Time Chart TradingView Widget 上的默认配置. 我添加了一个简单的移动平均线,我设法在其上设置了周期(从默认的 9 到 200)
我是 Tradingview 图表库的新手,我想创建类似响应式图表。 问题是,交易 View 图表库需要指定宽度和高度。这是代码。 const chart = LightweightCharts.cr
图表符号在另一个组件中被选择,状态更新作为 Prop 传回此 TradingView 组件。 我正在尝试使用以下方法更改图表中的符号: this.tvWidget.chart().setSymbol(
如何在 Pine 脚本中设置 strategy.commission.percent? 我知道如何在手动设置中将佣金设置为百分比。但是有没有办法用代码设置佣金? 这是我的策略脚本: strategy(
我正在尝试创建一个新的 Web 项目并想使用 Technical Analysis Charts图书馆,但是当我想下载它时,它要求提供一个我没有的公共(public)网站域!这是一个教育项目,我没有公
我需要绘制多条水平线来标记不同的价格水平。现在我只想出了这个松树脚本: //@version=4 study(title = "H1",overlay=true) plot(close) lev1=0
我正在尝试从 tradinview 添加“高级实时图表”小部件。我可以添加指数移动平均线和简单移动平均线指标。但默认需要 9 天的长度。我想改变这一点。 我尝试了以下方法,但没有成功。有人可以帮忙吗?
$("#loadtv").on("click",function(myfunc23){ var chart4 = new TradingView.widget({ cont
关闭。这个问题需要更多focused .它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭 4 年前。 Improve this qu
这是基于 EMA 交叉的简单策略。当尝试在某个水平退出 % 并让剩余头寸由追踪止损填补时,问题就来了。 让我们设定 3% 的目标。当价格触及目标时,该策略应关闭订单的 50%,并让移动止损继续,直到触
我想实现一个移动平均线,其中长度基于 n-back 平均周期长度 K。因此,我需要长度是变量 K 的函数。 内置的移动平均线只允许长度为静态整数值。 我有一个名为 cycle_difference 的
我需要创建一个类似于 https://www.tradingview.com/wiki/Compare 中显示和解释的图表。 . 在 https://www.tradingview.com/widge
//@version=4 study(shorttitle="try", title="line", overlay=true, resolution="") line.new(x1=bar_inde
我是一名优秀的程序员,十分优秀!