REM MADRID TREND SQUEEZE
//indicador de la plataforma Tradingview creado por Madrid
// Madrid : Squeeze Trend : 02/Aug/2015 : 11:41 : 2.0
// This Study determines the range where the trend is more profitable.
// http://madridjourneyonws.blogspot.com/
//adaptación para Prorealtime v10.3 por bolsatrilera Junio 2017
len = 34
src = close
ref = 13
sqzLen = 5
ma =ExponentialAverage[len](src)
closema = close - ma
refma =ExponentialAverage[ref](src)-ma
sqzma =ExponentialAverage[sqzLen](src)-ma
if closema>=0 then
//colorr=0
colorg=255
//colorb=255
else
//colorr=255
colorg=0
//colorb=255
endif
if sqzma>=0 then
//scolorr=50
//scolorg=205
//scolorb=50
else
//scolorr=255
//scolorg=0
//scolorb=0
endif
if refma>=0 and closema<refma or refma<0 and closema>refma then
r=255
//g=255
//b=0
elsif refma>=0 then
r=0
//g=128
//b=0
else
r=128
//g=0
//b=0
endif
c1 = closema>0 and colorg>0
c2 = refma<0 and r=255
screener[c1 and c2]
//return closema coloured (colorr,colorg,colorb)style(histogram)as "closema",sqzma coloured (scolorr,scolorg,scolorb)style(histogram)as "sqzma",refma coloured(r,g,b)style(histogram)as "refma",0 as "0"