watch list alerts


0
0

are we allowed to add message bar and audio ring alerts to watch lists on TOS? i tried doing it but it seems i got it all wrong. i also  tied added alerts to subgraph TTM squeeze and it turned the subgraph into a yes or no spike indicator but the audio and message bar does alert properly. just indicator just doesnt display like the original TTM squeeze indicator.

code for watchlist:

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

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

plot hist = if squeezeHistogram>= 0 then
if squeezeHistogram> squeezeHistogram[1] then 2 else 1
else if squeezeHistogram < squeezeHistogram[1] then -2 else -1;

assignBackgroundColor(if squeezeHistogram >= 0 then
if squeezeHistogram > squeezeHistogram[1] then color.CYAN else color.BLUE
else if squeezeHistogram < squeezeHistogram[1] then color.RED else color.YELLOW);

hist.assignvaluecolor(if squeezeHistogram >= 0 then
if squeezeHistogram > squeezeHistogram[1] then color.CYAN else color.BLUE
else if squeezeHistogram < squeezeHistogram[1] then color.RED else color.YELLOW);
def sqzHist = TTM_Squeeze(price, length, nK, nBB, alertLine).Histogram;

declare lower;

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

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

def cyanToBlue = sqzHist > 0 and sqzHist < sqzHist[1] and sqzHist[1] > sqzHist[2];

def redToYellow = sqzHist <= 0 and sqzHist > sqzHist[1] and sqzHist[1] < sqzHist[2];

Alert(cyanToBlue, “TTM Squeeze Blue Bar”, Alert.BAR, Sound.Ring);
Alert(redToYellow, “TTM Squeeze Yellow Bar”, Alert.BAR, Sound.Ring);


code from TTM squeeze subgraph:

# Source code isn’t available.

declare lower;

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

plot Histogram = Double.NaN;
plot VolComp = Double.NaN;
plot SqueezeAlert = Double.NaN;

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

def cyanToBlue = sqzHist > 0 and sqzHist < sqzHist[1] and sqzHist[1] > sqzHist[2];

plot redToYellow = sqzHist <= 0 and sqzHist > sqzHist[1] and sqzHist[1] < sqzHist[2];
Alert(cyanToBlue, “TTM Squeeze Blue Bar”, Alert.BAR, Sound.Ring);
Alert(redToYellow, “TTM Squeeze Yellow Bar”, Alert.BAR, Sound.Ring);

 

Marked as spam
Posted by (Questions: 6, Answers: 8)
Asked on January 24, 2017 1:04 am
1778 views
0
Private answer

Keep working at it, you are learning through trial and error. Each piece of knowledge lays the foundation for the next level.

In answer to your first and original question. It is not possible to add alerts to a watchlist column. You can add the lines of code but they are never active.

In answer to your second post, asking about adding alerts to a lower study. You say the lower study is not matching the indicator. This is because the conditions you have assembled are incorrect. We have already published code that indicates the change in color of the TTM Squeeze histogram: https://www.hahn-tech.com/thinkorswim-ttm-squeeze-watchlist/

In that video, we did this for a custom watchlist column. The code can be easily adapted to plot in a lower study. Once you get that working, your alert statements should work.

Hope it helps.

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on January 24, 2017 8:55 am