Advertisement
Guest User

Untitled

a guest
Feb 10th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. //@version=2
  2. study("Standard Error Bands", overlay=true)
  3. // Standard Error of the Estimate
  4. beta(array,per) =>
  5. val1 = sum(n*array,per)-(per*sma(n,per)*sma(array,per))
  6. val2 = sum(pow(n,2),per)-(per*pow(sma(n,per),2))
  7. calcB = val1/val2
  8.  
  9. alpha(array,per) =>
  10. calcA = sma(array,per)-(beta(array,per)*sma(n,per))
  11.  
  12. see(array,per,mult,dir) =>
  13. lr = linreg(array,per,0)
  14. val1 = (sum(pow(array,2),per))-((alpha(array,per)*sum(array,per)))-((beta(array,per)*sum(n*array,per)))
  15. val2 = per - 2
  16. stde = sqrt(val1/val2)
  17. d = dir ? 1 : -1
  18. seband = lr + d * mult * stde
  19. //plot(linreg(close,21))
  20. plot(see(close,21,2,true))
  21. plot(see(close,21,2,false))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement