USDC&USDT Dominance
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © xiaolaiseanchen

//@version=5
indicator("USDC&USDT&BUSD&DAI Dominance", overlay=false)

total = input.symbol("TOTAL", "Symbol") 
usdt = input.symbol("usdt_marketcap", "Symbol")
usdc = input.symbol("usdc_marketcap", "Symbol")
busd = input.symbol("busd_marketcap", "Symbol")
dai = input.symbol("DAI_MARKETCAP","Symbol")

timeframeInput = input.timeframe("D", "Timeframe")
sourceInput = input.source(hl2, "Source")
periodInput = input(1, "Period")

usdc_d = request.security(usdc, timeframeInput, ta.sma(sourceInput, periodInput))
usdt_d = request.security(usdt, timeframeInput, ta.sma(sourceInput, periodInput))
busd_d = request.security(busd, timeframeInput, ta.sma(sourceInput, periodInput))
dai_d = request.security(dai, timeframeInput, ta.sma(sourceInput, periodInput))
total_d = request.security(total, timeframeInput, ta.sma(sourceInput, periodInput))
index = (usdc_d+usdt_d+busd_d+dai_d)/total_d

plot(index)
