在pinescript中将系列整数转换为整数

编程入门 行业动态 更新时间:2024-10-25 06:30:13
本文介绍了在pinescript中将系列整数转换为整数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用pinescript,并且我一直在尝试弄清以下代码为什么不起作用.控制台不断显示series [integer]无法输出整数.我知道系列与非系列值不兼容.如果是这样,是否有办法将series [integer]更改为整数?

I am using pinescript, and I have been trying to figure out why the following code does not work. The console keeps showing that series[integer] cannot output integer. I understand that series is not compatible with non-series values. If this is the case, is there a way to change series[integer] to integer?

以下代码不起作用:

The following code does not work:

x = barssince(crossover(cci,100)) y = barssince(crossover(100,cci)) xy = x-y //in this case the xy value is 9 z = highest(cci, abs(xy)) plot(z)

以下代码有效:

z = highest(cci, 9) //assuming xy is 9 plot(z)

任何帮助将不胜感激.谢谢

Any help would be greatly appreciated. Thank you

托马斯

推荐答案

无法将pinescript中的系列整数转换为整数.因此,有必要寻找解决方法.您可以使用以下脚本.

Converting series integer to integer in pinescript to cannot be done. Therefore, it is necessary to look for workarounds. In your case, you can use the following script.

//@version=4 study("Help (hi/lo between conditions)") cci = cci(close, 14) plot(cci, title="cci") hline(100) hline(-100) up_top_boder = crossover(cci,100) dn_top_boder = crossunder(cci,100) up_bottom_boder = crossover(cci,-100) dn_bottom_boder = crossunder(cci,-100) hi = float(na) lo = float(na) var look_hi = false var look_lo = false if up_top_boder or look_hi if dn_top_boder look_hi := false else look_hi := true hi := max(cci, nz(hi[1])) if dn_bottom_boder or look_lo if up_bottom_boder look_lo := false else look_lo := true lo := min(cci, nz(lo[1])) plot(hi, title="hi", style=plot.style_circles, linewidth=2, color=color.green) plot(lo, title="lo", style=plot.style_circles, linewidth=2, color=color.red)

更多推荐

在pinescript中将系列整数转换为整数

本文发布于:2023-10-24 16:50:53,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1524484.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:整数   转换为   中将   系列   pinescript

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!