Re: Fun with ThinkScript January 22, 2014 04:03AM |
Registered: 10 years ago Posts: 615 |
Re: Fun with ThinkScript January 22, 2014 09:17AM |
Registered: 10 years ago Posts: 465 |
Re: Fun with ThinkScript January 28, 2014 06:59AM |
Registered: 11 years ago Posts: 3 |
Re: Fun with ThinkScript January 28, 2014 10:47AM |
Registered: 11 years ago Posts: 119 |
Re: Fun with ThinkScript January 28, 2014 10:20PM |
Registered: 11 years ago Posts: 3 |
Re: Fun with ThinkScript January 29, 2014 04:01PM |
Registered: 10 years ago Posts: 100 |
Re: Fun with ThinkScript January 29, 2014 06:54PM |
Registered: 10 years ago Posts: 615 |
Re: Fun with ThinkScript January 30, 2014 08:55AM |
Registered: 11 years ago Posts: 119 |
Re: Fun with ThinkScript January 30, 2014 09:03AM |
Registered: 10 years ago Posts: 615 |
Re: Fun with ThinkScript January 30, 2014 01:14PM |
Registered: 10 years ago Posts: 100 |
Re: Fun with ThinkScript February 05, 2014 07:16PM |
Registered: 11 years ago Posts: 106 |
Re: Fun with ThinkScript February 05, 2014 08:12PM |
Registered: 10 years ago Posts: 615 |
Quote
NMR
Robert:
I wanted to create a signal on my watchlist in TOS that flags a stock when it is outside of the BB: Can I just use your code below and add that as a scan?
#Out of Bounds def sDev = StDev(close, 21); def MidLine = Average(close, 21); def UpperBand = MidLine + 2 * sDev; def LowerBand = MidLine - 2 * sDev; plot OOB = if close > UpperBand then Round(close - UpperBand, 2) else if close < LowerBand then Round(close - LowerBand, 2) else Double.NaN; AssignBackgroundColor(if !isnan(oob) then color.white else color.gray); OOB.assignvalueColor(if !isnan(oob) then color.black else color.gray);
Re: Fun with ThinkScript February 05, 2014 08:23PM |
Registered: 11 years ago Posts: 106 |
Re: Fun with ThinkScript February 05, 2014 08:27PM |
Registered: 10 years ago Posts: 615 |
Re: Fun with ThinkScript February 13, 2014 01:50PM |
Registered: 13 years ago Posts: 216 |
Re: Fun with ThinkScript February 13, 2014 03:16PM |
Registered: 10 years ago Posts: 615 |
Re: Fun with ThinkScript February 26, 2014 06:55PM |
Registered: 10 years ago Posts: 2 |
Re: Fun with ThinkScript February 26, 2014 08:46PM |
Registered: 10 years ago Posts: 615 |
Quote
smccooey
I've been looking everywhere for an indicator that alerts me with a sound and message (within tos) as soon as price crosses the upper or lower bullinger band, it would also be great if the background color could change to grey, so i immediately know which chart I'm looking at.
input length = 21; input deviation = 2; def sDev = StDev(data = close, length); def MA21 = Average(close, length); def UpperBand = MA21 + deviation * sDev; def LowerBand = MA21 - deviation * sDev; def oobUp = if close > UpperBand and close[1] <= UpperBand[1] then 1 else Double.NaN; def oobDn = if close < LowerBand and close[1] >= LowerBand[1] then 1 else Double.NaN; Alert(oobUp, Concat(GetSymbolPart(), " above upper band." ), Alert.BAR, Sound.Chimes); Alert(oobDn, Concat(GetSymbolPart(), " below lower band." ), Alert.BAR, Sound.Chimes); assignbackgroundColor(if close > upperband then color.gray else if close < lowerband then color.gray else color.current);
Re: Fun with ThinkScript February 27, 2014 06:33AM |
Registered: 10 years ago Posts: 2 |
Re: Fun with ThinkScript March 14, 2014 05:28PM |
Registered: 10 years ago Posts: 17 |
Re: Fun with ThinkScript March 14, 2014 06:19PM |
Registered: 10 years ago Posts: 615 |
Re: Fun with ThinkScript March 14, 2014 07:56PM |
Registered: 10 years ago Posts: 17 |
Re: Fun with ThinkScript March 15, 2014 10:03PM |
Registered: 10 years ago Posts: 143 |
Re: Fun with ThinkScript March 16, 2014 03:04PM |
Registered: 10 years ago Posts: 615 |
Quote
Tan
I am looking for 4 indicators. One that can plot the previous day high and previous day low and the pivot point (previous day high + low + close)/3 with alerts. Second indicator that can plot 5 minute open range high and low with alerts. Third indicator to plot the ten day high and the ten day low. Fourth indicator to display ADX of SPY on the upper TOS chart in green button if 20 or more and in red if less than 20. I am looking for audible alert with a written message with symbol name...
#Plot opening range high / low input OpenRangeMinutes = 5; input MarketOpenTime = 0930; input ShowTodayOnly = yes; def Today = if GetDay() == GetLastDay() then 1 else 0; def FirstMinute = if SecondsFromTime(MarketOpenTime) < 60 then 1 else 0; def OpenRangeTime = if SecondsFromTime(MarketOpenTime) < 60 * OpenRangeMinutes then 1 else 0; def ORHigh = if FirstMinute then high else if OpenRangeTime and high > ORHigh[1] then high else ORHigh[1]; def ORLow = if FirstMinute then low else if OpenRangeTime and low < ORLow[1] then low else ORLow[1]; plot OpenRangeHigh = if ShowTodayOnly and !Today then Double.NaN else if !OpenRangeTime then ORHigh else Double.NaN; plot OpenRangeLow = if ShowTodayOnly and !Today then Double.NaN else if !OpenRangeTime then ORLow else Double.NaN; OpenRangeHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); OpenRangeHigh.SetDefaultColor(Color.CYAN); OpenRangeLow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); OpenRangeLow.SetDefaultColor(Color.PINK); #Plot yesterday's high / low plot Yhigh = if ShowTodayOnly and !Today then Double.NaN else high(period = "day" )[1]; plot Ylow = if ShowTodayOnly and !Today then Double.NaN else low(period = "day" )[1]; Yhigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); Yhigh.SetDefaultColor(Color.UPTICK); Yhigh.SetLineWeight(2); Ylow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); Ylow.SetDefaultColor(Color.DOWNTICK); Ylow.SetLineWeight(2); #Plot pivot plot Pivot = if ShowTodayOnly and !Today then Double.NaN else (high(period = "day" )[1] + low(period = "day" )[1] + close(period = "day" )[1]) / 3; Pivot.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); Pivot.SetDefaultColor(Color.YELLOW); Pivot.SetLineWeight(2); #Plot 10 day high / low plot TenHigh = if ShowTodayOnly and !Today then Double.NaN else Highest(high(period = "day" )[1], 10); plot TenLow = if ShowTodayOnly and !Today then Double.NaN else Lowest(low(period = "day" )[1], 10); TenHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); TenHigh.SetDefaultColor(Color.UPTICK); TenHigh.SetLineWeight(3); TenLow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); TenLow.SetDefaultColor(Color.DOWNTICK); TenLow.SetLineWeight(3); #Calculate 2 min ATR input ATRLength = 14; def ATR = WildersAverage(TrueRange(high, close, low), ATRLength); #Define long signals def AboveYhigh = close >= Yhigh + ATR; def AbovePivot = close >= Pivot + ATR; def AboveORHigh = close >= ORHigh + ATR; #Define short signals def BelowYlow = close <= Ylow - ATR; def BelowPivot = close <= Pivot - ATR; def BelowORLow = close <= ORLow - ATR; #Trigger alerts Alert(AboveYhigh and !AboveYhigh[1], Concat(GetSymbolPart(), " above yesterday's high." ), Alert.BAR, Sound.Chimes); Alert(AbovePivot and !AbovePivot[1], Concat(GetSymbolPart(), " above pivot point." ), Alert.BAR, Sound.Chimes); Alert(AboveORHigh and !AboveORHigh[1], Concat(GetSymbolPart(), " above opening range high." ), Alert.BAR, Sound.Chimes); Alert(BelowYlow and !BelowYlow[1], Concat(GetSymbolPart(), " below yesterday's low." ), Alert.BAR, Sound.Chimes); Alert(BelowPivot and !BelowPivot[1], Concat(GetSymbolPart(), " below pivot point." ), Alert.BAR, Sound.Chimes); Alert(BelowORLow and !BelowORLow[1], Concat(GetSymbolPart(), " below opening range low." ), Alert.BAR, Sound.Chimes); #Display SPY ADX value in a box input symbol = "SPY"; input ADX_length = 14; def h = high(symbol); def l = low(symbol); def c = close(symbol); def hiDiff = h - h[1]; def loDiff = l[1] - l; def plusDM = if hiDiff > loDiff and hiDiff > 0 then hiDiff else 0; def minusDM = if loDiff > hiDiff and loDiff > 0 then loDiff else 0; def ATR2 = WildersAverage(TrueRange(h, c, l), ADX_length); def "DI+" = 100 * WildersAverage(plusDM, ADX_length) / ATR2; def "DI-" = 100 * WildersAverage(minusDM, ADX_length) / ATR2; def DX = if ("DI+" + "DI-" > 0) then 100 * AbsValue("DI+" - "DI-" ) / ("DI+" + "DI-" ) else 0; def AltSymbolADX = WildersAverage(DX, ADX_length); def ADXred = if AltSymbolADX < 20 then 1 else 0; def ADXgreen = if AltSymbolADX >= 20 then 1 else 0; AddLabel(ADXred, Concat("SPY ADX = ", AltSymbolADX), Color.DOWNTICK); AddLabel(ADXgreen, Concat("SPY ADX = ", AltSymbolADX), Color.UPTICK);
Re: Fun with ThinkScript March 16, 2014 05:53PM |
Registered: 12 years ago Posts: 321 |
Re: Fun with ThinkScript March 16, 2014 07:30PM |
Registered: 10 years ago Posts: 615 |
Quote
MTUT
This trading thought process sounds similar to one presented by The Rumpled One. If so, I would be interested in hearing more details such as a stock list that might work here.
Re: Fun with ThinkScript March 17, 2014 06:23PM |
Registered: 10 years ago Posts: 143 |
Re: Fun with ThinkScript March 17, 2014 07:19PM |
Registered: 10 years ago Posts: 143 |
Re: Fun with ThinkScript March 17, 2014 07:20PM |
Registered: 10 years ago Posts: 63 |
Re: Fun with ThinkScript March 17, 2014 07:24PM |
Registered: 10 years ago Posts: 143 |