JPWeb
JPWeb

Reputation: 195

Making this code pull from specific timeframe tradingview

how would I go about adding MTF to a pinescript on tv?

Upvotes: 0

Views: 109

Answers (1)

vitruvius
vitruvius

Reputation: 21121

You need to use the request.security() function for that.

Below code would display the daily SMA value on your chart no matter what your chart's timeframe is.

//@version=4
study(title="High Time Frame MA", overlay=true)
src = close, len = 9
out = sma(src, len)
out1 = security(syminfo.tickerid, 'D', out)
plot(out1)

Upvotes: 1

Related Questions