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

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

// Almost lol
no_rep(_symbol, _res, _src) =>
    request.security(_symbol, _res, _src[barstate.isrealtime ? 1:0], barmerge.gaps_off, barmerge.lookahead_off)


//Heiken Ashi
isHA            = input.bool(title="Heikin Ashi Ticker", defval=false)
tf              = input.timeframe(title="Timeframe",     defval="60")
bull_color      = input.color(title="Bull Candle Color", defval=color.blue)
bear_color      = input.color(title="Bear Candle Color", defval=color.orange)
show_Wick       = input.bool(title="Show Wick",          defval=false)
wick_color      = input.color(title="Candle Wick Color", defval=color.black)

bull_transp     = input.int(title="bull",                defval=90,  minval=0, maxval=100, step=5, group="Color Transparency")
bear_tranp      = input.int(title="bear",                defval=90,  minval=0, maxval=100, step=5, group="Color Transparency")
wick_tranp      = input.int(title="wick",                defval=90,  minval=0, maxval=100, step=5, group="Color Transparency")

int transp = show_Wick ? wick_tranp : 100

bull_candle     = color.new(bull_color, bull_transp)
bear_candle     = color.new(bear_color, 90)
wick            = color.new(wick_color, transp)

ticker          = isHA ? ticker.heikinashi(syminfo.ticker) : syminfo.ticker

o               = no_rep(ticker, tf, open)
h               = no_rep(ticker, tf, high)
l               = no_rep(ticker, tf, low)
c               = no_rep(ticker, tf, close)

candle_color    = c > o ? bull_candle : bear_candle

plotcandle(o, h, l, c, "TF", candle_color, wick)
