基于所选柱形绘制动态水平线。

huangapple go评论91阅读模式
英文:

Draw dynamic horizontal line based on selected bar

问题

我想根据光标选择的柱形绘制一个基于动态水平线 (Close + ATR(10))

目前,我使用plot(),但看起来很混乱。

我正在使用pinescript v5。

英文:

I want to draw a dynamic horizontal line (Close + ATR(10)) based on the bar selected by the cursor.

Currently, I use plot() but it looks messy.

I am using pinescript v5

答案1

得分: 1

你有一个在某种程度上是妥协的选项。

bar_time = input.time(1673257327000, "Bar time")
if time == bar_time
    // 用于确定 "y" 的动态逻辑
    line.new(bar_index, y, bar_index, y, extend = extend.both)

input.time() 函数会在图表界面上创建一个可拖动的垂直线,该线位于由时间输入定义的柱状图上,您可以将其移动到所需的柱状图上,然后根据您的逻辑来设置水平线。这个垂直线只是TradingView提供的一个辅助工具,用于快速控制input.time()

英文:

You have an option that is to some extent a compromise.<br>

bar_time = input.time(1673257327000, &quot;Bar time&quot;)
if time == bar_time
    // your dynamic logic determining &quot;y&quot;
    line.new(bar_index, y, bar_index, y, extend = extend.both)

The input.time() gives you a draggable vertical line in the chart GUI over the bar defined by the time input that you can move to your desired bar that sets your horizontal line based on your logic. This vertical line is only a helper utility from tradingview to be able to control input.time() rapidly.

答案2

得分: 0

在Pinescript v5中,您无法从GUI获取信息。

英文:

In pinescript v5 you can't get information from the GUI.

huangapple
  • 本文由 发表于 2023年1月9日 10:15:35
  • 转载请务必保留本文链接:https://go.coder-hub.com/75052629.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定