PineScript:如何通过价格线在 y 轴上平移价格线?保持平坦෴ -> _____
如何获取 Pine Script 的最新价格?
该号码。
我需要它作为浮动而不是串联浮动。
这样做:
//@version=5
indicator(title="EURUSD")
inputEURUSD = input.symbol("EURUSD")
EURUSDprice = request.security(inputEURUSD, timeframe.period, close)
lastPriceEURUSD = EURUSDprice[0]
EURUSDtoZero = EURUSDprice - 1.09107 // translate on y-axis manually
EURUSDminusLastPrice = EURUSDprice - lastPriceEURUSD // attempt to translate on y-axis automatically
plot(series=EURUSDprice, color=color.red, title="EURUSD", linewidth=1, style=plot.style_line, trackprice=false)
plot(series=lastPriceEURUSD, color=color.green, title="EURUSD[0]", linewidth=1, style=plot.style_line, trackprice=false)
plot(series=EURUSDtoZero, color=color.blue, title="EURUSD-1.09107", linewidth=1, style=plot.style_line, trackprice=false)
plot(series=EURUSDminusLastPrice, color=color.white, title="EURUSD-EURUSD[0]", linewidth=1, style=plot.style_line, trackprice=false)
priceEURUSD[0]
给你一个系列,那么我怎样才能得到这个数字作为浮点数而不是系列浮点数,并用它来将价格线在 y 轴上向下平移这么多单位?
更新:
基本上,我需要它来表示单个图表中不同程度的运动。 以这些无聊的行为例:
它们毫无意义。但通过在 y 轴上进行一些手动平移,它们开始呈现有意义的形状:
因此,必须在某个地方找到一种自动方法来按最后价格翻译它们。
更重要的是——你能让它们越趋同,它们就会变得越明显和有意义。
答案:
ta.tsi(USDEURprice, 10, 10)
上图显示,上面的线是手动翻译的,下面的线是用 ta.tsi() 完成的。
分辨率可以用“10, 10”(较小的,越好 解决)
How can I get the last price in Pine Script?
That number.
I need it as a float instead of series float.
Doing this:
//@version=5
indicator(title="EURUSD")
inputEURUSD = input.symbol("EURUSD")
EURUSDprice = request.security(inputEURUSD, timeframe.period, close)
lastPriceEURUSD = EURUSDprice[0]
EURUSDtoZero = EURUSDprice - 1.09107 // translate on y-axis manually
EURUSDminusLastPrice = EURUSDprice - lastPriceEURUSD // attempt to translate on y-axis automatically
plot(series=EURUSDprice, color=color.red, title="EURUSD", linewidth=1, style=plot.style_line, trackprice=false)
plot(series=lastPriceEURUSD, color=color.green, title="EURUSD[0]", linewidth=1, style=plot.style_line, trackprice=false)
plot(series=EURUSDtoZero, color=color.blue, title="EURUSD-1.09107", linewidth=1, style=plot.style_line, trackprice=false)
plot(series=EURUSDminusLastPrice, color=color.white, title="EURUSD-EURUSD[0]", linewidth=1, style=plot.style_line, trackprice=false)
Gives you a flat line. As it should:
But if:
priceEURUSD[0]
gives you a series, than, how can I get that number as a float instead of series float, and use it to translate the priceline downwards by that many units on y-axis?
UPDATE:
I need it, basically, to represent varying degrees of movement in a single graph.
Take these boring lines, for example:
They're meaningless. But with a bit of manual translation on the y-axis, they start to take a meaningful shape:
So an automatic way to translate them by their last price, has to be found somewhere.
Even more so - the more converging you can get them, the more pronounced and meaningful they become.
ANSWER:
ta.tsi(USDEURprice, 10, 10)
Above graph shows, the upper lines, been translated manually and the bottom lines, been done with ta.tsi()
The resolution can be controlled with the "10, 10" (the smaller, the better resolution)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
欧元兑美元价格是数字。 [0] 是不需要的并且不添加任何内容。您可以在其他计算中使用 EURUSDprice。最后价格为 [1],如一栏前所示...
EURUSDprice is the number. [0] is not needed and adds nothing. You can use EURUSDprice in other calculations. Last price is [1] as in one bar ago...
我希望我理解你的想法,你可以使用
ta.tsi
真实强度指数。它使用金融工具潜在动量的移动平均线。真实强度指数指标图表
I hope I understood your idea, You can use
ta.tsi
true strength index. It uses moving averages of the underlying momentum of a financial instrument.chart for true strength index indicator