Madrid

MWho is in Control

374 2 58
Who is in Control.
This study shows who is in control by showing just the Bull side, the Bear side or a combined view. This study follows the same philosophy of simplicity I try to use as much as possible in my studies. The least number of parameters and as understandable as possible.
Len             : length of the period
Signal : Signal to show change of trend
Disp Bull : Display/Hide Bull Side
Disp Bear : Display/Hide Bear Side
Disp Differential : Display/Hide the differential between Bulls and Bears.
Remove from Favorite Scripts Add to Favorite Scripts
// Madrid : 24/Apr/2015 : 00:07 : Who is in Control : WhosNControl : 2.0
// This measures the difference in PCT from the last Lowest/Highest Point
// to determine who is in control. Bulls or Bears.
//
study("MWho is in Control", shorttitle="MWhosNControl", precision=2)
src=close
len = input(13)
signal = input(3)
dispBull = input(true, title="Display Bull Side")
dispBear = input(true, title="Display Bear Side")
dispDiff = input(false, title="Display Differential")
smooth = input(true, title="Smooth")


lowerBand = 10
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])
    
lowest = lowest(src,len)
highest = highest(src,len)
diffBull = (src-lowest)*100/lowest
diffBear = (highest-src)*100/highest
diffBullS = ssFilter(diffBull, lowerBand)
diffBearS = ssFilter(diffBear, lowerBand)
differential = smooth?diffBullS-diffBearS:diffBull-diffBear

// Output

diffBullColor = diffBullS - sma(diffBullS, signal)>=0 ? lime:green
diffBearColor = diffBearS - sma(diffBearS, signal)>=0 ? red:maroon

plot(dispBull?(smooth?diffBullS:diffBull):na, color=diffBullColor, linewidth=2, style=columns)
plot(dispBear?(smooth?diffBearS:diffBear):na, color=diffBearColor, linewidth=2, style=columns)

diffColor = differential - sma(differential, signal) >=0 ? lime:red
plot(dispDiff?differential:na, color=diffColor, linewidth=2)

hline(0)

plot(dispBull?diffBullS:na, color=diffBullColor, linewidth=2)
plot(dispBear?diffBearS:na, color=diffBearColor, linewidth=2)

kourosh.alborz
2 years ago
this plus the SQZMOM = GOLD
Reply
Madrid PRO
2 years ago
Thank you for your comment. :)
Reply
Ideas Scripts Chart
United States
United Kingdom
India
España
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener 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
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Billing Sign Out