如何使用代码 ID 在 Pine Editor Tradingview 中访问当前股票价格数据

How to Access data of current price of stocks in Pine Editor Tradingview using ticker id

我想在我的 tradingview pine 编辑器中编写指标代码,为此,我需要将股票的当前价格或任何其他凭证作为我的代码关键字来执行操作并在图表上生成新的输出,

试试这个

src = input(close, title="Source")

price = security(syminfo.tickerid, timeframe.period, src)

plot(price) 

这里是我用来在图表上显示当前价格的股票代码

参考intradaygeeks contact if need more help twitter

这似乎有效。

currentPrice = security(syminfo.tickerid, "", ema(close, 1), barmerge.gaps_on, barmerge.lookahead_off)

你或许可以使用 ema() 以外的东西。如果您正在编写策略,请确保您对策略的调用包括 calc_on_every_tick=true.

strategy("DCA Bot", overlay=true, calc_on_every_tick=true)