Join useThinkScript to post your question to a community of 21,000+ developers and traders.
You may like the IronRod indicator that @MerryDay uses.Hello all, I'm looking for a ttm squeeze histogram turns up or down signal where it labels an arrow sign up or down on a chart. Please point me to the direction.
Thanks in advance
hi @wtf_dude ! i love your shares. Is there any way to make these into labels for the chart? interested in the histo flip pos/neg, the histo shift from red/yellow and teal/royalblue, and last and best... the dots!!!!Oh no, you have to put it with the code I posted earlier. Just create a new study, call it something like AdvancedSqueezeScanner and paste all of this and then use it on the scan tab. Should be go to go.
Code:# 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 BreakoutEitherDirection = 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 BullTrendReversal = momobulldown is true and momobulldown[1] is false; Plot BearTrendReversal = momobearup is true and momobearup[1] is false; plot Squeeze_ChangetoBull = BearTrendReversal and squeeze is true; plot Squeeze_ChangetoBear = BullTrendReversal and squeeze is true; #End Code
I'm looking for a scanner that will find tickers in the TTM Squeeze at the first yellow bar.
![]()
Code:def ttm_histogram = TTM_Squeeze(); def red_squeeze = if ttm_histogram < 0 and ttm_histogram < ttm_histogram[1] then 1 else 0; plot first_yellow = if red_squeeze[1] == 1 and !red_squeeze and ttm_histogram < 0 then 1 else 0; AddChartBubble(first_yellow, 0, first_yellow, Color.YELLOW); #
ThanksThe ToS platform does not make the TTM Squeeze source code available for customizations.
@entercode27 @mchapma72
Hi Madhu,Hi Everyone,
I am using TTM squeeze.
Can someone help me please to scan histogram is lightblue (cyan)and having a squeeze?
Thanks
Thank youHi Madhu,
This works. Setup up two filters like the screenshot
View attachment 24121
The first filter will contain:
TTM_Squeeze().SqueezeAlert == 0
the second filter will contain a few lines:
def hist = reference TTM_Squeeze.Histogram;
# any Cyan Histogram Bar
plot scan = if hist > 0 and hist > hist[1] then 1 else Double.NaN;
"AddLabel is not allowed in this context"For those of you who enjoy using the TTM Squeeze & Momentum indicator, this should be a handy addition to your ThinkorSwim chart setup. The script will add the status of the TTM Squeeze for stocks on your watchlist via a new column. You can select whichever timeframe you would like to scan for TTM squeeze.
Stocks usually break out of consolidations and by having the TTM Squeeze on your watchlist it helps to alert when they do.
Here is what each signal and labels represent:
- Bright Red: The stock is in Buy zone
- Dark Red: Market compression is currently in this time period. The number reveals the amount of dots on your TTM Squeeze indicator.
- Dark Green: The squeeze has fired. The number notes how many dots (up to 5) and whether the squeeze signaled Long or Short.
- Black: No squeeze on this time frame
View attachment 4687
thinkScript Code
Code:# Squeeze watchlist column # Red Background - Squeeze is building in the time period - number indicates how many dots # w/ white "B" - Squeeze is building, stock is within "buy zone" # Green Background - Squeeze has fired - number indicates how many dots (up to 5 dots) # and whether Squeeze fired L(ong) or S(hort) # Black Background - No Squeeze in play # Original code by Eric Purdy of Simpler Trading 2017 # Modified code by Rich Stratmann to put in background colors and shorten column values # Updates by dmccuskey # - change background colors to aid content scanning # - add "B" to time frames which are in the Buy Zone - between 8 & 21 EMA # - change "0" to " " <space> so that the content doesn't show when row is highlighted #ToS Share Code: https://tos.mx/IPrEhH def sqz = !TTM_Squeeze().SqueezeAlert; def direction = TTM_Squeeze()>TTM_Squeeze()[1]; def count = if sqz and !sqz[1] then 1 else count[1]+1; def isFired = if !sqz and sqz[1] then 1 else 0; def firedCount = if isFired then 1 else firedCount[1]+1; def firedDirection = if isFired then direction else firedDirection[1]; def sumIsFired = sum(isFired,5); def isFiredDir = sumIsFired && firedDirection; # look for close buy zone def ema8 = reference movAvgExponential(length=8); def ema21 = reference movAvgExponential(length=21); def currPrice = close(); def highVal = Max(ema8, ema21); def lowVal = Min(ema8, ema21); def inBuyZone = currPrice >= lowVal && currPrice <= highVal; def sqzBuy = sqz && inBuyZone; def sqzNoBuy = sqz && !inBuyZone; addLabel(yes, Concat(if sqzBuy then "B " else "", if sqz then "" + count else if sumIsFired then “” + firedCount + if firedDirection then ” L” else ” S” else “ ”), if sqzBuy then color.white else color.black); AssignBackgroundColor(if sqzNoBuy then CreateColor(170, 6, 0) else if sqzBuy then color.red else if sumIsFired then CreateColor(28, 105, 3) else color.black);
Shareable Link
https://tos.mx/uXplYi
Credits:
- Eric Purdy and Rich Stratmann
- dmccuskey
"AddLabel is not allowed in this context"
| Thread starter | Similar threads | Forum | Replies | Date |
|---|---|---|---|---|
| C | TTM Squeeze Fire Signal - Another Take! | Indicators | 19 | |
|
|
TTM Squeeze Clouds Indicator for ThinkorSwim | Indicators | 42 | |
| D | TTM Trend Source Code For ThinkOrSwim | Indicators | 2 | |
| H | My version of the TTM Trend for ThinkorSwim | Indicators | 12 | |
| T | Beardy Squeeze Pro For ThinkOrSwim | Indicators | 28 |
Start a new thread and receive assistance from our community.
useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.
We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.
If you are new, or just looking for guidance, here are some helpful links to get you started.