Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=2
- study("Standard Error Bands", overlay=true)
- // Standard Error of the Estimate
- beta(array,per) =>
- val1 = sum(n*array,per)-(per*sma(n,per)*sma(array,per))
- val2 = sum(pow(n,2),per)-(per*pow(sma(n,per),2))
- calcB = val1/val2
- alpha(array,per) =>
- calcA = sma(array,per)-(beta(array,per)*sma(n,per))
- see(array,per,mult,dir) =>
- lr = linreg(array,per,0)
- val1 = (sum(pow(array,2),per))-((alpha(array,per)*sum(array,per)))-((beta(array,per)*sum(n*array,per)))
- val2 = per - 2
- stde = sqrt(val1/val2)
- d = dir ? 1 : -1
- seband = lr + d * mult * stde
- //plot(linreg(close,21))
- plot(see(close,21,2,true))
- plot(see(close,21,2,false))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement