Urika Confirmation Indicator
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// @version=5
//@author ApoZee 
// 
// Reference: Idea from Ichimoku and Donchian Indicators
// v01, February 2023
//
indicator(title = "Urika Confirmation Indicator", shorttitle="UCI Alert", overlay = true)

fastLength = input.int(5, title="Signal Length", minval = 1)
slowLength = input.int(15, title="Slow Length", minval = 1)


highCalc = ta.highest(high[1], slowLength)
signalCal = (ta.highest(high, fastLength) + ta.lowest(low, fastLength))/2

lowCalc = ta.lowest(low[1], slowLength)
slowCal = math.avg(highCalc, lowCalc)

//color
whiteC = color.new(#ffffff, transp = 70)
redC = color.new(#ee0800, transp = 70)

//Plotting lines
signalLine = plot(signalCal, title = "Signal Line", color = whiteC, linewidth = 2)
slowLine = plot(slowCal, title = "Slow Line", color = redC, linewidth = 2)

//fillings
fillColor = signalCal > slowCal ? color.new(#0ebb23, transp = 70) : color.new(#ee08aa, transp =70)
fill(signalLine, slowLine, color = fillColor)

xUp = ta.crossover(signalCal, slowCal)
xDn = ta.crossunder(signalCal, slowCal)

// Alert condition: DPO crosses above 0
if xUp
    alert("Buy", alert.freq_once_per_bar_close)

if xDn
    alert("Sell", alert.freq_once_per_bar_close)

plotshape(xUp, "LE", shape.triangleup, location.belowbar, color.white, size = size.tiny)
plotshape(xDn, "LE", shape.triangledown, location.abovebar, color.yellow, size = size.tiny)

//plotchar(xUp, "Long", "▲", location.bottom, color = color.green, size = size.tiny)
//plotchar(xDn, "Short", "▼", location.top,   color = color.red,  size = size.tiny)