TTM Squeeze watchlist for number of red dots


Category:
0
0

Could you please advise what I need to modify in this script so it will show a count in the red cells ( to know how many counts the stock has been in the squeeze )
Thank you

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;
def alertCount = if squeezeDots[1] == 0 and squeezeDots == 1 then 1 else if squeezeDots == 1 then alertCount[1] + 1 else 0;

plot data = alertCount;
data.AssignValueColor(if alertCount > 0 then Color.BLACK else Color.WHITE);
AssignBackgroundColor(if alertCount == 0 then Color.RED else Color.GREEN);

Marked as spam
Posted by (Questions: 1, Answers: 0)
Asked on April 4, 2020 3:30 pm
611 views
0
Private answer

First thing we need to provide here is a link to the video showing where the viewers can get a full explanation of that code you posted. Please be sure to always include a link to the original source so the rest of our viewers are able to get the full context of the questions you post.

https://www.hahn-tech.com/thinkorswim-watchlist-ttm-squeeze/

The original code counts the number of green dots. The reason for this is explained in the video linked above. According the author of the TTM Squeeze, the number of red dots has absolutely no bearing on making a trade. However I understand that some folks will prefer to work out their own methods of using this indicator. So I will provide a version of this code that counts red dots instead of green.

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;
def alertCount = if squeezeDots[1] == 1 and squeezeDots == 0 then 1 else if squeezeDots == 0 then alertCount[1] + 1 else 0;
plot data = alertCount;
data.AssignValueColor(if alertCount > 0 then Color.RED else Color.GREEN);

Marked as spam
Posted by (Questions: 37, Answers: 4087)
Answered on April 4, 2020 4:03 pm