Forex Strength Indicator
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © ThiagoSchmitz

//@version=5
indicator("Forex Strength Indicator", "FSI", explicit_plot_zorder = true)

//                                   ◢✥◣
// ╔────────────────────────────────. ■ .──────────────────────────────────────▼
// ║ ⇌ • Constants • ⇋
// ║┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈□┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
var string magroup      = "MA Settings"
var string ulgroup      = "Upper Levels Settings"
var string mainline     = "masettings"
var string llgroup      = "Lower Levels Settings"
var string levelsgroup  = "Level Settings"
var string ulinline1    = "upperinline1"
var string ulinline2    = "upperinline2"
var string ulinline3    = "upperinline3"
var string llinline1    = "lowerinline1"
var string llinline2    = "lowerinline2"
var string llinline3    = "lowerinline3"
var string cigroup      = "colors"
var string generalgroup = "Layout Settings"
var string lengthinline = "length"
var string labelStyle   = label.style_label_left
var string xloc         = xloc.bar_time
var string yloc         = yloc.price
// ║┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
// ║ ⇌ • Constants • ⇋
// ╚─────────────────────────────────...───────────────────────────────────────▲

//                                   ◢✥◣
// ╔────────────────────────────────. ■ .──────────────────────────────────────▼
// ║ ⇌ • Inputs • ⇋
// ║┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈□┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
var bool darkMode           = input.bool(true, "Dark Mode", group=generalgroup, inline=generalgroup)
var bool barColoring        = input.bool(true, "Bar Coloring", group=generalgroup, inline=generalgroup)
var float src               = input.source(close, "Source", group=magroup, inline=mainline)    
var string maType           = input.string("EMA", "Type", ["EMA", "SMA", "HMA", "RMA", "WMA", "SWMA", "Linear Regression"], group=magroup, inline=mainline)
var int period              = input.int(20, "Period", group=magroup, inline=mainline)
var int delta               = input.int(5, "Delta", group=magroup, inline=mainline)
var bool showLevels         = input.bool(true, "Show Levels", group=levelsgroup)
var int linearRegLength     = input.int(400, "Linear Reg Length", group=levelsgroup, inline=lengthinline)
var int stdevLength         = input.int(4000, "Std Dev Length", group=levelsgroup, inline=lengthinline)
var bool showUpperLevel1    = input.bool(true, "", inline=ulinline1, group=ulgroup)
var float upperLevel1       = input.float(0.618, "Level 1", inline=ulinline1, group=ulgroup)
var bool showUpperLevel2    = input.bool(true, "", inline=ulinline1, group=ulgroup)
var float upperLevel2       = input.float(1.000, "Level 2", inline=ulinline1, group=ulgroup)
var bool showUpperLevel3    = input.bool(true, "", inline=ulinline2, group=ulgroup)
var float upperLevel3       = input.float(1.618, "Level 3", inline=ulinline2, group=ulgroup)
var bool showUpperLevel4    = input.bool(true, "", inline=ulinline2, group=ulgroup)
var float upperLevel4       = input.float(2.000, "Level 4", inline=ulinline2, group=ulgroup)
var bool showUpperLevel5    = input.bool(true, "", inline=ulinline3, group=ulgroup)
var float upperLevel5       = input.float(2.618, "Level 5", inline=ulinline3, group=ulgroup)
var bool showLowerLevel1    = input.bool(true, "", inline=llinline1, group=llgroup)
var float lowerLevel1       = input.float(0.618, "Level 1", inline=llinline1, group=llgroup)
var bool showLowerLevel2    = input.bool(true, "", inline=llinline1, group=llgroup)
var float lowerLevel2       = input.float(1.000, "Level 2", inline=llinline1, group=llgroup)
var bool showLowerLevel3    = input.bool(true, "", inline=llinline2, group=llgroup)
var float lowerLevel3       = input.float(1.618, "Level 3", inline=llinline2, group=llgroup)
var bool showLowerLevel4    = input.bool(true, "", inline=llinline2, group=llgroup)
var float lowerLevel4       = input.float(2.000, "Level 4", inline=llinline2, group=llgroup)
var bool showLowerLevel5    = input.bool(true, "", inline=llinline3, group=llgroup)
var float lowerLevel5       = input.float(2.618, "Level 5", inline=llinline3, group=llgroup)
var color colorEUR          = input.color(#EC407A, "EUR", inline=cigroup, group = cigroup)
var color colorGBP          = input.color(#FFA726, "GBP", inline=cigroup, group = cigroup)
var color colorAUD          = input.color(#FFCA28, "AUD", inline=cigroup, group = cigroup)
var color colorNZD          = input.color(#66BB6A, "NZD", inline=cigroup, group = cigroup)
var color colorUSD          = input.color(#26C6DA, "USD", inline=cigroup, group = cigroup)
var color colorCAD          = input.color(#42A5F5, "CAD", inline=cigroup, group = cigroup)
var color colorCHF          = input.color(#7E57C2, "CHF", inline=cigroup, group = cigroup)
var color colorJPY          = input.color(#FF7043, "JPY", inline=cigroup, group = cigroup)
// ║┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
// ║ ⇌ • Inputs • ⇋
// ╚─────────────────────────────────...───────────────────────────────────────▲

//                                   ◢✥◣
// ╔────────────────────────────────. ■ .──────────────────────────────────────▼
// ║ ⇌ • Functions • ⇋
// ║┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈□┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
getCalc() => 
    value = switch maType
        "EMA" =>               ta.ema(close, period)
        "SMA" =>               ta.sma(close, period)
        "HMA" =>               ta.hma(close, period)
        "RMA" =>               ta.rma(close, period)
        "WMA" =>               ta.wma(close, period)
        "SWMA" =>              ta.swma(close)
        "Linear Regression" => ta.linreg(close, period, 0)
    del = value / value[delta]
    del

format(txt) => str.format("{0,number,#.###}", txt)
// ║┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
// ║ ⇌ • Functions • ⇋
// ╚─────────────────────────────────...───────────────────────────────────────▲

//                                   ◢✥◣
// ╔────────────────────────────────. ■ .──────────────────────────────────────▼
// ║ ⇌ • Requests • ⇋
// ║┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈□┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
float EURGBP = request.security("EURGBP", "", getCalc())
float EURAUD = request.security("EURAUD", "", getCalc())
float EURNZD = request.security("EURNZD", "", getCalc())
float EURUSD = request.security("EURUSD", "", getCalc())
float EURCAD = request.security("EURCAD", "", getCalc())
float EURCHF = request.security("EURCHF", "", getCalc())
float EURJPY = request.security("EURJPY", "", getCalc())
float GBPAUD = request.security("GBPAUD", "", getCalc())
float GBPNZD = request.security("GBPNZD", "", getCalc())
float GBPUSD = request.security("GBPUSD", "", getCalc())
float GBPCAD = request.security("GBPCAD", "", getCalc())
float GBPCHF = request.security("GBPCHF", "", getCalc())
float GBPJPY = request.security("GBPJPY", "", getCalc())
float AUDNZD = request.security("AUDNZD", "", getCalc())
float AUDUSD = request.security("AUDUSD", "", getCalc())
float AUDCAD = request.security("AUDCAD", "", getCalc())
float AUDCHF = request.security("AUDCHF", "", getCalc())
float AUDJPY = request.security("AUDJPY", "", getCalc())
float NZDUSD = request.security("NZDUSD", "", getCalc())
float NZDCAD = request.security("NZDCAD", "", getCalc())
float NZDCHF = request.security("NZDCHF", "", getCalc())
float NZDJPY = request.security("NZDJPY", "", getCalc())
float USDCAD = request.security("USDCAD", "", getCalc())
float USDCHF = request.security("USDCHF", "", getCalc())
float USDJPY = request.security("USDJPY", "", getCalc())
float CADCHF = request.security("CADCHF", "", getCalc())
float CADJPY = request.security("CADJPY", "", getCalc())
float CHFJPY = request.security("CHFJPY", "", getCalc())
// ║┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
// ║ ⇌ • Requests • ⇋
// ╚─────────────────────────────────...───────────────────────────────────────▲

//                                   ◢✥◣
// ╔────────────────────────────────. ■ .──────────────────────────────────────▼
// ║ ⇌ • Variables • ⇋
// ║┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈□┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
var table tab             = table.new(position.middle_right, 1, 9)
var color labelColor      = darkMode ? color.new(color.white, 40) : color.new(color.black, 40)
var color levelColor      = darkMode ? color.new(color.white, 90) : color.new(color.black, 90)
var color labelStyleColor = color.new(color.white, 99)
var label[] labelsGroup   = array.from(
       showUpperLevel1 ? label.new(time, close, format(upperLevel1), xloc, yloc, labelStyleColor, labelStyle, labelColor) : na,
       showUpperLevel2 ? label.new(time, close, format(upperLevel2), xloc, yloc, labelStyleColor, labelStyle, labelColor) : na,
       showUpperLevel3 ? label.new(time, close, format(upperLevel3), xloc, yloc, labelStyleColor, labelStyle, labelColor) : na,
       showUpperLevel4 ? label.new(time, close, format(upperLevel4), xloc, yloc, labelStyleColor, labelStyle, labelColor) : na,
       showUpperLevel5 ? label.new(time, close, format(upperLevel5), xloc, yloc, labelStyleColor, labelStyle, labelColor) : na,
       showLowerLevel1 ? label.new(time, close, format(lowerLevel1), xloc, yloc, labelStyleColor, labelStyle, labelColor) : na,
       showLowerLevel2 ? label.new(time, close, format(lowerLevel2), xloc, yloc, labelStyleColor, labelStyle, labelColor) : na,
       showLowerLevel3 ? label.new(time, close, format(lowerLevel3), xloc, yloc, labelStyleColor, labelStyle, labelColor) : na,
       showLowerLevel4 ? label.new(time, close, format(lowerLevel4), xloc, yloc, labelStyleColor, labelStyle, labelColor) : na,
       showLowerLevel5 ? label.new(time, close, format(lowerLevel5), xloc, yloc, labelStyleColor, labelStyle, labelColor) : na)
// ║┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
// ║ ⇌ • Variables • ⇋
// ╚─────────────────────────────────...───────────────────────────────────────▲

//                                   ◢✥◣
// ╔────────────────────────────────. ■ .──────────────────────────────────────▼
// ║ ⇌ • Definitions • ⇋
// ║┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈□┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
float EUR = (EURGBP * EURAUD * EURNZD * EURUSD * EURCAD * EURCHF * EURJPY) - 1
float GBP = (1 / EURGBP * GBPAUD * GBPNZD * GBPUSD * GBPCAD * GBPCHF * GBPJPY) - 1
float AUD = (1 / EURAUD * 1 / GBPAUD * AUDNZD * AUDUSD * AUDCAD * AUDCHF * AUDJPY) - 1
float NZD = (1 / EURNZD * 1 / GBPNZD * 1 / AUDNZD * NZDUSD * NZDCAD * NZDCHF * NZDJPY) - 1
float USD = (1 / EURUSD * 1 / GBPUSD * 1 / AUDUSD * 1 / NZDUSD * USDCAD * USDCHF * USDJPY) - 1
float CAD = (1 / EURCAD * 1 / GBPCAD * 1 / AUDCAD * 1 / NZDCAD * 1 / USDCAD * CADCHF * CADJPY) - 1
float CHF = (1 / EURCHF * 1 / GBPCHF * 1 / AUDCHF * 1 / NZDCHF * 1 / USDCHF * 1 / CADCHF * CHFJPY) - 1
float JPY = (1 / EURJPY * 1 / GBPJPY * 1 / AUDJPY * 1 / NZDJPY * 1 / USDJPY * 1 / CADJPY * 1 / CHFJPY) - 1
bool isEURbase = syminfo.basecurrency == "EUR"
bool isEURcurr = syminfo.currency     == "EUR"
bool isGBPbase = syminfo.basecurrency == "GBP"
bool isGBPcurr = syminfo.currency     == "GBP"
bool isAUDbase = syminfo.basecurrency == "AUD"
bool isAUDcurr = syminfo.currency     == "AUD"
bool isNZDbase = syminfo.basecurrency == "NZD"
bool isNZDcurr = syminfo.currency     == "NZD"
bool isUSDbase = syminfo.basecurrency == "USD"
bool isUSDcurr = syminfo.currency     == "USD"
bool isCADbase = syminfo.basecurrency == "CAD"
bool isCADcurr = syminfo.currency     == "CAD"
bool isCHFbase = syminfo.basecurrency == "CHF"
bool isCHFcurr = syminfo.currency     == "CHF"
bool isJPYbase = syminfo.basecurrency == "JPY"
bool isJPYcurr = syminfo.currency     == "JPY"
bool isEUR = isEURbase or isEURcurr
bool isGBP = isGBPbase or isGBPcurr
bool isAUD = isAUDbase or isAUDcurr
bool isNZD = isNZDbase or isNZDcurr
bool isUSD = isUSDbase or isUSDcurr
bool isCAD = isCADbase or isCADcurr
bool isCHF = isCHFbase or isCHFcurr
bool isJPY = isJPYbase or isJPYcurr
float activeBase = 
       isEURbase ? EUR :
       isGBPbase ? GBP : 
       isAUDbase ? AUD : 
       isNZDbase ? NZD : 
       isUSDbase ? USD : 
       isCADbase ? CAD : 
       isCHFbase ? CHF : 
       isJPYbase ? JPY : 0
float activeCurrency =
       isEURcurr ? EUR :
       isGBPcurr ? GBP : 
       isAUDcurr ? AUD : 
       isNZDcurr ? NZD : 
       isUSDcurr ? USD : 
       isCADcurr ? CAD : 
       isCHFcurr ? CHF : 
       isJPYcurr ? JPY : 0
float linearReg     = ta.linreg((activeBase + activeCurrency) / 2, linearRegLength, 0)
float stdev         = ta.stdev(linearReg, stdevLength)
float strongest = array.max(array.from(EUR, GBP, AUD, NZD, CAD, CHF, JPY))
float weakest   = array.min(array.from(EUR, GBP, AUD, NZD, CAD, CHF, JPY))
float[] levelsGroup = array.from(
       linearReg + stdev * upperLevel1 * 10, linearReg + stdev * upperLevel2 * 10,
       linearReg + stdev * upperLevel3 * 10, linearReg + stdev * upperLevel4 * 10,
       linearReg + stdev * upperLevel5 * 10, linearReg - stdev * lowerLevel1 * 10,
       linearReg - stdev * lowerLevel2 * 10, linearReg - stdev * lowerLevel3 * 10,
       linearReg - stdev * lowerLevel4 * 10, linearReg - stdev * lowerLevel5 * 10)
string EURStrength = strongest == EUR ? " ↑" : weakest == EUR ? " ↓" : " ◌"
string GBPStrength = strongest == GBP ? " ↑" : weakest == GBP ? " ↓" : " ◌"
string AUDStrength = strongest == AUD ? " ↑" : weakest == AUD ? " ↓" : " ◌"
string NZDStrength = strongest == NZD ? " ↑" : weakest == NZD ? " ↓" : " ◌"
string USDStrength = strongest == USD ? " ↑" : weakest == USD ? " ↓" : " ◌"
string CADStrength = strongest == CAD ? " ↑" : weakest == CAD ? " ↓" : " ◌"
string CHFStrength = strongest == CHF ? " ↑" : weakest == CHF ? " ↓" : " ◌"
string JPYStrength = strongest == JPY ? " ↑" : weakest == JPY ? " ↓" : " ◌"
// ║┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
// ║ ⇌ • Definitions • ⇋
// ╚─────────────────────────────────...───────────────────────────────────────▲

//                                   ◢✥◣
// ╔────────────────────────────────. ■ .──────────────────────────────────────▼
// ║ ⇌ • Table • ⇋
// ║┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈□┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
table.cell(tab, 0, 0, "EUR" + EURStrength, text_color = isEUR ? color.white : colorEUR, bgcolor = isEUR ? colorEUR : na)
table.cell(tab, 0, 1, "GBP" + GBPStrength, text_color = isGBP ? color.white : colorGBP, bgcolor = isGBP ? colorGBP : na)
table.cell(tab, 0, 2, "AUD" + AUDStrength, text_color = isAUD ? color.white : colorAUD, bgcolor = isAUD ? colorAUD : na)
table.cell(tab, 0, 3, "NZD" + NZDStrength, text_color = isNZD ? color.white : colorNZD, bgcolor = isNZD ? colorNZD : na)
table.cell(tab, 0, 4, "USD" + USDStrength, text_color = isUSD ? color.white : colorUSD, bgcolor = isUSD ? colorUSD : na)
table.cell(tab, 0, 5, "CAD" + CADStrength, text_color = isCAD ? color.white : colorCAD, bgcolor = isCAD ? colorCAD : na)
table.cell(tab, 0, 6, "CHF" + CHFStrength, text_color = isCHF ? color.white : colorCHF, bgcolor = isCHF ? colorCHF : na)
table.cell(tab, 0, 7, "JPY" + JPYStrength, text_color = isJPY ? color.white : colorJPY, bgcolor = isJPY ? colorJPY : na)
// ║┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
// ║ ⇌ • Table • ⇋
// ╚─────────────────────────────────...───────────────────────────────────────▲

//                                   ◢✥◣
// ╔────────────────────────────────. ■ .──────────────────────────────────────▼
// ║ ⇌ • Plots • ⇋
// ║┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈□┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
plot(0, "Zero Line", color.white)
plot(isEUR ? na : EUR, "EUR", color.new(colorEUR, 50))
plot(isGBP ? na : GBP, "GBP", color.new(colorGBP, 50))
plot(isAUD ? na : AUD, "AUD", color.new(colorAUD, 50))
plot(isNZD ? na : NZD, "NZD", color.new(colorNZD, 50))
plot(isUSD ? na : USD, "USD", color.new(colorUSD, 50))
plot(isCAD ? na : CAD, "CAD", color.new(colorCAD, 50))
plot(isCHF ? na : CHF, "CHF", color.new(colorCHF, 50))
plot(isJPY ? na : JPY, "JPY", color.new(colorJPY, 50))
plot(isEUR ? EUR : na, "EUR", colorEUR, 3)
plot(isGBP ? GBP : na, "GBP", colorGBP, 3)
plot(isAUD ? AUD : na, "AUD", colorAUD, 3)
plot(isNZD ? NZD : na, "NZD", colorNZD, 3)
plot(isUSD ? USD : na, "USD", colorUSD, 3)
plot(isCAD ? CAD : na, "CAD", colorCAD, 3)
plot(isCHF ? CHF : na, "CHF", colorCHF, 3)
plot(isJPY ? JPY : na, "JPY", colorJPY, 3)
plot(showLevels and showUpperLevel1 ? array.get(levelsGroup, 0) : na, "Upper Level 1", color.new(levelColor, 90))
plot(showLevels and showUpperLevel2 ? array.get(levelsGroup, 1) : na, "Upper Level 2", color.new(levelColor, 80))
plot(showLevels and showUpperLevel3 ? array.get(levelsGroup, 2) : na, "Upper Level 3", color.new(levelColor, 70))
plot(showLevels and showUpperLevel4 ? array.get(levelsGroup, 3) : na, "Upper Level 4", color.new(levelColor, 60))
plot(showLevels and showUpperLevel5 ? array.get(levelsGroup, 4) : na, "Upper Level 5", color.new(levelColor, 50))
plot(showLevels and showLowerLevel1 ? array.get(levelsGroup, 5) : na, "Lower Level 1", color.new(levelColor, 90))
plot(showLevels and showLowerLevel2 ? array.get(levelsGroup, 6) : na, "Lower Level 2", color.new(levelColor, 80))
plot(showLevels and showLowerLevel3 ? array.get(levelsGroup, 7) : na, "Lower Level 3", color.new(levelColor, 70))
plot(showLevels and showLowerLevel4 ? array.get(levelsGroup, 8) : na, "Lower Level 4", color.new(levelColor, 60))
plot(showLevels and showLowerLevel5 ? array.get(levelsGroup, 9) : na, "Lower Level 5", color.new(levelColor, 50))
barcolor(barColoring ? activeCurrency > activeBase ? color.red : color.green : na)
// ║┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
// ║ ⇌ • Plots • ⇋
// ╚─────────────────────────────────...───────────────────────────────────────▲

//                                   ◢✥◣
// ╔────────────────────────────────. ■ .──────────────────────────────────────▼
// ║ ⇌ • Updates • ⇋
// ║┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈□┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
if barstate.islast and showLevels
    for i = 0 to array.size(labelsGroup) - 1 by 1
        el = array.get(labelsGroup, i)
        if not na(el)
            label.set_xy(el, chart.right_visible_bar_time, array.get(levelsGroup, i))
// ║┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
// ║ ⇌ • Updates • ⇋
// ╚─────────────────────────────────...───────────────────────────────────────▲

//                                   ◢✥◣
// ╔────────────────────────────────. ■ .──────────────────────────────────────▼
// ║ ⇌ • Alerts • ⇋
// ║┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈□┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
alertcondition(ta.crossover(activeBase, activeCurrency), "Base/Currency Crossover")
alertcondition(ta.crossunder(activeBase, activeCurrency), "Base/Currency Crossunder")
// ║┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
// ║ ⇌ • Alerts • ⇋
// ╚─────────────────────────────────...───────────────────────────────────────▲