Multiple Moving Averages
// This Source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © MoonKoder

//@version=5


indicator(title = "Multiple Moving Averages", shorttitle = 'Multi Mov Avg', overlay = true)


// ======================================================
// ==                                                  ==
// ==         I N P U T    P A R A M E T E R S         ==
// ==                                                  ==
// ======================================================

// {


// Write ToolTips for User Input Parameteres
// {

ToolTip_DEMA    = "DEMA - Double Exponential Moving Average\n"
ToolTip_EMA     = "EMA  - Exponential Moving Average\n"
ToolTip_HMA     = "HMA  - Hull Moving Average\n"
ToolTip_LSMA    = "SLMA - Least Squares Moving Average\n"
ToolTip_RMA     = "RMA  - Relative Strength Moving Average\n"
ToolTip_SMA     = "SMA  - Simple Moving Average\n"
ToolTip_SMMA    = "SMMA - Smoothed Moving Average\n"
ToolTip_TEMA    = "TEMA - Triple Exponential Moving Average\n"
ToolTip_VWMA    = "VWMA - Volume Weighted Moving Average\n"
ToolTip_WMA     = "WMA  - Weighted Moving Average"

ToolTip_Enable  = "If checked, uses the current Moving Average"
ToolTip_Smooth  = ToolTip_DEMA + ToolTip_EMA + ToolTip_HMA + ToolTip_LSMA + ToolTip_RMA + ToolTip_SMA + ToolTip_SMMA + ToolTip_TEMA + ToolTip_VWMA + ToolTip_WMA
ToolTip_Period  = "Number of candles to lookback to calculate the Moving Average"
ToolTip_Source  = "Calculates the Moving Average based on selected Source"
ToolTip_Color   = "Sets the color to draw the Moving Average"
ToolTip_Resol   = "Sets the Timeframe for Moving Average"
ToolTip_Candle  = "Defines the type of candle for the source to be in study"
ToolTip_Gap     = "Determines if the plot has a gap formation or continuous shape (just valid for higher timeframes"
ToolTip_Line    = "Sets the Moving Average's line thickness"

// }


// Get User Inputs
// {

gr_MovAvg1      = "Moving Average 1"
Use_MovAvg_1    = input.bool(title = "Enable", defval = true, group = gr_MovAvg1, tooltip = ToolTip_Enable)
Smooth_MovAvg_1 = input.string(title = "Smooth", defval = "EMA", options = ["DEMA", "EMA", "HMA", "LSMA", "RMA", "SMA", "SMMA", "TEMA", "VWMA", "WMA"], group = gr_MovAvg1, tooltip = ToolTip_Smooth)
Period_MovAvg_1 = input.int(title = "Period", defval = 21, minval = 1, group = gr_MovAvg1, tooltip = ToolTip_Period)
Source_MovAvg_1 = input.source(title = "Source", defval = close, group = gr_MovAvg1, tooltip = ToolTip_Source)
Resol_MovAvg_1  = input.timeframe(title = "TimeFrame", defval = "15", group = gr_MovAvg1, tooltip = ToolTip_Resol)
Candle_MovAvg_1 = input.string(title = "Candle Type", defval = "01 - Traditional", options = ["01 - Traditional", "02 - Renko", "03 - Line Break", "04 - Kagi"], group = gr_MovAvg1, tooltip = ToolTip_Candle)
Gap_MovAvg_1    = input.bool(title = "Use Gap", defval = true, group = gr_MovAvg1, tooltip = ToolTip_Gap)
Line_MovAvg_1   = input.int(title = "Line Width", defval = 2, minval = 1, maxval = 5, group = gr_MovAvg1, tooltip = ToolTip_Line)
Color_MovAvg_1  = input.color(title = "Color", defval = color.teal, group = gr_MovAvg1, tooltip = ToolTip_Color)


