Reputation: 113
i want to code indicator in my tradingview pine editor, for that, I need the current price of a stock or any other scrip to my coding keyword to do operations and generate new output on chart,
Upvotes: 1
Views: 7712
Reputation: 83
This seems to work.
currentPrice = security(syminfo.tickerid, "", ema(close, 1), barmerge.gaps_on, barmerge.lookahead_off)
You could probably use something other than ema(). If you're writing a strategy, make sure your call to strategy includes calc_on_every_tick=true
.
strategy("DCA Bot", overlay=true, calc_on_every_tick=true)
Upvotes: 2
Reputation: 113
Try this
src = input(close, title="Source")
price = security(syminfo.tickerid, timeframe.period, src)
plot(price)
Here ticker id I used to display the current price on the chart
reference intradaygeeks contact if need more help twitter
Upvotes: 2