diflow=close-low[1]
difhigh=close-high[1]
if diflow>0 then
vvlow=volume
else
if diflow<0 then
vvlow=-volume
else
vvlow=0
endif
endif
if difhigh>0 then
vvhigh=volume
else
if difhigh<0 then
vvhigh=-volume
else
vvhigh=0
endif
endif
cnvlow=summation[ss](vvlow)/300
cnvhigh=summation[ss](vvhigh)/300
BandaUp=(summation[8](cnvlow-cnvhigh))/8
BandaDown=-(summation[8](cnvlow-cnvhigh))/8
REM RELATIVE VOLUME INDICATOR
// @author LazyBear para la plataforma Tradingview, Junio 2014
// adaptado para Prorealtime por bolsatrilera
x=42// "Standard deviation length"
//allowNegativePlots=input(false, type=bool)
//matchVolumeColor=input(false, type=bool)
av= weightedAverage[x](volume)
sd=std[x](volume)
if sd<>0 then
relVol=(volume-av)/sd
else
relVol=0
endif
if 1 then
relV=max(relVol,0)
else
relV=relVol
endif
// Definición de Condiciones
lls=cnvlow crosses over 0 or cnvlow[1] crosses over 0 or cnvlow[2] crosses over 0 or cnvlow[3] crosses over 0
ccs=cnvhigh crosses under 0 or cnvhigh[1] crosses under 0 or cnvhigh[2] crosses under 0 or cnvhigh[3] crosses under 0
largos=lls and cnvhigh crosses over BandaDown and summation[3](RelV)>0
cortos=ccs and cnvlow crosses under BandaUp and summation[3](RelV)>0
lrlow=linearregressionslope[26](low)
lrhigh=linearregressionslope[26](high)
cond1=lrlow>0 and lrhigh>0
cond2= lrlow<0 and lrhigh<0
//Coloreado del Background
if (cortos or cond2) and not cond1 then
backgroundcolor (255,0,0,30)
else
if (largos or cond1) and not cond2 then
backgroundcolor (0,255,0,30)
endif
ENDIF
return