Pine Script 如何在输入中添加复选框而不是下拉列表?

发布于 2025-01-17 13:50:15 字数 643 浏览 2 评论 0原文

新的到Pine脚本,想知道如何将输入从下拉列表更改为hide/Show的复选框?谢谢。

highlow = input("", type=input.resolution, title="High")

dailyopenhigh = security(syminfo.tickerid, highlow, high)

line1 = line.new(x1=bar_index-1, y1=dailyopenhigh, x2=bar_index, y2=dailyopenhigh, xloc=xloc.bar_index, style=line.style_solid,extend=extend.right, color=color.blue)
line.set_width(line1, 2)
line.delete(line1\[1\])  // remove the previous line when new bar appears

我尝试了几种方法,无法弄清楚。

new to pine script and wondering how to change the inputs from dropdown list to checkbox for hide/show? Thank you.

highlow = input("", type=input.resolution, title="High")

dailyopenhigh = security(syminfo.tickerid, highlow, high)

line1 = line.new(x1=bar_index-1, y1=dailyopenhigh, x2=bar_index, y2=dailyopenhigh, xloc=xloc.bar_index, style=line.style_solid,extend=extend.right, color=color.blue)
line.set_width(line1, 2)
line.delete(line1\[1\])  // remove the previous line when new bar appears

I have tried several approaches and couldn't figue it out.

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

无尽的现实 2025-01-24 13:50:15

您需要为复选框使用input.bool

show_highlow = input(defval=false, title="High/Low Lines", type=input.bool)

You need to use input.bool for the checkboxes.

show_highlow = input(defval=false, title="High/Low Lines", type=input.bool)
追风人 2025-01-24 13:50:15

如果将来有人偶然发现这一点:

usehighlow = input.bool(defval=true, title="High/Low Lines", inline="HL")
highlow = input.timeframe(defval="", title="", inline="HL")

dailyopenhigh = security(syminfo.tickerid, highlow, high)

line1 = usehighlow ? line.new(x1=bar_index-1, y1=dailyopenhigh, x2=bar_index, y2=dailyopenhigh, xloc=xloc.bar_index, style=line.style_solid,extend=extend.right, color=color.blue) : an

在此处输入图像描述


如果您不希望让用户能够切换时间范围:

highlow = input.bool(defval=true, title="High/Low Lines", inline="HL")

dailyopenhigh = request.security(syminfo.tickerid, '', high)

line1 = highlow ? line.new(x1=bar_index-1, y1=dailyopenhigh, x2=bar_index, y2=dailyopenhigh, xloc=xloc.bar_index, style=line.style_solid,extend=extend.right, color=color.blue) : na

在此处输入图像描述

In case anyone stumbles across this in the future:

usehighlow = input.bool(defval=true, title="High/Low Lines", inline="HL")
highlow = input.timeframe(defval="", title="", inline="HL")

dailyopenhigh = security(syminfo.tickerid, highlow, high)

line1 = usehighlow ? line.new(x1=bar_index-1, y1=dailyopenhigh, x2=bar_index, y2=dailyopenhigh, xloc=xloc.bar_index, style=line.style_solid,extend=extend.right, color=color.blue) : an

enter image description here


If you're not looking to give the user the ability to switch timeframes:

highlow = input.bool(defval=true, title="High/Low Lines", inline="HL")

dailyopenhigh = request.security(syminfo.tickerid, '', high)

line1 = highlow ? line.new(x1=bar_index-1, y1=dailyopenhigh, x2=bar_index, y2=dailyopenhigh, xloc=xloc.bar_index, style=line.style_solid,extend=extend.right, color=color.blue) : na

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文