查找绘图线的第一个值
我有这样的情节:
//@version=4
study(title="Line", shorttitle="Line", overlay=true)
theline(src, len) => wma(2 * wma(src, len / 2) - wma(src, len), round(sqrt(len)))
Line = theline(close, 9)
plot(Line, title='Line', color=#0066ff, linewidth=3)
该线将根据收盘价向上或向下移动。
当新柱出现时,当第一个收盘==开盘时,如何找到该行的第一个值。
我需要比较该值,以查看当前行是否高于或低于第一个值。
谢谢你帮助我。
I have the plot:
//@version=4
study(title="Line", shorttitle="Line", overlay=true)
theline(src, len) => wma(2 * wma(src, len / 2) - wma(src, len), round(sqrt(len)))
Line = theline(close, 9)
plot(Line, title='Line', color=#0066ff, linewidth=3)
That line will move up or down depending on the close value.
How do I find the first value of that line, when the new bar appears, when the first close==open.
I need that value to compare, to see if the current line is above or under that first value.
Thank you for helping me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
答案与上一个问题的原理相同,您必须重构 wma 方程,才能正常获得前 n-1 个值的总和,并替换使用开盘而不是收盘计算的第 n 个值(当前柱的值)。
The answer is the same principle as your last question, you have to refactor the wma equation in order to obtain the sum of the first n-1 values as normal and replace the nth value (current bar's value) calculated using open instead of close.
您可以使用
varip
冻结并保存实时值并有条件地更新它们。我为您编写了一个自定义函数,它将冻结 wma 线的实时打开值。请注意,这仅适用于实时或警报。如果您正在实时观看开盘,它只会冻结开盘,并且警报将在添加到图表后的第一个开盘上开始工作。干杯,祝你好运
You can use
varip
to freeze and hold real time values and update them conditionally. I wrote a custom function for you that will freeze the real time open value of the wma line. Please note this will only work in real time or for alerts. It will only freeze the open if you are watching the open live, and alerts will begin working on the first open after adding to the chart.cheers and best of luck