RenkoIndicator
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © jac001

//@version=5
indicator("RenkoIndicator", overlay=true)

bullish = ta.highest(high, 5) > ta.highest(high, 10)
bearish = ta.lowest(low, 5) < ta.lowest(low, 10)
marketSentiment = bullish and bearish ? "Neutral" : bullish ? "Bullish" : "Bearish"
renkoStyle =input.string(defval="ATR", title="Box size assignment method", options=["ATR","Traditional"])
boxSize = input.float(defval =14, title="Box Size")
renko_tickerid = ticker.renko(syminfo.tickerid, renkoStyle, boxSize)
[renko_open, renko_high, renko_low, renko_close] = request.security(renko_tickerid, timeframe.period, [open, high, low, close])
//plotcandle(renko_open, renko_high, renko_low, renko_close, color = renko_close > renko_open ? color.green : color.red)
plot((renko_close +renko_open)/2)
plotshape( ta.crossover(renko_close,renko_open) and close>open, title = "Buy", text = 'Buy', style = shape.labelup, location = location.belowbar, color= color.green,textcolor = color.white,  size = size.tiny)

plotshape(ta.crossunder(renko_close,renko_open) and close<open , title = "Sell", text = 'Sell', style = shape.labeldown, location = location.abovebar, color= color.red,textcolor = color.white,  size = size.tiny)

alertcondition(ta.crossover(renko_close,renko_open) and close>open, title='Buy', message='Buy')
alertcondition(ta.crossunder(renko_close,renko_open) and close<open, title='Sell', message='Sell')

