The Hummingbird - MA Ribbon by Joe (EMA, SMA, SMMA, WMA, VWMA)
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © 2022 crypto-with-joe

// @version=5
indicator("The Hummingbird - MA Ribbon by Joe", shorttitle = "The Hummingbird v1.0", explicit_plot_zorder = true, overlay = true)

// Build Moving Average Types
ma(source, length, type) =>
    type == "EMA" ? ta.ema(source, length) :
      type == "SMA" ? ta.sma(source, length) :
      type == "SMMA (RMA)" ? ta.rma(source, length) :
      type == "WMA" ? ta.wma(source, length) :
      type == "VWMA" ? ta.vwma(source, length) :
      na

// OPTIONS
// ====================

// Moving Averages
// --------------------
ma01_type   = input.string("EMA", "MA 01", inline = "MA01", group = "====== Moving Averages ======",  options = ["EMA", "SMA", "SMMA (RMA)", "WMA", "VWMA"])
ma01_source = input(close, "Source", inline = "MA01", group = "====== Moving Averages ======")
ma01_length = input.int(5, "Length", inline = "MA01", group = "====== Moving Averages ======", minval = 1)
ma01        = ma(ma01_source, ma01_length, ma01_type)

ma02_type   = input.string("EMA", "MA 02", inline = "MA02", group = "====== Moving Averages ======",  options = ["EMA", "SMA", "SMMA (RMA)", "WMA", "VWMA"])
ma02_source = input(close, "Source", inline = "MA02", group = "====== Moving Averages ======")
ma02_length = input.int(10, "Length", inline = "MA02", group = "====== Moving Averages ======", minval = 1)
ma02        = ma(ma02_source, ma02_length, ma02_type)

ma03_type   = input.string("EMA", "MA 03", inline = "MA03", group = "====== Moving Averages ======",  options = ["EMA", "SMA", "SMMA (RMA)", "WMA", "VWMA"])
ma03_source = input(close, "Source", inline = "MA03", group = "====== Moving Averages ======")
ma03_length = input.int(15, "Length", inline = "MA03", group = "====== Moving Averages ======", minval = 1)
ma03        = ma(ma03_source, ma03_length, ma03_type)

ma04_type   = input.string("EMA", "MA 04", inline = "MA04", group = "====== Moving Averages ======",  options = ["EMA", "SMA", "SMMA (RMA)", "WMA", "VWMA"])
ma04_source = input(close, "Source", inline = "MA04", group = "====== Moving Averages ======")
ma04_length = input.int(20, "Length", inline = "MA04", group = "====== Moving Averages ======", minval = 1)
ma04        = ma(ma04_source, ma04_length, ma04_type)

ma05_type   = input.string("EMA", "MA 05", inline = "MA05", group = "====== Moving Averages ======",  options = ["EMA", "SMA", "SMMA (RMA)", "WMA", "VWMA"])
ma05_source = input(close, "Source", inline = "MA05", group = "====== Moving Averages ======")
ma05_length = input.int(25, "Length", inline = "MA05", group = "====== Moving Averages ======", minval = 1)
ma05        = ma(ma05_source, ma05_length, ma05_type)

ma06_type   = input.string("EMA", "MA 06", inline = "MA06", group = "====== Moving Averages ======",  options = ["EMA", "SMA", "SMMA (RMA)", "WMA", "VWMA"])
ma06_source = input(close, "Source", inline = "MA06", group = "====== Moving Averages ======")
ma06_length = input.int(30, "Length", inline = "MA06", group = "====== Moving Averages ======", minval = 1)
ma06        = ma(ma06_source, ma06_length, ma06_type)

ma07_type   = input.string("EMA", "MA 07", inline = "MA07", group = "====== Moving Averages ======",  options = ["EMA", "SMA", "SMMA (RMA)", "WMA", "VWMA"])
ma07_source = input(close, "Source", inline = "MA07", group = "====== Moving Averages ======")
ma07_length = input.int(35, "Length", inline = "MA07", group = "====== Moving Averages ======", minval = 1)
ma07        = ma(ma07_source, ma07_length, ma07_type)

