Time Series Forecast

Can you please add Time Series Forecast Indicator as seen on TradingView? Here is the pinescript:

//@version=4

study("Time Series Forecast",overlay=true)

length = input(500),mult = input(1.),short = input(false,"Short Term Extrapolation"),src = input(open)

//----

n = bar_index

ts = linreg(src,length,0)

p = short ? 1 : length

//----

e = cum(abs(src-ts))/n*mult

a = ts + e

b = ts - e

//----

line Up = line.new(n[p],a[p],n,a,extend=extend.right,color=color.blue,width=2)

line Md = line.new(n[p],ts[p],n,ts,extend=extend.right,color=#e65100,width=2)

line Dn = line.new(n[p],b[p],n,b,extend=extend.right,color=color.blue,width=2)

//----

line.delete(Up[1])

line.delete(Md[1])

line.delete(Dn[1])

plot(ts,color=short?color.blue:na,transp=0)

Please authenticate to join the conversation.

Upvoters
Status

In Review

Board

πŸ’‘ Feature Request

Tags

Indicators

Date

Almost 2 years ago

Author

southsidejames

Subscribe to post

Get notified by email when there are changes.