Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=2
- study("Investor Sentiment")
- f_short_term(domain, approximation)=>
- _length_adjusted = approximation < 1 ? 1 : approximation
- _multiplier = 2 / (approximation + 1)
- _return = na(_return[1]) ? domain : ((domain - _return[1]) * _multiplier) + _return[1]
- x_3_5 = f_short_term(close,3.0) + f_short_term(close,5.0)
- x_8_10 = f_short_term(close,8.0) + f_short_term(close,10.0)
- x_12_15 = f_short_term(close,12.0) + f_short_term(close,15.0)
- x_3_10 = x_3_5 + x_8_10
- x_3_15 = x_3_10 + x_12_15
- f_long_term(domain, extended)=>
- _length_adjustedx = extended < 1 ? 1 : extended
- f_multiplier = 2 / (extended + 1)
- f_return = na(f_return[1]) ? domain : ((domain - f_return[1]) * f_multiplier) + f_return[1]
- x_30_35 = f_long_term(close,30.0) + f_long_term(close,35.0)
- x_40_45 = f_long_term(close,40.0) + f_long_term(close,45.0)
- x_50_60 = f_long_term(close,50.0) + f_long_term(close,60.0)
- x_30_45 = x_30_35 + x_40_45
- x_30_60 = x_30_45 + x_50_60
- x_3_60 = x_3_15 - x_30_60
- osc = x_3_60 * 10
- hline(0)
- x_color = osc >= 0 ? green:red
- plot(osc,color=x_color,linewidth=2,style=histogram,transp=5)
- alertcondition(osc > 0, title='Sentiment Has Turned Positive', message='Sentiment Has Turned Positive!')
- alertcondition(osc < 0, title='Sentiment Has Turned Negative', message='Sentiment Has Turned Negative!')
Advertisement
Add Comment
Please, Sign In to add comment