gr_MovAvg2      = "Moving Average 2"
Use_MovAvg_2    = input.bool(title = "Enable", defval = true, group = gr_MovAvg2, tooltip = ToolTip_Enable)
Smooth_MovAvg_2 = input.string(title = "Smooth", defval = "EMA", options = ["DEMA", "EMA", "HMA", "LSMA", "RMA", "SMA", "SMMA", "TEMA", "VWMA", "WMA"], group = gr_MovAvg2, tooltip = ToolTip_Smooth)
Period_MovAvg_2 = input.int(title = "Period", defval = 50, minval = 1, group = gr_MovAvg2, tooltip = ToolTip_Period)
Source_MovAvg_2 = input.source(title = "Source", defval = close, group = gr_MovAvg2, tooltip = ToolTip_Source)
Resol_MovAvg_2  = input.timeframe(title = "TimeFrame", defval = "15", group = gr_MovAvg2, tooltip = ToolTip_Resol)
Candle_MovAvg_2 = input.string(title = "Candle Type", defval = "01 - Traditional", options = ["01 - Traditional", "02 - Renko", "03 - Line Break", "04 - Kagi"], group = gr_MovAvg2, tooltip = ToolTip_Candle)
Gap_MovAvg_2    = input.bool(title = "Use Gap", defval = true, group = gr_MovAvg2, tooltip = ToolTip_Gap)
Line_MovAvg_2   = input.int(title = "Line Width", defval = 2, minval = 1, maxval = 5, group = gr_MovAvg2, tooltip = ToolTip_Line)
Color_MovAvg_2  = input.color(title = "Color", defval = color.blue, group = gr_MovAvg2, tooltip = ToolTip_Color)


gr_MovAvg3      = "Moving Average 3"
Use_MovAvg_3    = input.bool(title = "Enable", defval = true, group = gr_MovAvg3, tooltip = ToolTip_Enable)
Smooth_MovAvg_3 = input.string(title = "Smooth", defval = "EMA", options = ["DEMA", "EMA", "HMA", "LSMA", "RMA", "SMA", "SMMA", "TEMA", "VWMA", "WMA"], group = gr_MovAvg3, tooltip = ToolTip_Smooth)
Period_MovAvg_3 = input.int(title = "Period", defval = 200, minval = 1, group = gr_MovAvg3, tooltip = ToolTip_Period)
Source_MovAvg_3 = input.source(title = "Source", defval = close, group = gr_MovAvg3, tooltip = ToolTip_Source)
Resol_MovAvg_3  = input.timeframe(title = "TimeFrame", defval = "15", group = gr_MovAvg3, tooltip = ToolTip_Resol)
Candle_MovAvg_3 = input.string(title = "Candle Type", defval = "01 - Traditional", options = ["01 - Traditional", "02 - Renko", "03 - Line Break", "04 - Kagi"], group = gr_MovAvg3, tooltip = ToolTip_Candle)
Gap_MovAvg_3    = input.bool(title = "Use Gap", defval = true, group = gr_MovAvg3, tooltip = ToolTip_Gap)
Line_MovAvg_3   = input.int(title = "Line Width", defval = 2, minval = 1, maxval = 5, group = gr_MovAvg3, tooltip = ToolTip_Line)
Color_MovAvg_3  = input.color(title = "Color", defval = color.red, group = gr_MovAvg3, tooltip = ToolTip_Color)


