Make Your Own Index!
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// Made by Stef @Scheplick 
// Release April 9 2022

//@version=5

indicator(title = "Make An Index", shorttitle = "Index", overlay = false)

// Inputs

weightType = input.string("Custom Weighted", "Index Type", options=["Custom Weighted"])

symbol_1     = input.bool(title='Symbol 1',  defval=true,  inline='1')
ticker_1     = input.symbol(title='',         defval='LZ',  inline='1')
weighting_1  = input.float(title='Weight',    defval=10,     inline='1') / 100.0

symbol_2     = input.bool(title='Symbol 2',  defval=true,    inline='2')
ticker_2     = input.symbol(title='',        defval='BAND',     inline='2')
weighting_2  = input.float(title='Weight',     defval=10,      inline='2') / 100.0

symbol_3     = input.bool(title='Symbol 3',  defval=true,    inline='3')
ticker_3     = input.symbol(title='',        defval='GPS',     inline='3')
weighting_3  = input.float(title='Weight',     defval=10,      inline='3') / 100.0

symbol_4     = input.bool(title='Symbol 4',  defval=true,    inline='4')
ticker_4     = input.symbol(title='',        defval='PENN',   inline='4')
weighting_4  = input.float(title='Weight',     defval=10,      inline='4') / 100.0

symbol_5     = input.bool(title='Symbol 5',  defval=true,    inline='5')
ticker_5     = input.symbol(title='',        defval='EXFY',   inline='5')
weighting_5  = input.float(title='Weight',     defval=10,      inline='5') / 100.0

symbol_6     = input.bool(title='Symbol 6',  defval=true,    inline='6')
ticker_6     = input.symbol(title='',        defval='NRDS',   inline='6')
weighting_6  = input.float(title='Weight',     defval=10,      inline='6') / 100.0

symbol_7     = input.bool(title='Symbol 7',  defval=true,    inline='7')
ticker_7     = input.symbol(title='',        defval='RDFN',   inline='7')
weighting_7  = input.float(title='Weight',     defval=10,      inline='7') / 100.0

symbol_8     = input.bool(title='Symbol 8',  defval=true,    inline='8')
ticker_8     = input.symbol(title='',        defval='ME',   inline='8')
weighting_8  = input.float(title='Weight',     defval=10,      inline='8') / 100.0

symbol_9     = input.bool(title='Symbol 9',  defval=true,    inline='9')
ticker_9     = input.symbol(title='',        defval='STNE',   inline='9')
weighting_9  = input.float(title='Weight',     defval=10,      inline='9') / 100.0

symbol_10     = input.bool(title='Symbol 10',  defval=true,    inline='10')
ticker_10     = input.symbol(title='',        defval='KLR',   inline='10')
weighting_10  = input.float(title='Weight',     defval=10,      inline='10') / 100.0

// Security

symcalc01 = symbol_1  ? request.security(ticker_2, timeframe.period, close) : 0
symcalc02 = symbol_2  ? request.security(ticker_2, timeframe.period, close) : 0
symcalc03 = symbol_3  ? request.security(ticker_3, timeframe.period, close) : 0
symcalc04 = symbol_4  ? request.security(ticker_4, timeframe.period, close) : 0
symcalc05 = symbol_5  ? request.security(ticker_5, timeframe.period, close) : 0
symcalc06 = symbol_6  ? request.security(ticker_6, timeframe.period, close) : 0
symcalc07 = symbol_7  ? request.security(ticker_7, timeframe.period, close) : 0
symcalc08 = symbol_8  ? request.security(ticker_8, timeframe.period, close) : 0
symcalc09 = symbol_9  ? request.security(ticker_9, timeframe.period, close) : 0
symcalc10 = symbol_10 ? request.security(ticker_10, timeframe.period, close) : 0

// Plot

plot(symcalc01*weighting_1+symcalc02*weighting_2+symcalc03*weighting_3+symcalc04*weighting_4+symcalc05*weighting_5+symcalc06*weighting_6+symcalc07*weighting_7+symcalc08*weighting_8+symcalc09*weighting_9+symcalc10*weighting_10)
