Madrid

MWho is in Control

559
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.

Скрипт с открытым кодом

В истинном духе TradingView автор этого скрипта опубликовал его с открытым исходным кодом, чтобы трейдеры могли понять, как он работает, и проверить на практике. Вы можете воспользоваться им бесплатно, но повторное использование этого кода в публикации регулируется Правилами поведения. Вы можете добавить этот скрипт в избранное и использовать его на графике.

Отказ от ответственности

Все виды контента, которые вы можете увидеть на TradingView, не являются финансовыми, инвестиционными, торговыми или любыми другими рекомендациями. Мы не предоставляем советы по покупке и продаже активов. Подробнее — в Условиях использования TradingView.

Хотите использовать этот скрипт на графике?
// 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)