gr_MovAvg4      = "Moving Average 4"
Use_MovAvg_4    = input.bool(title = "Enable", defval = false, group = gr_MovAvg4, tooltip = ToolTip_Enable)
Smooth_MovAvg_4 = input.string(title = "Smooth", defval = "EMA", options = ["DEMA", "EMA", "HMA", "LSMA", "RMA", "SMA", "SMMA", "TEMA", "VWMA", "WMA"], group = gr_MovAvg4, tooltip = ToolTip_Smooth)
Period_MovAvg_4 = input.int(title = "Period", defval = 50, minval = 1, group = gr_MovAvg4, tooltip = ToolTip_Period)
Source_MovAvg_4 = input.source(title = "Source", defval = close, group = gr_MovAvg4, tooltip = ToolTip_Source)
Resol_MovAvg_4  = input.timeframe(title = "TimeFrame", defval = "15", group = gr_MovAvg4, tooltip = ToolTip_Resol)
Candle_MovAvg_4 = input.string(title = "Candle Type", defval = "01 - Traditional", options = ["01 - Traditional", "02 - Renko", "03 - Line Break", "04 - Kagi"], group = gr_MovAvg4, tooltip = ToolTip_Candle)
Gap_MovAvg_4    = input.bool(title = "Use Gap", defval = true, group = gr_MovAvg4, tooltip = ToolTip_Gap)
Line_MovAvg_4   = input.int(title = "Line Width", defval = 2, minval = 1, maxval = 5, group = gr_MovAvg4, tooltip = ToolTip_Line)
Color_MovAvg_4  = input.color(title = "Color", defval = color.black, group = gr_MovAvg4, tooltip = ToolTip_Color)


gr_MovAvg5      = "Moving Average 5"
Use_MovAvg_5    = input.bool(title = "Enable", defval = false, group = gr_MovAvg5, tooltip = ToolTip_Enable)
Smooth_MovAvg_5 = input.string(title = "Smooth", defval = "EMA", options = ["DEMA", "EMA", "HMA", "LSMA", "RMA", "SMA", "SMMA", "TEMA", "VWMA", "WMA"], group = gr_MovAvg5, tooltip = ToolTip_Smooth)
Period_MovAvg_5 = input.int(title = "Period", defval = 50, minval = 1, group = gr_MovAvg5, tooltip = ToolTip_Period)
Source_MovAvg_5 = input.source(title = "Source", defval = close, group = gr_MovAvg5, tooltip = ToolTip_Source)
Resol_MovAvg_5  = input.timeframe(title = "TimeFrame", defval = "15", group = gr_MovAvg5, tooltip = ToolTip_Resol)
Candle_MovAvg_5 = input.string(title = "Candle Type", defval = "01 - Traditional", options = ["01 - Traditional", "02 - Renko", "03 - Line Break", "04 - Kagi"], group = gr_MovAvg5, tooltip = ToolTip_Candle)
Gap_MovAvg_5    = input.bool(title = "Use Gap", defval = true, group = gr_MovAvg5, tooltip = ToolTip_Gap)
Line_MovAvg_5   = input.int(title = "Line Width", defval = 2, minval = 1, maxval = 5, group = gr_MovAvg5, tooltip = ToolTip_Line)
Color_MovAvg_5  = input.color(title = "Color", defval = color.black, group = gr_MovAvg5, tooltip = ToolTip_Color)


gr_MovAvg6      = "Moving Average 6"
Use_MovAvg_6    = input.bool(title = "Enable", defval = false, group = gr_MovAvg6, tooltip = ToolTip_Enable)
Smooth_MovAvg_6 = input.string(title = "Smooth", defval = "EMA", options = ["DEMA", "EMA", "HMA", "LSMA", "RMA", "SMA", "SMMA", "TEMA", "VWMA", "WMA"], group = gr_MovAvg6, tooltip = ToolTip_Smooth)
Period_MovAvg_6 = input.int(title = "Period", defval = 50, minval = 1, group = gr_MovAvg6, tooltip = ToolTip_Period)
Source_MovAvg_6 = input.source(title = "Source", defval = close, group = gr_MovAvg6, tooltip = ToolTip_Source)
Resol_MovAvg_6  = input.timeframe(title = "TimeFrame", defval = "15", group = gr_MovAvg6, tooltip = ToolTip_Resol)
Candle_MovAvg_6 = input.string(title = "Candle Type", defval = "01 - Traditional", options = ["01 - Traditional", "02 - Renko", "03 - Line Break", "04 - Kagi"], group = gr_MovAvg5, tooltip = ToolTip_Candle)
Gap_MovAvg_6    = input.bool(title = "Use Gap", defval = true, group = gr_MovAvg6, tooltip = ToolTip_Gap)
Line_MovAvg_6   = input.int(title = "Line Width", defval = 2, minval = 1, maxval = 5, group = gr_MovAvg6, tooltip = ToolTip_Line)
Color_MovAvg_6  = input.color(title = "Color", defval = color.black, group = gr_MovAvg6, tooltip = ToolTip_Color)


