Mohammad Navidi// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Soli_Trader1
//@version=4
study(shorttitle="Soli BB RSI ChandMom DC", title="Soli BB RSI ChandMom DC", overlay=true, resolution="")
//BB
src = input(close, "Source", type = input.source)
length = input(20, minval=1 , title = "BB Len")
mult = input(3.0, minval=0.001, maxval=50, title="BB StdDev")
basis = sma(src, length)
dev = mult * stdev(src, length)
upper = basis + dev
lower = basis - dev
offset = input(0, "BB Offset", type = input.integer, minval = -500, maxval = 500)
// plot(basis, "Basis", color=#872323, offset = offset)
p1 = plot(upper, "Upper", color=color.teal, offset = offset)
p2 = plot(lower, "Lower", color=color.teal, offset = offset)
// fill(p1, p2, title = "Background", color=color.blue)
// color.new(color.blue, 95)
//RSI
len = input(14, minval=1, title="RSI Len")
up = rma(max(change(src), 0), len)
down = rma(-min(change(src), 0), len)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
rsi_upper = input(60, minval=1, title="RSI upper")
rsi_lower = input(40, minval=1, title="RSI lower")
//Chande mom
Mom_len = input(14, minval=1)
momm = change(src)
f1(m) => m >= 0.0 ? m : 0.0
f2(m) => m >= 0.0 ? 0.0 : -m
m1 = f1(momm)
m2 = f2(momm)
sm1 = sum(m1, Mom_len)
sm2 = sum(m2, Mom_len)
percent(nom, div) => 100 * nom / div
chandeMO = percent(sm1-sm2, sm1+sm2)
mom_upper = input(50)
mom_lower = input(-50)
//DC
DC_len = input(13, minval=1)
DC_lower = lowest(DC_len)
DC_upper = highest(DC_len)
DC_basis = avg(DC_upper, DC_lower)
plot(DC_basis, "Basis", color=color.orange)
signal_buy = false
signal_sell = false
if low < lower and rsi < rsi_lower and chandeMO < mom_lower
signal_buy := true
if high > upper and rsi > rsi_upper and chandeMO > mom_upper
signal_sell := true
plot(signal_buy or signal_sell ? high : na , color=color.white, style = plot.style_circles , linewidth = 3)