ma08_type   = input.string("EMA", "MA 08", inline = "MA08", group = "====== Moving Averages ======",  options = ["EMA", "SMA", "SMMA (RMA)", "WMA", "VWMA"])
ma08_source = input(close, "Source", inline = "MA08", group = "====== Moving Averages ======")
ma08_length = input.int(40, "Length", inline = "MA08", group = "====== Moving Averages ======", minval = 1)
ma08        = ma(ma08_source, ma08_length, ma08_type)

ma09_type   = input.string("EMA", "MA 09", inline = "MA09", group = "====== Moving Averages ======",  options = ["EMA", "SMA", "SMMA (RMA)", "WMA", "VWMA"])
ma09_source = input(close, "Source", inline = "MA09", group = "====== Moving Averages ======")
ma09_length = input.int(45, "Length", inline = "MA09", group = "====== Moving Averages ======", minval = 1)
ma09        = ma(ma09_source, ma09_length, ma09_type)

ma10_type   = input.string("EMA", "MA 10", inline = "MA10", group = "====== Moving Averages ======", options = ["EMA", "SMA", "SMMA (RMA)", "WMA", "VWMA"])
ma10_source = input(close, "Source", inline = "MA10", group = "====== Moving Averages ======")
ma10_length = input.int(50, "Length", inline = "MA10", group = "====== Moving Averages ======", minval = 1)
ma10        = ma(ma10_source, ma10_length, ma10_type)

ma100_type = input.string("EMA", "100 MA", inline = "100 MA", group = "Fixed Moving Averages", options = ["EMA", "SMA", "SMMA (RMA)", "WMA", "VWMA"])
ma100      = ma(close, 100, ma100_type)

ma200_type = input.string("EMA", "200 MA", inline = "200 MA", group = "Fixed Moving Averages", options = ["EMA", "SMA", "SMMA (RMA)", "WMA", "VWMA"])
ma200      = ma(close, 200, ma200_type)

ma200htf_type = input.string("EMA", "200 MA HTF",  inline = "200 MA HTF", group = "Fixed Moving Averages", options = ["EMA", "SMA", "SMMA (RMA)", "WMA", "VWMA"])
ma200htf_tf   = input.timeframe(defval = "60", title="Timeframe", inline = "200 MA HTF", group = "Fixed Moving Averages")
ma200htf      = ma(close, 200, ma200_type)
ma200htf_smoothstep = input.bool(false, title="Smooth", inline = "200 MA HTF")
ma200htf_smooth = request.security(syminfo.tickerid, ma200htf_tf, ma200htf, barmerge.gaps_on, barmerge.lookahead_off)
ma200htf_step = request.security(syminfo.tickerid, ma200htf_tf, ma200htf, barmerge.gaps_off, barmerge.lookahead_off)

// Plots
// ================

// Plot MA's
plot(ma01,    color = color.aqua,    title = "MA 01", linewidth = 1, editable = true)
plot(ma02,    color = color.blue,    title = "MA 02", linewidth = 1, editable = true)
plot(ma03,    color = color.teal,    title = "MA 03", linewidth = 1, editable = true)
plot(ma04,    color = color.green,   title = "MA 04", linewidth = 1, editable = true)
plot(ma05,    color = color.lime,    title = "MA 05", linewidth = 1, editable = true)
plot(ma06,    color = color.yellow,  title = "MA 06", linewidth = 1, editable = true)
plot(ma07,    color = color.orange,  title = "MA 07", linewidth = 1, editable = true)
plot(ma08,    color = color.purple,  title = "MA 08", linewidth = 1, editable = true)
plot(ma09,    color = color.fuchsia, title = "MA 09", linewidth = 1, editable = true)
plot(ma10,    color = color.red,     title = "MA 10", linewidth = 1, editable = true)

plot(ma100,   color = #b2b5be, title = "100 MA",       linewidth = 2, editable = true)

plot(ma200,   color = #ffffff, title = "200 MA",       linewidth = 3,                          editable = true)
plot(ma200,   color = #ff1c15, title = "200 MA (2nd)", linewidth = 1, style = plot.style_line, editable = true)

plot(ma200htf_smoothstep ? ma200htf_smooth : ma200htf_step, color = #ff1c15, title = "200 MA HTF",       linewidth = 3,                          editable = true)
plot(ma200htf_smoothstep ? ma200htf_smooth : ma200htf_step, color = #ffffff, title = "200 MA HTF (2nd)", linewidth = 1, style = plot.style_line, editable = true)
