Mobius' Momentum Squeeze Experiment for ThinkorSwim

Townsend

Townsend

Active member
VIP
I was glad to find the Mobius’ Momentum Squeeze Indicator, as the ThinkorSwim TTM_SQueeze indicator has the the source code locked and hidden.

John Carter's version is quite well know. The basis being Bollinger Bands dipping into a Kelter Channel. So I was surprised to see the Mobius code did not seem to use either Bollinger Bands or Keltner channels. But rather Average True Range. None the less, when the two versions, (TTM vs Mobius') are placed on the same chart they matched up identically.

Anyway, I try to avoid using too many lower window indicators, so I made some quick modifications and converted the Mobius version into a Paint Bar Indicator. The changes in direction are even more evident and the trending alert zones, (colored in gray) stand even better than the usual red dots. (See chart below.)



Though... one thing I can't figure out, the assignpriceColor() function at the bottom is supposed to display the up momentum bars as color.blue, but instead defaults to the system defined down bar color.

Another lesser problem: with the TOS TTM version, the input parameters are fairly clear. Bollinger deviation, Kelter deviation and the Alert Line Sensitivity. But Mobius uses only two inputs: SDmult and ATRmult. Haven't quite yet figured out how to optimized these values.

Code:
# Momentum Squeeze
# Mobius
# Added Squeeze Label with directional color
# Label is green when momentum is ascending, red when descending

input length = 20; #hint length: Length for average calculation
input price = close;
input SDmult = 2.0;
input ATRmult = 1.5;

def K = (Highest(High, length) + Lowest(low, length)) / 2 + ExpAverage(close, length);
def Momo = Inertia(price - K / 2, length);
def SD = StDev(close, length);
def Avg = Average(close, length);
def ATR = Average(TrueRange(high, close, low), length);
def SDup = Avg + (SdMult * Sd);
def ATRup = Avg + (AtrMult * ATR);

def Squeeze = if SDup < ATRup then 0 else Double.NaN;

assignpriceColor(if squeeze ==0 then color.gray else
if momo > momo[1] then color.blue else color.red
);

AddLabel(!isNaN(Squeeze), "Squeeze", if isAscending(Momo)
                                     then Color.Green
                                     else Color.Red);
 
Last edited by a moderator:
markos

markos

Well-known member
VIP
@Townsend The SD in Mobius' script is for 2 std deviations, which is the usual for Bollys as it covers over 99% of occurrences.
The 1.5 ATR probably matches up with the Keltner Channel study numbers. To me, that makes sense.

I don't do Squeezes, to me it's a marketing ploy.
 
T

tomsk

Well-known member
VIP
@Townsend The SD in Mobius' script is for 2 std deviations, which is the usual for Bollys as it covers over 99% of occurrences.
The 1.5 ATR probably matches up with the Keltner Channel study numbers. To me, that makes sense.

I don't do Squeezes, to me it's a marketing ploy.
@markos Indeed - another method might be to look for expanding ATR. After all the base version of Mobius SuperTrend essentially is based on ATR, so there's got to be something there.
 

Similar threads

Top