为什么“style="上的真/假逻辑?不工作? [英] Why is true / false logic on "style=" not working?

查看:55
本文介绍了为什么“style="上的真/假逻辑?不工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是有效的代码:

plotshape(xvalue, location=location.absolute, style=shape.labeldown, color=red, size=size.tiny, text ="Upper")

这是不起作用的代码:

plotshape(xvalue, location=location.absolute, style=(label?shape.xcross:shape.labeldown), color=red, size=size.tiny, text ="Upper")

这里的变量标签"是真/假变量.它编译没有错误,但它只是不绘图.

Variable "label" here is true/false variable. It compiles without errors, but it just doesn't plot.

但是你在颜色上使用相同的逻辑,例如:

But it you use same logic on color, for example:

color=(label?blue:red)

它可以正常工作.

我是否在任何地方打字或逻辑错误,或者这是另一个松树虫?

Did I made mistake in typing or logic anywhere or this is another one of pine bugs?

推荐答案

在即将发布的 Pine Script v4 版本中可以实现.我在 Tradingview 担任 QA 工程师,此逻辑的支持现在处于测试阶段.我们计划在 2 月份发布 v4 的 Beta 版,之后用户将能够使用三元运算符作为样式参数.

It would be possible in the upcoming release of Pine Script v4. I work at Tradingview as QA engineer, and the support of this logic is now in the testing phase. We are planning to have a Beta release of v4 in the February, and after that users would be able to use ternary operators for the style arguments.

只是想提供更新.

更新!
TV 已发布 Pine v4,现在您可以这样做:

UPD!
TV has released Pine v4, and now you an do this:

//@version=4 
study("STUDY", overlay = true) 
a = input(false) 
plotshape(close, location = location.abovebar, style = a ? shape.xcross : shape.circle, color = color.red, size = size.tiny, text = "Wow!")

这篇关于为什么“style="上的真/假逻辑?不工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