英文:
How to make the variable price - 500, formed not as a curve, but as a horizontal line with coordinates (price - 500)
问题
I can help you with the translation of the code and the associated text. Here's the translated content:
在使用变量进行计算时,我不知道如何获得水平线。请查看附加的图片。此外,需要的是变量,而不是通过绘图函数输出的数据。
//@version=5
indicator(title="交叉", shorttitle="INTR", overlay=true, max_bars_back=100)
a = 44626
plot(a, '1', color=color.white)
//我该如何在计算过程中获得水平线,而不是曲线a1,而是a。
a1 = close - 1000
plot(a1, '1', color=color.red)
请注意,我已将HTML编码("
和 '
)替换为普通引号以使代码更易读。如果需要进一步帮助,请告诉我。
英文:
I don't know how to get the horizontal line when using the calculations for the variable. Please see the attached picture.Moreover, it is the variable that is needed, and not the output of data through the plot function.
//@version=5
indicator(title="intersection", shorttitle="INTR",overlay = true, max_bars_back = 100)
a = 44626
plot(a, '1', color = color.white)
//How can I make it so that during calculations I get not a curve but a horizontal line? those. when calculating the output, not the curve a1, but a.
a1 = close - 1000
plot(a1, '1', color = color.red)
答案1
得分: 0
两种方法来实现这个。使用 hline
或 line.new
//@version=5
indicator(title="交叉", shorttitle="交叉", overlay=true, max_bars_back=100)
a = 44626
plot(a, '1', color=color.blue)
//如何使得在计算过程中得到的不是曲线而是水平线?也就是说,在输出计算时不是曲线 a1,而是 a。
a1 = close - 1000
plot(a1, '1', color=color.red)
// hline 方法
hline(a, 'A HLine', color=color.blue)
//line.new 方法
if barstate.islast
line.new(bar_index, a1, bar_index + 1, a1, extend=extend.both)
英文:
Two ways to do that. Using an hline
or a line.new
//@version=5
indicator(title="intersection", shorttitle="INTR",overlay = true, max_bars_back = 100)
a = 44626
plot(a, '1', color = color.blue)
//How can I make it so that during calculations I get not a curve but a horizontal line? those. when calculating the output, not the curve a1, but a.
a1 = close - 1000
plot(a1, '1', color = color.red)
// hline way
hline(a,'A HLine', color.blue)
//line.new way
if barstate.islast
line.new(bar_index, a1, bar_index + 1, a1, extend = extend.both)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论