def squeeze = TTM_Squeeze().SqueezeAlert [-3] is false;
def squeeze1 = TTM_Squeeze().SqueezeAlert is false;
def ttmsqueeze1 = !IsNaN(squeeze);
def ttmsqueeze2 = !IsNan(squeeze1);
def ttmsqueeze = ttmsqueeze1 or ttmsqueeze2 is true;
# 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;
# AdvancedSqueezeScanner
# Momentum Squeeze open coding by Moebius, based on John Carter
# Scan by WTF_Dude
# Added Squeeze Label with directional color
# Label is green when momentum is ascending, red when descending
declare lower;
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 = SDup < ATRup;
def zero = if IsNaN(close) or !IsNaN(Squeeze) then Double.NaN else 0;
def momobullup = Momo > Momo[1] and Momo > 0;
def momobulldown = Momo > 0 and Momo < Momo[1];
def momobeardown = Momo > Momo[1] and Momo > 0;
def momobearup = Momo < 0 and Momo > Momo[1];
Plot Breakout = squeeze[1] is true and squeeze is false;
plot BreakoutBull = squeeze[1] is true and squeeze is false and momobullup;
plot BreakoutBear = squeeze[1] is true and squeeze is false and momobulldown;
Plot BullTrendChange = momobulldown is true and momobulldown[1] is false;
Plot BearTrendChange = momobearup is true and momobearup[1] is false;
That would mean you're setting up the scan incorrectly. The code itself doesn't have a condition. You want the study to be matched as "is true" and that would be the conditionA get a message it says at least one condition needs to be corrected.
I think a lot of people here are used to the #comment out instead of setting the true/false from the menu...hence the confusion.That would mean you're setting up the scan incorrectly. The code itself doesn't have a condition. You want the study to be matched as "is true" and that would be the condition
Right, I get it, I just find that it's safer to make a drop down option menu rather than risk messing with code to pick a condition.I think a lot of people here are used to the #comment out instead of setting the true/false from the menu...hence the confusion.
Right, I get it, I just find that it's safer to make a drop-down options menu rather than risk messing with code to pick a condition.
Then select whatever you named my study as on the chart tab. Then on the "add conditions" screen it will give you a drop down menu with different options to choose from like squeeze breakout bull, squeeze breakout bear, bull trend change, etc. Select the option you want to scan for and then choose "is true" in the middle column. Good to goI'm too used to copying & pasting the code in the editor than the drop-down menu, but how's that down? Add study, custom, and then what?
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
P | Scan for newly released option contracts | Questions | 0 | |
M | Scan for stocks that is below the lower Bollinger band | Questions | 14 | |
T | Scan for tickers with good options volume in ToS | Questions | 5 | |
![]() |
Increase the loading speed when you scan for stocks | Questions | 12 | |
N | Get scan results when ANY conditions are met | Questions | 3 |