OPEN-SOURCE SCRIPT

GMMG BB50 and Signals with BTC Dominance & USD

53
//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)

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.