Koalafied One-Time-Framing Candles
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © TJ_667

//@version=5
indicator("Koalafied OTF Candle", overlay = true)


//-------------------- INPUTS --------------------//

OTF_UP_col = input.color(color.new(color.blue, 0), "OTF Up Color")
OTF_DOWN_col = input.color(color.new(color.red, 0), "OTF Down Color")
OTF_NA_col = input.color(color.new(color.black, 100), "OTF NA Color")

_high = high
_low = low

//-------------------- CALC  --------------------//

var int OTF_C = na
OTF_C := _low > _low[1] and _high < _high[1] ? OTF_C[1] : _low > _low[1] ? 1 : _high < _high[1] ? 2 : 3

OTF_C_col = OTF_C == 1 ? OTF_UP_col : OTF_C == 2 ? OTF_DOWN_col : OTF_NA_col

//-------------------- PLOT --------------------//

barcolor(barstate.isconfirmed ? OTF_C_col : OTF_NA_col)     // Sets candle color once current bar is closed 

