• Get $30 off VIP with code SUMMER30. Ends July 27. Happy trading!

script conversion from trendview to TOS


New member
Can someone covert the following script to TOS?
thanks in advance

study(title="TW Golden Indicators", shorttitle="TW Golden Indicators", overlay=true)

src = input(close, title="Source")
length = input(20, minval=1)
mult = input(2.0, minval=0.001, maxval=50, title="StdDev")
basis = sma(src, length)
dev = mult * stdev(src, length)
upper = basis + dev
lower = basis - dev
plot(basis, "Basis", color=red, linewidth = 2, transp = 10)
p1 = plot(upper, "Upper", color=teal, linewidth = 2, transp = 10)
p2 = plot(lower, "Lower", color=teal, linewidth = 2, transp = 10)
fill(p1, p2, title = "Background of BB", color=#198787, transp=95)

inBar = low > low[1] and high < high[1]
outBar = low < low[1] and high > high[1]
holyGrail = low[1] < low[2] and high[1] > high[2] and low > low[1] and high < high[1]

//inside and outside using background highlight
barcolor (inBar == 1 ? white : na, title = "Inside Bar")
barcolor (outBar == 1 ? black : na, title = "Outside Bar")
plotshape(inBar == 1, style = shape.labelup, text = "IB", location = location.abovebar, color = white, textcolor = black)
plotshape(outBar == 1, style = shape.labeldown, text = "OB", location = location.belowbar, color = black, textcolor = white)
bgcolor (holyGrail == 1 ? yellow : na, offset = -1, title = "Holy Grail - Out Bar")
bgcolor (holyGrail == 1 ? yellow : na, title = "Holy Grail - In Bar")


Well-known member
@Laylabrador Welcome to the usethinkscript forums... Do you have a linkback to the original page the code was on as well as an image so we can see what the Study looks like...??? Those two additional items should always accompany requests... Be aware that only a very small percentage of requests are ever actually fulfilled...


Active member
@Laylabrador The top part of the code is just bollinger bands.
def inbar = low > low[1] and high < high[1];
def outbar = low < low[1] and high > high[1];
def holygrail = outbar[1] and inbar;

AddChartBubble(inbar and !holygrail, high, "IB", color.CYAN);
AddChartBubble(outbar and !holygrail[-1], high, "OB", color.MAGENTA);
AddChartBubble(holygrail, high, "Holy Grail - In Bar", color.CYAN);
AddChartBubble(holygrail[-1], low, "Holy Grail - Out Bar", color.CYAN, no);


Well-known member
@Laylabrador Looks like you got roped in by the "Holy Grail Daily" phrase on the chart... There is no Holy Grail... Looks like just Bollinger Bands and a Candle Pattern, nothing more... Have you used this indicator in Tradingview...??? The author provides no documentation on it whatsoever...


colored inside and outside bar looks interesting if someone can convert it.
Last edited:

Similar threads