AnthonyAlexander

Investor Sentiment source

Feb 14th, 2019
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. //@version=2
  2. study("Investor Sentiment")
  3.  
  4. f_short_term(domain, approximation)=>
  5. _length_adjusted = approximation < 1 ? 1 : approximation
  6. _multiplier = 2 / (approximation + 1)
  7. _return = na(_return[1]) ? domain : ((domain - _return[1]) * _multiplier) + _return[1]
  8.  
  9.  
  10. x_3_5 = f_short_term(close,3.0) + f_short_term(close,5.0)
  11. x_8_10 = f_short_term(close,8.0) + f_short_term(close,10.0)
  12. x_12_15 = f_short_term(close,12.0) + f_short_term(close,15.0)
  13. x_3_10 = x_3_5 + x_8_10
  14. x_3_15 = x_3_10 + x_12_15
  15.  
  16. f_long_term(domain, extended)=>
  17. _length_adjustedx = extended < 1 ? 1 : extended
  18. f_multiplier = 2 / (extended + 1)
  19. f_return = na(f_return[1]) ? domain : ((domain - f_return[1]) * f_multiplier) + f_return[1]
  20.  
  21. x_30_35 = f_long_term(close,30.0) + f_long_term(close,35.0)
  22. x_40_45 = f_long_term(close,40.0) + f_long_term(close,45.0)
  23. x_50_60 = f_long_term(close,50.0) + f_long_term(close,60.0)
  24. x_30_45 = x_30_35 + x_40_45
  25. x_30_60 = x_30_45 + x_50_60
  26.  
  27. x_3_60 = x_3_15 - x_30_60
  28. osc = x_3_60 * 10
  29. hline(0)
  30.  
  31. x_color = osc >= 0 ? green:red
  32. plot(osc,color=x_color,linewidth=2,style=histogram,transp=5)
  33.  
  34. alertcondition(osc > 0, title='Sentiment Has Turned Positive', message='Sentiment Has Turned Positive!')
  35. alertcondition(osc < 0, title='Sentiment Has Turned Negative', message='Sentiment Has Turned Negative!')
Advertisement
Add Comment
Please, Sign In to add comment