Skip to content

Instantly share code, notes, and snippets.

@solrevdev
Created March 31, 2023 23:38
Show Gist options
  • Select an option

  • Save solrevdev/e2f4c39f1b25401cde9b04210724c050 to your computer and use it in GitHub Desktop.

Select an option

Save solrevdev/e2f4c39f1b25401cde9b04210724c050 to your computer and use it in GitHub Desktop.
Market mobster dominance script
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © jrgoodland
// https://www.tradingview.com/script/RN1Tc7we-Simple-Dominance-Momentum-Indicator/
//@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")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment