wtf_dude
Well-known member
Here ya go. Paste this into the thinkscript editor for study scan. Won't need to add any conditions. I coded it in
Code:
# Momentum Squeeze
# Mobius
# Added Squeeze Label with directional color
# Label is green when momentum is ascending, red when descending
declare lower;
input lengthe = 20; #hint length: Length for average calculation
input price = close;
input SDmult = 2.0;
input ATRmult = 1.5;
def K = (Highest(High, lengthe) + Lowest(low, lengthe)) /
2 + ExpAverage(close, lengthe);
def Momo = Inertia(price - K / 2, lengthe);
def SD = StDev(close, lengthe);
def Avg = Average(close, lengthe);
def ATR = Average(TrueRange(high, close, low), lengthe);
def SDup = Avg + (SdMult * Sd);
def ATRup = Avg + (AtrMult * ATR);
def Squeeze = SDup < ATRup;
def zero = if IsNaN(close) or !IsNaN(Squeeze) then Double.NaN else 0;
Plot breakout = squeeze[1] is true and squeeze is false;