BTC Dominance Exclude Stablecoins(USDT, USDC, DAI)
// 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("BTC Dominance Exclude Stablecoins(USDT, USDC, DAI)", overlay=false)
// this index's goal is to show the true bitcoin dominance relative to other risky crypto assets, 
// excluding stablecoin(USDT, USDC, DAI)'s diluting effect on btc dominance.


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

btc_cap = request.security(input.symbol("BTC_MARKETCAP", "Symbol") , timeframeInput, ta.sma(sourceInput, periodInput))
crypto_cap = request.security(input.symbol("TOTAL", "Symbol") , timeframeInput, ta.sma(sourceInput, periodInput))
usdc_cap = request.security(input.symbol("USDC_MARKETCAP", "Symbol") , timeframeInput, ta.sma(sourceInput, periodInput))
usdt_cap = request.security(input.symbol("USDT_MARKETCAP", "Symbol") , timeframeInput, ta.sma(sourceInput, periodInput))
busd_cap = request.security(input.symbol("BUSD_MARKETCAP", "Symbol") , timeframeInput, ta.sma(sourceInput, periodInput))
dai_cap = request.security(input.symbol("DAI_MARKETCAP", "Symbol") , timeframeInput, ta.sma(sourceInput, periodInput))


index = btc_cap / (crypto_cap - usdc_cap - usdt_cap - busd_cap - dai_cap) *100

plot(index)
