instrument { name = 'BB BUY SELL', icon = 'indicators:MA', overlay = true } BB_length = input(14, "BB_length", input.integer, 1) BB_sdev = input(2.0, "BB_sdev", input.double, 0.001) ----BB dev = BB_sdev * stdev(close, BB_length) upperb = sma(close, BB_length) + dev medium = sma(close, BB_length) lowerb = sma(close, BB_length) - dev plot(medium, "medium", rgba(192, 23, 6, 1), 2 ) fill(lowerb, upperb, "", rgba(32, 202, 36, 0.08)) --RSI source = input(1, "Source", input.string_selection, inputs.titles) local src = inputs[source] len = input(2, "RSI Period", input.integer, 1) lowerr = input(30, "lowerr", input.double, 0, 100, 1) upperr = input(70, "upperr", input.double, 0, 100, 1) rsx = rsi(src, len) --print(rsx) -----BB+RSI Strategy --------------- showIndicator = (rsx > upperr and close > open and close[1] > open[1]) or (rsx < lowerr and close < open and close[1] < open[1]) --print(showIndicator) if showIndicator == true then sell = rsx > upperr and (close > upperb) buy = rsx < lowerr and (close < lowerb) plot_shape(sell, "sell", shape_style.arrowdown, shape_size.large, "red", shape_location.abovebar, 0, "Put", "red") plot_shape(buy, "buy", shape_style.arrowup, shape_size.large, "green", shape_location.belowbar, 0, "Call", "green") end