[dharmatech] : Toggle Monthly Candles
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © dharmatech

//@version=5

indicator(title = "Toggle Monthly Candles", overlay = false)

toggle_jan = input.bool(defval = true)
toggle_feb = input.bool(defval = false)
toggle_mar = input.bool(defval = false)
toggle_apr = input.bool(defval = false)
toggle_may = input.bool(defval = false)
toggle_jun = input.bool(defval = false)
toggle_jul = input.bool(defval = false)
toggle_aug = input.bool(defval = false)
toggle_sep = input.bool(defval = false)
toggle_oct = input.bool(defval = false)
toggle_nov = input.bool(defval = false)
toggle_dec = input.bool(defval = false)

check() =>
     ((month(time) ==  1) and (toggle_jan)) or
     ((month(time) ==  2) and (toggle_feb)) or
     ((month(time) ==  3) and (toggle_mar)) or
     ((month(time) ==  4) and (toggle_apr)) or
     ((month(time) ==  5) and (toggle_may)) or
     ((month(time) ==  6) and (toggle_jun)) or
     ((month(time) ==  7) and (toggle_jul)) or
     ((month(time) ==  8) and (toggle_aug)) or
     ((month(time) ==  9) and (toggle_sep)) or
     ((month(time) == 10) and (toggle_oct)) or
     ((month(time) == 11) and (toggle_nov)) or
     ((month(time) == 12) and (toggle_dec))

plotcandle(
     open =check() ? open : na,
     high =check() ? high : na,
     low  =check() ? low : na,
     close=check() ? close : na,
     color=close > open ? color.green : color.red)