gr_MovAvg7      = "Moving Average 7"
Use_MovAvg_7    = input.bool(title = "Enable", defval = false, group = gr_MovAvg7, tooltip = ToolTip_Enable)
Smooth_MovAvg_7 = input.string(title = "Smooth", defval = "EMA", options = ["DEMA", "EMA", "HMA", "LSMA", "RMA", "SMA", "SMMA", "TEMA", "VWMA", "WMA"], group = gr_MovAvg7, tooltip = ToolTip_Smooth)
Period_MovAvg_7 = input.int(title = "Period", defval = 50, minval = 1, group = gr_MovAvg7, tooltip = ToolTip_Period)
Source_MovAvg_7 = input.source(title = "Source", defval = close, group = gr_MovAvg7, tooltip = ToolTip_Source)
Resol_MovAvg_7  = input.timeframe(title = "TimeFrame", defval = "15", group = gr_MovAvg7, tooltip = ToolTip_Resol)
Candle_MovAvg_7 = input.string(title = "Candle Type", defval = "01 - Traditional", options = ["01 - Traditional", "02 - Renko", "03 - Line Break", "04 - Kagi"], group = gr_MovAvg7, tooltip = ToolTip_Candle)
Gap_MovAvg_7    = input.bool(title = "Use Gap", defval = true, group = gr_MovAvg7, tooltip = ToolTip_Gap)
Line_MovAvg_7   = input.int(title = "Line Width", defval = 2, minval = 1, maxval = 5, group = gr_MovAvg7, tooltip = ToolTip_Line)
Color_MovAvg_7  = input.color(title = "Color", defval = color.blue, group = gr_MovAvg7, tooltip = ToolTip_Color)


gr_MovAvg8      = "Moving Average 8"
Use_MovAvg_8    = input.bool(title = "Enable", defval = false, group = gr_MovAvg8, tooltip = ToolTip_Enable)
Smooth_MovAvg_8 = input.string(title = "Smooth", defval = "EMA", options = ["DEMA", "EMA", "HMA", "LSMA", "RMA", "SMA", "SMMA", "TEMA", "VWMA", "WMA"], group = gr_MovAvg8, tooltip = ToolTip_Smooth)
Period_MovAvg_8 = input.int(title = "Period", defval = 50, minval = 1, group = gr_MovAvg8, tooltip = ToolTip_Period)
Source_MovAvg_8 = input.source(title = "Source", defval = close, group = gr_MovAvg8, tooltip = ToolTip_Source)
Resol_MovAvg_8  = input.timeframe(title = "TimeFrame", defval = "15", group = gr_MovAvg8, tooltip = ToolTip_Resol)
Candle_MovAvg_8 = input.string(title = "Candle Type", defval = "01 - Traditional", options = ["01 - Traditional", "02 - Renko", "03 - Line Break", "04 - Kagi"], group = gr_MovAvg8, tooltip = ToolTip_Candle)
Gap_MovAvg_8    = input.bool(title = "Use Gap", defval = true, group = gr_MovAvg8, tooltip = ToolTip_Gap)
Line_MovAvg_8   = input.int(title = "Line Width", defval = 2, minval = 1, maxval = 5, group = gr_MovAvg8, tooltip = ToolTip_Line)
Color_MovAvg_8  = input.color(title = "Color", defval = color.black, group = gr_MovAvg8, tooltip = ToolTip_Color)


