OPEN-SOURCE SCRIPT
BTC/USDT/BTC.D Correlation Signal

//version=5
indicator("BTC/USDT/BTC.D Correlation Signal", overlay=true)
// Fetch USDT Dominance data from the "USDT.D" symbol.
// Note: You may need to change the symbol source depending on your data provider (e.g., "BINANCE:USDT.D" or "TVC:USDT.D").
usdtDominance = request.security("TVC:USDT.D", timeframe.period, close)
// Fetch Bitcoin Dominance data from the "BTC.D" symbol.
// Note: You may need to change the symbol source depending on your data provider (e.g., "BINANCE:BTC.D" or "TVC:BTC.D").
btcDominance = request.security("TVC:BTC.D", timeframe.period, close)
// Use a long-term Exponential Moving Average (EMA) to smooth out the data and identify trends.
// The EMA period can be adjusted to change the sensitivity of the signals.
int emaPeriod = 100
float emaUSDT = ta.ema(usdtDominance, emaPeriod)
float emaBTC = ta.ema(btcDominance, emaPeriod)
// Define the signal logic.
// A buy signal is triggered when BTC.D crosses above its EMA AND USDT.D crosses below its EMA.
bool buySignal = ta.crossover(btcDominance, emaBTC) and ta.crossunder(usdtDominance, emaUSDT)
// A sell signal is triggered when BTC.D crosses below its EMA AND USDT.D crosses above its EMA.
bool sellSignal = ta.crossunder(btcDominance, emaBTC) and ta.crossover(usdtDominance, emaUSDT)
// Plot the signals on the chart as shapes.
// A green triangle for a buy signal below the bar.
plotshape(buySignal, title="Buy Signal", style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small)
// A red triangle for a sell signal above the bar.
plotshape(sellSignal, title="Sell Signal", style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small)
// You can also add alert conditions.
// alertcondition(buySignal, title="Buy Alert", message="Buy signal triggered based on BTC.D and USDT.D correlation!")
// alertcondition(sellSignal, title="Sell Alert", message="Sell signal triggered based on BTC.D and USDT.D correlation!")
indicator("BTC/USDT/BTC.D Correlation Signal", overlay=true)
// Fetch USDT Dominance data from the "USDT.D" symbol.
// Note: You may need to change the symbol source depending on your data provider (e.g., "BINANCE:USDT.D" or "TVC:USDT.D").
usdtDominance = request.security("TVC:USDT.D", timeframe.period, close)
// Fetch Bitcoin Dominance data from the "BTC.D" symbol.
// Note: You may need to change the symbol source depending on your data provider (e.g., "BINANCE:BTC.D" or "TVC:BTC.D").
btcDominance = request.security("TVC:BTC.D", timeframe.period, close)
// Use a long-term Exponential Moving Average (EMA) to smooth out the data and identify trends.
// The EMA period can be adjusted to change the sensitivity of the signals.
int emaPeriod = 100
float emaUSDT = ta.ema(usdtDominance, emaPeriod)
float emaBTC = ta.ema(btcDominance, emaPeriod)
// Define the signal logic.
// A buy signal is triggered when BTC.D crosses above its EMA AND USDT.D crosses below its EMA.
bool buySignal = ta.crossover(btcDominance, emaBTC) and ta.crossunder(usdtDominance, emaUSDT)
// A sell signal is triggered when BTC.D crosses below its EMA AND USDT.D crosses above its EMA.
bool sellSignal = ta.crossunder(btcDominance, emaBTC) and ta.crossover(usdtDominance, emaUSDT)
// Plot the signals on the chart as shapes.
// A green triangle for a buy signal below the bar.
plotshape(buySignal, title="Buy Signal", style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small)
// A red triangle for a sell signal above the bar.
plotshape(sellSignal, title="Sell Signal", style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small)
// You can also add alert conditions.
// alertcondition(buySignal, title="Buy Alert", message="Buy signal triggered based on BTC.D and USDT.D correlation!")
// alertcondition(sellSignal, title="Sell Alert", message="Sell signal triggered based on BTC.D and USDT.D correlation!")
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。