Madrid

Madrid Bull Bear Sentiment

529 0 103
This indicator displays the distance in percentage between the highest and lowest points in a given period of time, compares them and determines which side has more dominance.
Remove from Favorite Scripts Add to Favorite Scripts
// Madrid : 24/Apr/2015 : 00:07 : Bull Bear Sentiment : 2.0
// This measures the difference in PCT from the last Lowest/Highest Point
// to determine the overall sentiment
//
study("Madrid Bull Bear Sentiment", shorttitle="MSentiment", precision=0)
src=close
len = input(18)

OB=76.4, OS=23.6
smooth = input(true, title="Smooth")

lowerBand = 5
PI= 3.14159265358979
ssFilter( price, lowerBand ) =>
    angle = sqrt(2)*PI/lowerBand
    a1= exp(-angle)
    b1 = 2*a1*cos(angle)
    c2 = b1
    c3 = -a1*a1
    c1 = 1 - c2 -c3
    filt = c1*(price + nz(price[1]))/2 + c2*nz(filt[1]) + c3*nz(filt[2])

sentiment(len) =>
    lowest = lowest(src,len)
    highest = highest(src,len)
    diffBull = (src-lowest)*100/lowest
    diffBear = (highest-src)*100/highest
    bbs = diffBull*100/(diffBear + diffBull)
    bbSentiment = smooth?ssFilter(bbs,lowerBand):bbs

bbSentiment = sentiment(len)

// Output
hline(OB, color=white, linestyle=dotted)
hline(50, color=white, linestyle=dotted)
hline(OS, color=white, linestyle=dotted)

plot(100, color=red, style=area, transp=0)
plot(bbSentiment, color=green, style=area, transp=0)
plot(bbSentiment, color=change(bbSentiment)>=0?lime:maroon, linewidth=1)

United States
United Kingdom
India
Deutschland
España
France
Italia
Polska
Brasil
Россия
Türkiye
Indonesia
Malaysia
日本
한국
Home Stock Screener Forex Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing Priority Support Ideas Published Followers Following Private Messages Chat Sign Out