MarcoValente

HH&LL (Highest High and Lowest Low)

620
It show us HH and LL, OB line and OS can regulate as you like ; histogram is the difference between the hh and ll, and show the strenght of the trend. Can use also the adaptive bands for the OB/OS level.
Script de código aberto

Dentro do verdadeiro espírito TradingView, o autor deste script publicou ele como um script de código aberto, para que os traders possam compreender e checar ele. Um viva ao autor! Você pode usá-lo gratuitamente, mas a reutilização deste código em uma publicação é regida pelas Regras da Casa. Você pode favoritá-lo para usá-lo em um gráfico.

Aviso legal

As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.

Quer usar esse script no gráfico?
//@version=2
study("HH&LL") // highest high & lowest low
length=input(20)
ww=input(false,title="use adaptive OS/OB ?")
qq=input(true,title="use backround signal color?")
his=input(true,title="Show Histogram?")
useCurrentRes = input(true, title="Use Current Chart Resolution?")
resCustom = input(title="Use Different Timeframe? (Uncheck Box Above).", type=resolution, defval="D")
res = useCurrentRes ? period : resCustom
HHH =iff( high > high[1], (high - lowest( high, length )) /( highest( high, length ) - lowest( high, length ) ), 0 ) 
LLL = iff( low < low[1],( highest( low, length ) - low ) /( highest( low, length ) - lowest( low, length ) ), 0 ) 
HHSa = ema( HHH, length ) * 100 
LLSa = ema( LLL, length ) * 100 
HHS = security(tickerid, res,HHSa)
LLS= security(tickerid, res, LLSa)
aa=plot( HHS, "HHS" ,color=blue,transp=0) 
bb=plot( LLS, "LLS" ,color=red,transp=0) 	
hln=input(60)
lln=input(10)
smo=input(50,"Bands Filter length")
hs=highest(max(HHS,LLS),50)
lw=lowest(min(LLS,HHS),50)
mh=ema(hs,20)
RMSa= sum( mh*mh, smo)
RMS= avg(sqrt(RMSa/smo),hln)
al=ww?RMS:hln
ms=ema(lw,20)
MSa= sum( ms*ms, smo)
MS= avg(sqrt(MSa/smo),lln)
bs=ww?MS:lln
col=HHS>al and HHS[2]<HHS[1] and HHS[1]>HHS and LLS<bs?1:0
cor=LLS>al and LLS[2]<LLS[1] and LLS[1]>LLS and HHS<bs?1:0
con=HHS<bs and HHS[2]>HHS[1] and HHS[1]<HHS and LLS>al?1:0
cod=LLS<bs and LLS[2]>LLS[1] and LLS[1]<LLS and HHS>al?1:0
bc=col or cod?red: cor or con?green:na
a=plot(al,style=cross,color=black,transp=50)
b=plot(bs,style=cross,color=black,transp=50)
df=abs(HHS-LLS)
cl=df>55?red : df<25?green :orange
plot(his?df:na,color=cl,style=histogram,linewidth=2,transp=75)
plot(HHS>al?HHS:na,style=histogram,histbase=60,color=red)
plot(LLS>al?LLS:na,style=histogram,histbase=60,color=red)
plot(LLS<bs?LLS:na,style=histogram,histbase=10,color=green)
plot(HHS<bs?HHS:na,style=histogram,histbase=10,color=green)
bgcolor(qq?bc:na,transp=80)