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)
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。