Hey Guys, found this indicator on TradingView and ported it over today. First time I have done it. No idea if this squeeze is different than any other one out there. Here is the authors notes. Be aware, my colors are different than his.
https://www.tradingview.com/script/9bUUSzM3-Madrid-Trend-Squeeze/
https://www.tradingview.com/script/9bUUSzM3-Madrid-Trend-Squeeze/
This study spots the points that are most profitable in the trend with a code color and shape. This also shows trend divergences and possible reversal or reentry points
Keeping the parameters simple, this study only needs one parameter, the length of the base moving average, which by default is set to 34.
There are seven colors used for the study
Green : Uptrend in general
Lime : Spots the current uptrend leg
Aqua : The maximum profitability of the leg in a long trade
The Squeeze happens when Green+Lime+Aqua are aligned (the larger the values the better)
Maroon : Downtrend in general
Red : Spots the current downtrend leg
Fuchsia: The maximum profitability of the leg in a short trade
The Squeeze happens when Maroon+Red+Fuchsia are aligned (the larger the values the better)
Yellow : The trend has come to a pause and it is either a reversal warning or a continuation. These are the entry, re-entry or closing position points.
When either the fuchsia or the aqua colors disappear or shrinks meaningfully it could mean a possible leg exhaustion that will have to be confirmed with the subsequent bars.
When the squeeze color appears without the intermediate color (fuchsia+yellow, fuchsia+maroon, aqua+yellow, aqua+green) it could mean this is just a shake off move, a pump/dump move, a buy the dip or a sell the peak move or a gap.
In the example there are three divergences spotted, the first one between march 2009 and september 2010 when the peaks in the indicator made a lower low, meanwhile the price made a higher high, this is a negative divergence and a trend reversal. On the second example, between april 2013 and July 2013 the indicator made a higher high meanwhile the price made a double bottom , this is a positive divergence and a reversal to the upside.
Code:
#study("Madrid Trend Squeeze", shorttitle=" MTrendSqueeze")
# 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/
#Ported from Tradingview
#by Ken_Adams on 4/22/20
#start of code
declare lower;
declare zerobase;
input len = 21;
input src = close;
input ref = 13
;
input sqzLen = 5
;
input hline = 0;
def ma = MovAvgExponential(src, len)
;
def closema = close - ma;
plot closema1 = closema;
closema1.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
closema1.SetLineWeight(3);
closema1.AssignValueColor(if closema >= 0 then Color.PINK else Color.MAGENTA);
def sqzma = MovAvgExponential(src, sqzLen) - ma;
plot sqzma1 = sqzma;
sqzma1.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
sqzma1.SetLineWeight(3);
sqzma1.AssignValueColor(if sqzma >= 0 then Color.cyan else Color.RED);
def refma = MovAvgExponential(src, ref) - ma;
plot refma1 = refma;
refma1.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
refma1.SetLineWeight(3);
refma1.AssignValueColor(if refma >= 0 and closema < refma or refma < 0 and closema > refma then Color.YELLOW else color.black);
plot refma2 = refma;
refma2.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
refma2.SetLineWeight(3);
refma2.AssignValueColor(if refma >= 0 then Color.GREEN else Color.dark_orange);
#end of code
Last edited: