The Godfather
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © JOJOGLO
//@version=5
indicator("The Godfather", "ABBA", overlay=true)
useColorUp = input(color.rgb(28, 139, 230),    title = "UP")
useColorDn = input(color.rgb(224, 67, 67),     title = "DN")
useColorIk = input(color.new(color.black,15),    title = "WI")
useColorDr = input(color.new(color.black,15),    title = "BO")
useMA = input(88,  title = "MA")
//-----OLHCRange-----//
h = high
l = low
c = close
o = c[1]
r = (ta.highest(h,3) + ta.lowest(l,3) ) / 2
//----AM-BETTER-MA-----//
ma0 = (ta.sma(hlc3,3) + ta.sma(hlc3,4)[3] + (ta.sma(open, 16) + ta.sma(open, 19)[3]) ) / 4
sig = ta.lowest(ma0, 2) < ma0 ? color.rgb(28, 139, 230,0) : ta.highest(ma0,2) > ma0 ? color.new(color.red,0) : color.new(color.black,0)
//-----RSI-----//
rsiLine = ta.rsi(c, 7)
//-----SHOW-RSI-FLIPS-----//
upCon1 = rsiLine[1] <= 50 and rsiLine > 50
dnCon1 = rsiLine[1] > 50 and rsiLine <= 50
sigCon = upCon1 or dnCon1
upClr1 = color.new(color.blue,72)
dnClr1 = color.new(color.blue,72)
//-----CANDLE-COLOR-----//
sig2up = sigCon[2] and c[2] < c
sig3up = sigCon[3] and c[3] < c
sig2dn = sigCon[2] and c[2] > c
sig3dn = sigCon[3] and c[3] > c
signal = r < ma0 ? "dn" : r > ma0 ? "up" : "none"
signal := sig2up  or sig3up ? "up" : signal
signal := sig2dn  or sig3dn ? "dn" : signal
signal := not sig2up and not sig2dn and not sig3up and not sig3dn and sigCon[1] and ma0 < c ? "up" : signal
signal := not sig2up and not sig2dn and not sig3up and not sig3dn and sigCon[1] and ma0 > c ? "dn" : signal
///-----FINISHING-TOUCHES------///
plot(ma0, color = color.new(sig,useMA), style = plot.style_line, linewidth = 3,editable = false)
plotshape(upCon1, style = shape.triangleup, location = location.abovebar, color = upClr1,editable = false)
plotshape(dnCon1, style = shape.triangledown, location = location.belowbar, color = dnClr1,editable = false)
transpStamp = c[1] > c ? 0 : 50
palette = signal == "up" ? color.new(useColorUp,transpStamp) : signal == "dn" ? color.new(useColorDn,transpStamp) : signal == "none" ? color.new(color.yellow,transpStamp) : color.new(color.fuchsia,transpStamp)
plotcandle(o,h,l,c, color = color.new(palette, transpStamp), wickcolor = useColorIk , bordercolor = useColorDr, editable = false)