gr_MovAvg9      = "Moving Average 9"
Use_MovAvg_9    = input.bool(title = "Enable", defval = false, group = gr_MovAvg9, tooltip = ToolTip_Enable)
Smooth_MovAvg_9 = input.string(title = "Smooth", defval = "EMA", options = ["DEMA", "EMA", "HMA", "LSMA", "RMA", "SMA", "SMMA", "TEMA", "VWMA", "WMA"], group = gr_MovAvg9, tooltip = ToolTip_Smooth)
Period_MovAvg_9 = input.int(title = "Period", defval = 50, minval = 1, group = gr_MovAvg9, tooltip = ToolTip_Period)
Source_MovAvg_9 = input.source(title = "Source", defval = close, group = gr_MovAvg9, tooltip = ToolTip_Source)
Resol_MovAvg_9  = input.timeframe(title = "TimeFrame", defval = "15", group = gr_MovAvg9, tooltip = ToolTip_Resol)
Candle_MovAvg_9 = input.string(title = "Candle Type", defval = "01 - Traditional", options = ["01 - Traditional", "02 - Renko", "03 - Line Break", "04 - Kagi"], group = gr_MovAvg9, tooltip = ToolTip_Candle)
Gap_MovAvg_9    = input.bool(title = "Use Gap", defval = true, group = gr_MovAvg9, tooltip = ToolTip_Gap)
Line_MovAvg_9   = input.int(title = "Line Width", defval = 2, minval = 1, maxval = 5, group = gr_MovAvg9, tooltip = ToolTip_Line)
Color_MovAvg_9  = input.color(title = "Color", defval = color.black, group = gr_MovAvg9, tooltip = ToolTip_Color)


// }


// }



// ======================================================
// ==                                                  ==
// ==    S U P P O R T     C A L C U L A T I O N S     ==
// ==                                                  ==
// ======================================================

// {


// Function to Calculate All Sort of Moving Averages
// {

Function_MovAvg(_Source, _Period, _Smooth) =>
    MovAvg_Smooth   = switch _Smooth
        "RMA" =>
            ta.rma(_Source, _Period)
        "SMA" =>
            ta.sma(_Source, _Period)
        "EMA" =>
            ta.ema(_Source, _Period)
        "WMA" =>
            ta.wma(_Source, _Period)
        "HMA" =>
            ta.hma(_Source, _Period)
        "SMMA" =>
            SMMA    = 0.0
            Sma     = ta.sma(_Source, _Period)
            SMMA    := na(SMMA[1]) ? Sma : (SMMA[1] * (_Period - 1) + _Source) / _Period
        "LSMA" =>
            LSMA = ta.linreg(_Source, _Period, 0)
        "TEMA" =>
            Ema1 = ta.ema(_Source, _Period)
            Ema2 = ta.ema(Ema1, _Period)
            Ema3 = ta.ema(Ema2, _Period)
            TEMA = 3 * (Ema1 - Ema2) + Ema3
        "DEMA" =>
            Ema1 = ta.ema(_Source, _Period)
            Ema2 = ta.ema(Ema1, _Period)
            DEMA = 2 * Ema1 - Ema2
        "VWMA" =>
            ta.vwma(_Source, _Period)

// }


// Function to Determine The Choosen Ticker Types
// {

Function_TickerType(_TickerType) =>
    if _TickerType == "01 - Current"
        syminfo.tickerid
    else if _TickerType == "02 - Heikin Ashi"
        ticker.heikinashi(syminfo.tickerid) 
    else if _TickerType == "03 - Renko"
        ticker.renko(syminfo.tickerid, "ATR", 10)  
    else if _TickerType == "04 - Line Break"
        ticker.linebreak(syminfo.tickerid, 3)
    else if _TickerType == "05 - Kagi"
        ticker.kagi(syminfo.tickerid, 3) 

// }


// }



// ======================================================
// ==                                                  ==
// ==       R E Q U E S T S     &     P L O T S        ==
// ==                                                  ==
// ======================================================

// {


// Request the Calculation for each Moving Average With Own Settings
// {

