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

//@version=4

study("st_own_candle")

ps = input(4, title = 'short period')
pb = input(24, title = 'long period')

cl = sma(close, ps) - sma(close, pb)
op = sma(open, ps) - sma(open, pb)
hi = sma(high, ps) - sma(high, pb)
lo = sma(low, ps) - sma(low, pb)


plotcandle(op, hi, lo, cl, title='NewCandle', color = op < cl ? color.green : color.red)