Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
TTM Squeeze Algo

Hi,

Before I start coding the indicator. Have any of you has it :D ? This is the code in ThinkScript
....................... declare lower;

input price = CLOSE;
input length = 20;
input nK = 1.5;
input nBB = 2.0;
input alertLine = 1.0;

plot scan;

def squeezeHistogram = TTM_Squeeze(price, length, nK, nBB, alertLine).Histogram;

def momentumPivotLow = (squeezeHistogram > squeezeHistogram[1] and squeezeHistogram[1] < squeezeHistogram[2]) ;

def momentumPivotHigh = (squeezeHistogram < squeezeHistogram[1] and squeezeHistogram[1] > squeezeHistogram[2]);

plot barsSincePivot = GetMaxValueOffset(momentumPivot);

def pivotLowFollowThrough = (momentumPivotLow[1] and squeezeHistogram > squeezeHistogram[1]);

def pivotHighFollowThrough = (momentumPivotHigh[1] and squeezeHistogram < squeezeHistogram[1]);

def zeroLinePositiveFollowThrough = ( squeezeHistogram > 0 and squeezeHistogram[1] > 0 and squeezeHistogram[2] < 0 ) ;

def zeroLineNegativeFollowThrough = (squeezeHistogram < 0 and squeezeHistogram[1] < 0 and squeezeHistogram[2] > 0);

uncomment one to scan for pivot high/low with follow through bar

scan = pivotHighFollowThrough;

scan = pivotLowFollowThrough;

uncomment one to scan for zero line positive/negative with follow through bar

scan = zeroLinePositiveFollowThrough;

scan = zeroLineNegativeFollowThrough;

Thanks
EG