MovAvg_1_GapOn      = request.security(Function_TickerType(Candle_MovAvg_1), Resol_MovAvg_1, Function_MovAvg(Source_MovAvg_1, Period_MovAvg_1, Smooth_MovAvg_1), barmerge.gaps_on)
MovAvg_1_GapOff     = request.security(Function_TickerType(Candle_MovAvg_1), Resol_MovAvg_1, Function_MovAvg(Source_MovAvg_1, Period_MovAvg_1, Smooth_MovAvg_1), barmerge.gaps_off)
MovAvg_1            = Gap_MovAvg_1 ? MovAvg_1_GapOn : MovAvg_1_GapOff

MovAvg_2_GapOn      = request.security(Function_TickerType(Candle_MovAvg_2), Resol_MovAvg_2, Function_MovAvg(Source_MovAvg_2, Period_MovAvg_2, Smooth_MovAvg_2), barmerge.gaps_on)
MovAvg_2_GapOff     = request.security(Function_TickerType(Candle_MovAvg_2), Resol_MovAvg_2, Function_MovAvg(Source_MovAvg_2, Period_MovAvg_2, Smooth_MovAvg_2), barmerge.gaps_off)
MovAvg_2            = Gap_MovAvg_2 ? MovAvg_2_GapOn : MovAvg_2_GapOff

MovAvg_3_GapOn      = request.security(Function_TickerType(Candle_MovAvg_3), Resol_MovAvg_3, Function_MovAvg(Source_MovAvg_3, Period_MovAvg_3, Smooth_MovAvg_3), barmerge.gaps_on)
MovAvg_3_GapOff     = request.security(Function_TickerType(Candle_MovAvg_3), Resol_MovAvg_3, Function_MovAvg(Source_MovAvg_3, Period_MovAvg_3, Smooth_MovAvg_3), barmerge.gaps_off)
MovAvg_3            = Gap_MovAvg_3 ? MovAvg_3_GapOn : MovAvg_3_GapOff

MovAvg_4_GapOn      = request.security(Function_TickerType(Candle_MovAvg_4), Resol_MovAvg_4, Function_MovAvg(Source_MovAvg_4, Period_MovAvg_4, Smooth_MovAvg_4), barmerge.gaps_on)
MovAvg_4_GapOff     = request.security(Function_TickerType(Candle_MovAvg_4), Resol_MovAvg_4, Function_MovAvg(Source_MovAvg_4, Period_MovAvg_4, Smooth_MovAvg_4), barmerge.gaps_off)
MovAvg_4            = Gap_MovAvg_4 ? MovAvg_4_GapOn : MovAvg_4_GapOff

MovAvg_5_GapOn      = request.security(Function_TickerType(Candle_MovAvg_5), Resol_MovAvg_5, Function_MovAvg(Source_MovAvg_5, Period_MovAvg_5, Smooth_MovAvg_5), barmerge.gaps_on)
MovAvg_5_GapOff     = request.security(Function_TickerType(Candle_MovAvg_5), Resol_MovAvg_5, Function_MovAvg(Source_MovAvg_5, Period_MovAvg_5, Smooth_MovAvg_5), barmerge.gaps_off)
MovAvg_5            = Gap_MovAvg_5 ? MovAvg_5_GapOn : MovAvg_5_GapOff

MovAvg_6_GapOn      = request.security(Function_TickerType(Candle_MovAvg_6), Resol_MovAvg_6, Function_MovAvg(Source_MovAvg_6, Period_MovAvg_6, Smooth_MovAvg_6), barmerge.gaps_on)
MovAvg_6_GapOff     = request.security(Function_TickerType(Candle_MovAvg_6), Resol_MovAvg_6, Function_MovAvg(Source_MovAvg_6, Period_MovAvg_6, Smooth_MovAvg_6), barmerge.gaps_off)
MovAvg_6            = Gap_MovAvg_6 ? MovAvg_6_GapOn : MovAvg_6_GapOff

