Special Time Period
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © only_fibonacci

//@version=4
study("Special Time Period",overlay=false)
res = input(title="Period", type=input.string, defval="D")
//Resolution, eg. '60' - 60 minutes, 'G' - daily, 'H' - weekly, 'A' - monthly, '5G' - 5 days, '12M' - one year, '3A' - one quarter
c=security(syminfo.tickerid,res,close) // close
o=security(syminfo.tickerid,res,open) // open
h=security(syminfo.tickerid,res,high) // high
l=security(syminfo.tickerid,res,low) // low
plotcandle(o==o[1]?na:o,h==h[1]?na:h,l==l[1]?na:l,c==c[1]?na:c,title="Candle",color=o<c?color.green:color.red,wickcolor=color.black)