Asset Rotation Aperture
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/

// © ColeGarner

//@version=5
indicator (title = 'Asset Rotation Aperture', shorttitle = 'Asset Rotation Aperture', format=format.percent, precision=3, scale=scale.right)
// v1.0
string  D01    =  'Feature Switch A'
string  res    =  '20'

//INPUTS
//res      =                  // '20', 'Timeframe')
oscMode    =                    D01 // 'Oscillator Mode', [D01, D02, D03])
oscLength  =                    3600 //(3600, 'Length', minval=2)
smoothing  =                    200// "Smoothing", minval = 1)
postFilter =                    true
OpacA      =                    100
OpacB      =                    12
Active_1   =  input.bool        (true, '', inline='1', group='Main')
Color_1    =  input.color       (#ffa600, '', inline='1', group='Main')
Desc_1     =  input.string      ('BITCOIN', '', inline='1', group='Main')
Symbol_1   =  input.symbol      ('BINANCE:BTCUSDT', '', inline='1', group='Main')
Active_2   =  input.bool        (true, '', inline='2', group='Main')
Color_2    =  input.color       (#05d5ff, '', inline='2', group='Main')
Desc_2     =  input.string      ('ETHEREUM', '', inline='2', group='Main')
Symbol_2   =  input.symbol      ('BINANCE:ETHUSDT', '', inline='2', group='Main')
Actv_3    =   input.bool         (true, '', inline='3', group='Main')
Colr_3    =   input.color        (#fff200, '', inline='3', group='Main')
Desc_3    =   input.string       ('BINANCE COIN', '', inline='3', group='Main')
Smbl_3    =   input.symbol       ('BINANCE:BNBUSDT', '', inline='3', group='Main')
Actv_4    =   input.bool         (true, '', inline='4', group='Main')
Colr_4    =   input.color        (#ffffff, '', inline='4', group='Main')
Desc_4    =   input.string       ('DOGE', '', inline='4', group='Main')
Smbl_4    =   input.symbol       ('BINANCE:DOGEUSDT', '', inline='4', group='Main')
Actv_5    =   input.bool         (true, '', inline='5', group='Main')
Colr_5    =   input.color        (#00ff08, '', inline='5', group='Main')
Desc_5    =   input.string       ('SOL', '', inline='5', group='Main')
Smbl_5    =   input.symbol       ('BINANCE:SOLUSDT', '', inline='5', group='Main')
Actv_6    =   input.bool         (true, '', inline='6', group='Main')
Colr_6    =   input.color        (#b1a5ff,'', inline='6', group='Main')
Desc_6    =   input.string       ('LINK', '',  inline='6', group='Main')
Smbl_6    =   input.symbol       ('BINANCE:LINKUSDT', '', inline='6', group='Main')
Actv_7    =   input.bool         (true, '',inline='7', group='Main')
Colr_7    =   input.color        (#ff7474, '', inline='7', group='Main')
Desc_7    =   input.string       ('UNI','', inline='7',group='Main')
Smbl_7    =   input.symbol       ('BINANCE:UNIUSDT', '',inline='7',group='Main')
Actv_8    =   input.bool         (true, '', inline='8', group='Main')
Colr_8    =   input.color        (#00981e, '', inline='8',group='Main')
Desc_8    =   input.string       ('RUNE','', inline='8', group='Main')
Smbl_8    =   input.symbol       ('BINANCE:RUNEUSDT', '', inline='8', group='Main')


// PROCESS
mode_selector (src, len, sel, filt) =>
    selector    =  switch sel
        D01     => ta.cmo(ta.mfi(src, len), (len/2))
    filt        ?  ta.vwma (selector, smoothing)  :  ta.ema (selector, 6)


// Symbols Oscilator
Asset_1    =  Active_1  ?  request.security( Symbol_1, res, mode_selector ( close, oscLength, oscMode, postFilter) )  :  na
Asset_2    =  Active_2  ?  request.security( Symbol_2, res, mode_selector ( close, oscLength, oscMode, postFilter) )  :  na
Asset_3    =  Actv_3  ?    request.security( Smbl_3  , res, mode_selector ( close, oscLength, oscMode, postFilter) )  :  na
Asset_4    =  Actv_4  ?    request.security( Smbl_4  , res, mode_selector ( close, oscLength, oscMode, postFilter) )  :  na
Asset_5    =  Actv_5  ?    request.security( Smbl_5  , res, mode_selector ( close, oscLength, oscMode, postFilter) )  :  na
Asset_6    =  Actv_6  ?    request.security( Smbl_6  , res, mode_selector ( close, oscLength, oscMode, postFilter) )  :  na
Asset_7    =  Actv_7  ?    request.security( Smbl_7  , res, mode_selector ( close, oscLength, oscMode, postFilter) )  :  na
Asset_8    =  Actv_8  ?    request.security( Smbl_8  , res, mode_selector ( close, oscLength, oscMode, postFilter) )  :  na



// PLOTS
zeroPlot    =  plot (0, editable=false, display=display.none)
Plot_1      =  plot (Asset_1, '', color.new (Color_1, 100 - OpacA), 1)
Fill_1      =  plot (Asset_1, '', color.new (Color_1, 100 - OpacB), 0,  plot.style_area)
Plot_2      =  plot (Asset_2, '', color.new (Color_2, 100 - OpacA), 1)
Fill_2      =  plot (Asset_2, '', color.new (Color_2, 100 - OpacB), 0,  plot.style_area)
Plot_3      =  plot (Asset_3, '', color.new (Colr_3, 100 - OpacA), 1)
Fill_3      =  plot (Asset_3, '', color.new (Colr_3, 100 - OpacB), 0,  plot.style_area)
Plot_4      =  plot (Asset_4, '', color.new (Colr_4, 100 - OpacA), 1)
Fill_4      =  plot (Asset_4, '', color.new (Colr_4, 100 - OpacB), 0,  plot.style_area)
Plot_5      =  plot (Asset_5, '', color.new (Colr_5, 100 - OpacA), 1)
Fill_5      =  plot (Asset_5, '', color.new (Colr_5, 100 - OpacB), 0,  plot.style_area)
Plot_6      =  plot (Asset_6, '', color.new (Colr_6, 100 - OpacA), 1)
Fill_6      =  plot (Asset_6, '', color.new (Colr_6, 100 - OpacB), 0,  plot.style_area)
Plot_7      =  plot (Asset_7, '', color.new (Colr_7, 100 - OpacA), 1)
Fill_7      =  plot (Asset_7, '', color.new (Colr_7, 100 - OpacB), 0,  plot.style_area)
Plot_8      =  plot (Asset_8, '', color.new (Colr_8, 100 - OpacA), 1)
Fill_8      =  plot (Asset_8, '', color.new (Colr_8, 100 - OpacB), 0,  plot.style_area)


// LABELS
var label Label_1 = Active_1 ? label.new(bar_index+8, Asset_1, Desc_1, xloc = xloc.bar_index, style=label.style_label_left, textcolor=color.black, color=Color_1, size=size.small) : na
var label Label_2 = Active_2 ? label.new(bar_index+8, Asset_2, Desc_2, xloc = xloc.bar_index, style=label.style_label_left, textcolor=color.black, color=Color_2, size=size.small) : na
var label Label_3 = Actv_3 ? label.new(bar_index+8, Asset_3, Desc_3, xloc = xloc.bar_index, style=label.style_label_left, textcolor=color.black, color=Colr_3, size=size.small) : na
var label Label_4 = Actv_4 ? label.new(bar_index+8, Asset_4, Desc_4, xloc = xloc.bar_index, style=label.style_label_left, textcolor=color.black, color=Colr_4, size=size.small) : na
var label Label_5 = Actv_5 ? label.new(bar_index+8, Asset_5, Desc_5, xloc = xloc.bar_index, style=label.style_label_left, textcolor=color.black, color=Colr_5, size=size.small) : na
var label Label_6 = Actv_6 ? label.new(bar_index+8, Asset_6, Desc_6, xloc = xloc.bar_index, style=label.style_label_left, textcolor=color.black, color=Colr_6, size=size.small) : na
var label Label_7 = Actv_7 ? label.new(bar_index+8, Asset_7, Desc_7, xloc = xloc.bar_index, style=label.style_label_left, textcolor=color.black, color=Colr_7, size=size.small) : na
var label Label_8 = Actv_8 ? label.new(bar_index+8, Asset_8, Desc_8, xloc = xloc.bar_index, style=label.style_label_left, textcolor=color.black, color=Colr_8, size=size.small) : na
label.set_xy(Label_1, bar_index+4, Asset_1)
label.set_xy(Label_2, bar_index+4, Asset_2)
label.set_xy(Label_3, bar_index+4, Asset_3)
label.set_xy(Label_4, bar_index+4, Asset_4)
label.set_xy(Label_5, bar_index+4, Asset_5)
label.set_xy(Label_6, bar_index+4, Asset_6)
label.set_xy(Label_7, bar_index+4, Asset_7)
label.set_xy(Label_8, bar_index+4, Asset_8)