OPEN-SOURCE SCRIPT

BTC/USDT/BTC.D Correlation Signal

142
//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!")

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.