OPEN-SOURCE SCRIPT
GMMG BB50 and Signals with BTC Dominance & USD

//version=5
indicator("GMMG BB50 and Signals with BTC Dominance & USD", overlay=true)
// Define Bollinger Bands
length = 50
deviations = 0.2
basis = ta.sma(close, length)
dev = deviations * ta.stdev(close, length)
upperBand = basis + dev
lowerBand = basis - dev
// Plotting Bollinger Bands
plot(basis, color=color.blue, title="BB Basis")
p1 = plot(upperBand, color=color.blue, title="Upper Band")
p2 = plot(lowerBand, color=color.blue, title="Lower Band")
// Fill between the bands
fill(p1, p2, color=color.rgb(173, 216, 230, 90), title="BB Fill")
// Determine Bullish or Bearish conditions
bullish = close > upperBand
bearish = close < lowerBand
// Calculate RSI
rsiLength = 30
rsiValue = ta.rsi(close, rsiLength)
rsiAbove50 = rsiValue > 50
// Volume calculation
lookback = input(20, "Lookback Period", tooltip="The number of previous candles to check for volume")
highestVolume = ta.highest(volume, lookback)
currentVolume = volume
bullishVolumeCond = (currentVolume >= highestVolume) and (close >= open)
bearishVolumeCond = (currentVolume >= highestVolume) and (close < open)
// Volume Status
var string volumeStatusText = "Neutral"
var color volumeBgColor = color.new(color.white, 90)
if bullishVolumeCond
volumeStatusText := "Bullish Volume"
volumeBgColor := color.new(color.green, 80)
else if bearishVolumeCond
volumeStatusText := "Bearish Volume"
volumeBgColor := color.new(color.red, 80)
else
volumeStatusText := "Neutral"
volumeBgColor := color.new(color.white, 90)
// MACD calculation
[macdLine, signalLine, _] = ta.macd(close, 12, 26, 9)
macdCrossAbove = ta.crossover(macdLine, signalLine)
macdCrossBelow = ta.crossunder(macdLine, signalLine)
var string macdStatusText = "Neutral"
var color macdBgColor = color.new(color.white, 90)
var string macdCrossoverStatus = "No Crossover"
if macdCrossAbove
macdStatusText := "MACD Bullish"
macdBgColor := color.new(color.green, 80)
macdCrossoverStatus := "Bullish Cross"
else if macdCrossBelow
macdStatusText := "MACD Bearish"
macdBgColor := color.new(color.red, 80)
macdCrossoverStatus := "Bearish Cross"
// Daily and 4H candles
[dayOpen, dayClose] = request.security(syminfo.tickerid, "D", [open, close])
isDailyBullish = dayClose > dayOpen
dailyCandleColor = isDailyBullish ? "Green" : "Red"
[hourOpen, hourClose] = request.security(syminfo.tickerid, "240", [open, close])
isHourlyBullish = hourClose > hourOpen
hourlyCandleColor = isHourlyBullish ? "Green" : "Red"
// Bitcoin Dominance and USD Index
btcDom = request.security("CRYPTOCAP:BTC.D", "D", close)
dxy = request.security("TVCD:DXY", "D", close)
plot(btcDom, title="BTC Dominance", color=color.orange)
plot(dxy, title="USD Index (DXY)", color=color.purple)
// Combined table setup and update will go here... (you can continue merging the remaining table code as needed)
indicator("GMMG BB50 and Signals with BTC Dominance & USD", overlay=true)
// Define Bollinger Bands
length = 50
deviations = 0.2
basis = ta.sma(close, length)
dev = deviations * ta.stdev(close, length)
upperBand = basis + dev
lowerBand = basis - dev
// Plotting Bollinger Bands
plot(basis, color=color.blue, title="BB Basis")
p1 = plot(upperBand, color=color.blue, title="Upper Band")
p2 = plot(lowerBand, color=color.blue, title="Lower Band")
// Fill between the bands
fill(p1, p2, color=color.rgb(173, 216, 230, 90), title="BB Fill")
// Determine Bullish or Bearish conditions
bullish = close > upperBand
bearish = close < lowerBand
// Calculate RSI
rsiLength = 30
rsiValue = ta.rsi(close, rsiLength)
rsiAbove50 = rsiValue > 50
// Volume calculation
lookback = input(20, "Lookback Period", tooltip="The number of previous candles to check for volume")
highestVolume = ta.highest(volume, lookback)
currentVolume = volume
bullishVolumeCond = (currentVolume >= highestVolume) and (close >= open)
bearishVolumeCond = (currentVolume >= highestVolume) and (close < open)
// Volume Status
var string volumeStatusText = "Neutral"
var color volumeBgColor = color.new(color.white, 90)
if bullishVolumeCond
volumeStatusText := "Bullish Volume"
volumeBgColor := color.new(color.green, 80)
else if bearishVolumeCond
volumeStatusText := "Bearish Volume"
volumeBgColor := color.new(color.red, 80)
else
volumeStatusText := "Neutral"
volumeBgColor := color.new(color.white, 90)
// MACD calculation
[macdLine, signalLine, _] = ta.macd(close, 12, 26, 9)
macdCrossAbove = ta.crossover(macdLine, signalLine)
macdCrossBelow = ta.crossunder(macdLine, signalLine)
var string macdStatusText = "Neutral"
var color macdBgColor = color.new(color.white, 90)
var string macdCrossoverStatus = "No Crossover"
if macdCrossAbove
macdStatusText := "MACD Bullish"
macdBgColor := color.new(color.green, 80)
macdCrossoverStatus := "Bullish Cross"
else if macdCrossBelow
macdStatusText := "MACD Bearish"
macdBgColor := color.new(color.red, 80)
macdCrossoverStatus := "Bearish Cross"
// Daily and 4H candles
[dayOpen, dayClose] = request.security(syminfo.tickerid, "D", [open, close])
isDailyBullish = dayClose > dayOpen
dailyCandleColor = isDailyBullish ? "Green" : "Red"
[hourOpen, hourClose] = request.security(syminfo.tickerid, "240", [open, close])
isHourlyBullish = hourClose > hourOpen
hourlyCandleColor = isHourlyBullish ? "Green" : "Red"
// Bitcoin Dominance and USD Index
btcDom = request.security("CRYPTOCAP:BTC.D", "D", close)
dxy = request.security("TVCD:DXY", "D", close)
plot(btcDom, title="BTC Dominance", color=color.orange)
plot(dxy, title="USD Index (DXY)", color=color.purple)
// Combined table setup and update will go here... (you can continue merging the remaining table code as needed)
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.