MovAvg_7_GapOn      = request.security(Function_TickerType(Candle_MovAvg_7), Resol_MovAvg_7, Function_MovAvg(Source_MovAvg_7, Period_MovAvg_7, Smooth_MovAvg_7), barmerge.gaps_on)
MovAvg_7_GapOff     = request.security(Function_TickerType(Candle_MovAvg_7), Resol_MovAvg_7, Function_MovAvg(Source_MovAvg_7, Period_MovAvg_7, Smooth_MovAvg_7), barmerge.gaps_off)
MovAvg_7            = Gap_MovAvg_7 ? MovAvg_7_GapOn : MovAvg_7_GapOff

MovAvg_8_GapOn      = request.security(Function_TickerType(Candle_MovAvg_8), Resol_MovAvg_8, Function_MovAvg(Source_MovAvg_8, Period_MovAvg_8, Smooth_MovAvg_8), barmerge.gaps_on)
MovAvg_8_GapOff     = request.security(Function_TickerType(Candle_MovAvg_8), Resol_MovAvg_8, Function_MovAvg(Source_MovAvg_8, Period_MovAvg_8, Smooth_MovAvg_8), barmerge.gaps_off)
MovAvg_8            = Gap_MovAvg_8 ? MovAvg_8_GapOn : MovAvg_8_GapOff

MovAvg_9_GapOn      = request.security(Function_TickerType(Candle_MovAvg_9), Resol_MovAvg_9, Function_MovAvg(Source_MovAvg_9, Period_MovAvg_9, Smooth_MovAvg_9), barmerge.gaps_on)
MovAvg_9_GapOff     = request.security(Function_TickerType(Candle_MovAvg_9), Resol_MovAvg_9, Function_MovAvg(Source_MovAvg_9, Period_MovAvg_9, Smooth_MovAvg_9), barmerge.gaps_off)
MovAvg_9            = Gap_MovAvg_9 ? MovAvg_9_GapOn : MovAvg_9_GapOff

// }





// Plot The Selected Moving Averages
// {

PlotMovAvg_1    = plot(Use_MovAvg_1 ? MovAvg_1 : na, title = "Moving Average 1", linewidth = Line_MovAvg_1, color = Color_MovAvg_1)
PlotMovAvg_2    = plot(Use_MovAvg_2 ? MovAvg_2 : na, title = "Moving Average 2", linewidth = Line_MovAvg_2, color = Color_MovAvg_2)
PlotMovAvg_3    = plot(Use_MovAvg_3 ? MovAvg_3 : na, title = "Moving Average 3", linewidth = Line_MovAvg_3, color = Color_MovAvg_3)
PlotMovAvg_4    = plot(Use_MovAvg_4 ? MovAvg_4 : na, title = "Moving Average 4", linewidth = Line_MovAvg_4, color = Color_MovAvg_4)
PlotMovAvg_5    = plot(Use_MovAvg_5 ? MovAvg_5 : na, title = "Moving Average 5", linewidth = Line_MovAvg_5, color = Color_MovAvg_5)
PlotMovAvg_6    = plot(Use_MovAvg_6 ? MovAvg_6 : na, title = "Moving Average 6", linewidth = Line_MovAvg_6, color = Color_MovAvg_6)
PlotMovAvg_7    = plot(Use_MovAvg_7 ? MovAvg_7 : na, title = "Moving Average 7", linewidth = Line_MovAvg_7, color = Color_MovAvg_7)
PlotMovAvg_8    = plot(Use_MovAvg_8 ? MovAvg_8 : na, title = "Moving Average 8", linewidth = Line_MovAvg_8, color = Color_MovAvg_8)
PlotMovAvg_9    = plot(Use_MovAvg_9 ? MovAvg_9 : na, title = "Moving Average 9", linewidth = Line_MovAvg_9, color = Color_MovAvg_9)

// }


// }



// ======================================================
// ==                                                  ==
// ==             P R O G R A M     E N D              ==
// ==                                                  ==
// ======================================================