Simple Dominance Momentum Indicator
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © jrgoodland

//@version=5
indicator("Simple Dominance Momentum Indicator", format = format.percent)

dom_ema_len = input.int(21, "EMA Length", 1)
trend_ema_len = input.int(55, "Trend EMA Length", 1)
string dom_ticker = na

dom_ticker := switch syminfo.currency
    "USDT" => "USDT.D+USDC.D+DAI.D"
    "USDC" => "USDT.D+USDC.D+DAI.D"
    "DAI" => "USDT.D+USDC.D+DAI.D"
    "BTC" => "BTC.D"
    "ETH" => "ETH.D"
    "BNB" => "BNB.D"
    => na


dom = request.security(dom_ticker, timeframe.period, close, ignore_invalid_symbol = true)
dom_ema   = ta.ema(dom, dom_ema_len)
trend_ema = ta.ema(dom, trend_ema_len)

plot(na(dom_ticker) ? na : dom, "Stables Dominance", color.green)
plot(na(dom_ticker) ? na : dom_ema, "Dominance EMA", color.white)
plot(na(dom_ticker) ? na : trend_ema, "Trend EMA")

