♥ 0 |
Originally posted by Hilario Dsouza as a comment to the following video: https://www.hahn-tech.com/thinkorswim-watchlist-ttm-squeeze/ Hi Pete, On the TTM squeeze I wanted to setup a trigger (Plot) on the COLOR of the BAR. For Example if the COLOR is LIGHT BLUE or YELLOW then setup an alert. I see you did something similar in the video above. I am planning to use the color of the bar along with the MACD and stochastic indicator. I wrote the initial lines of code, but I am not sure how to get to the Yellow Bars. def yellowbar = TTM_Squeeze(price, length, nK, nBB, alertLine).SqueezeAlert;
Marked as spam
|
Private answer
would this script work on tradingview? Marked as spam
|
|||||
Private answer
Thanks Pete for the details and the code. I did additional modifications and it works great !! Marked as spam
|
|||||
Private answer
Hi Hilario, The first step is to get the value of the Histogram from the TTM Squeeze indicator. Because the change in color is dictated by the value of the histogram compared to it’s relationship to the zero line as well as the value of it’s preceding bar. The color change from Cyan to Blue is defined as the histogram above zero, the current bar lower than previous. The we add an element that checks that the histogram was trending higher before current bar. This way we are only alerted on the first blue bar after a series of Cyan. The signals below the zero line are handled in similar fashion. The last two lines are for the alerts. declare lower; input price = CLOSE; def sqzHist = TTM_Squeeze(price, length, nK, nBB, alertLine).Histogram; plot 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); Marked as spam
|
Please log in to post questions.
No, the languages are quite different so you could not copy and paste this code to TradingView and get it to work. The other reason is that this code makes use of a proprietary study licensed by John Carter. Thinkorswim allows us to make use of the licensed study without exposing the proprietary source code.