Custom Index
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © EsIstTurnt

//@version=5
indicator("My script")
//TimeFrame
tf      = input.timeframe(defval=''   ,title='TimeFrame '     ,group='resolution')
//Get Sources

source=input.source(close,title='Source ')
Tech   =input.bool(true,title='Include Tech?                 ')
Oil    =input.bool(true,title='Include Oil?                  ')
Payment=input.bool(true,title='Include Payment?              ')
Banks  =input.bool(true,title='Include Banks?                ')
Health =input.bool(true,title='Include Health?               ')
Manage =input.bool(true,title='Include Investment Management?')
MA     =input.bool(true,title='Show Moving Averages?')


pTech   =input.bool(false,title='Show Tech?                 ')
pOil    =input.bool(false,title='Show Oil?                  ')
pPayment=input.bool(false,title='Show Payment?              ')
pBanks  =input.bool(false,title='Show Banks?                ')
pHealth =input.bool(false,title='Show Health?               ')
pFinance =input.bool(false,title='Show Investment Management?')
GoldsPoV=input.bool(false,title='Measure in Gold?')
//=input.bool(true,title='Include ?')
//=input.bool(true,title='Include ?')

s1 =request.security(input.symbol('META') ,tf,source)//Tech
s2 =request.security(input.symbol('AMZN') ,tf,source)
s3 =request.security(input.symbol('GOOG') ,tf,source)
s4 =request.security(input.symbol('AAPL') ,tf,source)
s5 =request.security(input.symbol('NFLX') ,tf,source)
s6 =request.security(input.symbol('INDEX:BTCUSD') ,tf,source)
s7 =request.security(input.symbol('INDEX:ETHUSD') ,tf,source)
s8 =request.security(input.symbol('NVDA') ,tf,source)
s9 =request.security(input.symbol('AMD')  ,tf,source)
s10=request.security(input.symbol('INTC'),tf,source)
s11=request.security(input.symbol('XOM')  ,tf,source)//Oil
s12=request.security(input.symbol('CVX')  ,tf,source)
s13=request.security(input.symbol('USOIL') ,tf,source)
s14=request.security(input.symbol('BLK')  ,tf,source)//Finance
s15=request.security(input.symbol('BRKB'),tf,source)
s16=request.security(input.symbol('SCHW') ,tf,source)
s17=request.security(input.symbol('MA')   ,tf,source)//Payment
s18=request.security(input.symbol('V')    ,tf,source)
s19=request.security(input.symbol('PYPL') ,tf,source)
s20=request.security(input.symbol('SQ')   ,tf,source)
s21=request.security(input.symbol('JNJ')  ,tf,source)//Health
s22=request.security(input.symbol('PFE')  ,tf,source)
s23=request.security(input.symbol('AZN')  ,tf,source)
s24=request.security(input.symbol('MRK')  ,tf,source)
s25=request.security(input.symbol('BAC')  ,tf,source)//Banks
s26=request.security(input.symbol('JPM')  ,tf,source)
s27=request.security(input.symbol('WFC')  ,tf,source)
s28=request.security(input.symbol('GS')   ,tf,source)
s29=request.security(input.symbol('MS')   ,tf,source)


tech   =Tech    ?GoldsPoV?(s1+s2+s3+s4+s5+s6+s7+s8+s9+s10)/request.security('Gold',tf,source):s1+s2+s3+s4+s5+s6+s7+s8+s9+s10:0
oil    =Oil     ?GoldsPoV?(s11+s12+s13                   )/request.security('Gold',tf,source):s11+s12+s13                   :0
finance =Manage ?GoldsPoV?(s14+s15+s16                   )/request.security('Gold',tf,source):s14+s15+s16                   :0
payment=Payment ?GoldsPoV?(s17+s18+s19+s20               )/request.security('Gold',tf,source):s17+s18+s19+s20               :0
health =Health  ?GoldsPoV?(s21+s22+s23+s24               )/request.security('Gold',tf,source):s21+s22+s23+s24               :0
banks  =Banks   ?GoldsPoV?(s25+s26+s27+s28+s29           )/request.security('Gold',tf,source):s25+s26+s27+s28+s29           :0

plot_tech   =pTech   ?s1+s2+s3+s4+s5+s6+s7+s8+s9:0
plot_oil    =pOil    ?s10+s11+s12+s13:0
plot_finance =pFinance ?s13+s14+s15:0
plot_payment=pPayment?s16+s17+s18+s19:0
plot_health =pHealth ?s20+s21+s22+s23:0
plot_banks  =pBanks  ?s24+s25+s26+s27+s28:0

combine=(tech+oil+finance+payment+health+banks)
ma1=ta.sma(combine,input.int(32))
ma2=ta.sma(combine,input.int(128))
ma3=ta.sma(combine,input.int(200))
ma4=ta.linreg(combine,input.int(64),0)
ma5=ta.linreg(combine,input.int(256),0)
ma6=ta.linreg(combine,input.int(512),0)
plot(MA?ma1:na,color=#02b78c)
plot(MA?ma2:na,color=#acfb00)
plot(MA?ma3:na,color=#b07f08)
plot(MA?ma4:na,color=#00afe5)
plot(MA?ma5:na,color=#45a808)
plot(MA?ma6:na,color=#c5e606)
plot(combine             ,color=combine>combine[1]?#acfb00:#ff0000,linewidth=3)
plot(pTech?plot_tech      :na,color=color.blue,linewidth=1)
plot(pOil?plot_oil        :na,color=color.purple,linewidth=1)
plot(pFinance?plot_finance  :na,color=color.white,linewidth=1)
plot(pPayment?plot_payment:na,color=color.orange,linewidth=1)
plot(pHealth?plot_health  :na,color=color.red,linewidth=1)


