TTM Squeeze scan that looks the number of red dots in a row.


Category:
0
0

Your video covers the histogram value changes. I want a scan that looks for the number of red dots in a row. The standard TTM Squeeze scan in thinkorswim displays stocks that has a Squeeze switch from a green dot to a red dot. Can you please make one?

Marked as spam
Posted by (Questions: 1, Answers: 0)
Asked on January 5, 2017 9:01 am
2677 views
0
Private answer

Ok, so for context, the video you mentioned was for a custom watchlist column, not a scan. That video is here: https://www.hahn-tech.com/thinkorswim-ttm-squeeze-watchlist/

Instead of a watchlist, you want to scan for the number of red dots on the TTM Squeeze. The code for watchlists and scans is very similar. They are easily converted. We have done this for a watchlist here: https://www.hahn-tech.com/thinkorswim-watchlist-ttm-squeeze/

So we’ll adapt that code to work as a scan:

input price = CLOSE;
input length = 20;
input nK = 1.5;
input nBB = 2.0;
input alertLine = 1.0;
def squeezeDots = TTM_Squeeze(price, length, nK, nBB, alertLine).SqueezeAlert;
# the original code here counted the number of green dots, so we comment this out and leave it here for safe-keeping
#def alertCount = if squeezeDots[1] == 0 and squeezeDots == 1 then 1 else if squeezeDots == 1 then alertCount[1] + 1 else 0;
# and here we have modified it to count the red dots
def alertCount = if squeezeDots[1] == 1 and squeezeDots == 0 then 1 else if squeezeDots == 0 then alertCount[1] + 1 else 0;
# alertCount is the variable that keeps track of our red dots
# we can scan for greater than 3 consecutive red dots
plot scan = alertCount > 3;
# or we can scan for a range of dots, 1-3
#plot scan = alertCount > 0 and alertCount < 4;

 

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on January 5, 2017 10:33 am
0
Hi Pete, Bringing up an old thread. Can this scan be modified to include range of green dots after x number of consecutive red dots?. Thanks Jay
( at June 8, 2020 2:36 am)
0
Yes, but this requires you post it as a new question.
( at June 8, 2020 7:50 am)