topsy-turvy tousled candles
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © fikira

//@version=5
indicator('topsy-turvy tousled candles', 'tttc', overlay=false)

//
//            –––––––[ Example ]–––––––
//
//
//
//              high           --------   hi
//           |                |        |
//           |                |        |
//           |                |        |
//           |                |        |
//       --------  close       --------   cl
//      |        |                |
//      |        |                |
//      |        |                |
//      |        |      -->       |
//      |        |                |
//      |        |                |
//      |        |                |       op
//       --------  open        --------
//           |                |        |
//           |                |        |
//           |                |        |
//           |                |        |
//              low            --------   lo


float hi  = high
float cl  = math.max(open, close)
float op  = math.min(open, close)
float lo  = low

color col = close > open ? #26a69a : #ef5350

plotcandle(hi, hi, op, cl, title='top-middle', color=col, wickcolor=col, bordercolor=col)
plotcandle(lo, op, lo, op, title='bottom'    , color=col, wickcolor=col, bordercolor=col)
