// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 athttps://mozilla.org/MPL/2.0/
// © rooding
//@version=6
indicator("Alt Market Index (Halving-Adjusted BTC Supply, EMA)", overlay=false)
// 비트코인 시작가 고가 저가 종가
btcOpen = request.security("BINANCE:BTCUSD", timeframe.period, open)
btcHigh = request.security("BINANCE:BTCUSD", timeframe.period, high)
btcLow = request.security("BINANCE:BTCUSD", timeframe.period, low)
btcClose = request.security("BINANCE:BTCUSD", timeframe.period, close)
// 도미넌스 시작가 고가 저가 종가
domOpen = request.security("CRYPTOCAP:BTC.D", timeframe.period, open)
domHigh = request.security("CRYPTOCAP:BTC.D", timeframe.period, high)
domLow = request.security("CRYPTOCAP:BTC.D", timeframe.period, low)
domClose = request.security("CRYPTOCAP:BTC.D", timeframe.period, close)
// 날짜 계산용 기준점
halving2020 = timestamp(2020, 5, 11, 0, 0)
halving2024 = timestamp(2024, 4, 20, 0, 0)
// 오늘 날짜
now = timenow
// 비트코인 일일 추가물량 반감기적용
days1 = (math.min(now, halving2024) - halving2020) / (1000 * 60 * 60 * 24) // 900
days2 = now > halving2024 ? (now - halving2024) / (1000 * 60 * 60 * 24) : 0 // 450
btcSupply = 18600000 + (days1 * 900) + (days2 * 450) // 2020 반감기 기준 초기 공급량 18,600,000 BTC
// 알트 시가총액
calcAltCap(price, dom) =>
btcMarketCap = price * btcSupply
altRatio = 1 - (dom / 100)
btcMarketCap * altRatio
// 알트시총 시작가 고가 저가 종가
altOpen = calcAltCap(btcOpen, domOpen)
altHigh = calcAltCap(btcHigh, domLow)
altLow = calcAltCap(btcLow, domHigh)
altClose = calcAltCap(btcClose, domClose)
// 정규화 함수 기준 100
var float base = na
if na(base) and altClose != 0
base := altClose
norm(v) =>
base != 0 and not na(base) ? v / base * 100 : na
// 정규화된 시작가 고가 저가 종가
nOpen = norm(altOpen)
nHigh = norm(altHigh)
nLow = norm(altLow)
nClose = norm(altClose)
// 캔들 출력 조건
plotcandle(nOpen, nHigh, nLow, nClose, title="Alt Market Index (Candle)", color=(nClose > nOpen ? color.green : color.red))
// EMA 이평선
ema50 = ta.ema(nClose, 50)
ema200 = ta.ema(nClose, 200)
ema300 = ta.ema(nClose, 300)
ema21 = ta.ema(nClose, 21)
plot(ema50, title="EMA 50", color=color.blue, linewidth=1)
plot(ema200, title="EMA 200", color=color.black, linewidth=1)
plot(ema300, title="EMA 300", color=color.purple, linewidth=1)
plot(ema21, title="EMA 21", color=color.red, linewidth=1)
'차트분석이야기' 카테고리의 다른 글
| 코인 시장 간단정리 (5) | 2025.08.08 |
|---|---|
| 금융시장 한주 정리. 알트코인 고르는 방법들. (4) | 2025.08.03 |
| 투자로 수익을 내는 방법을 판단하기까지. 횡보횡보 비트코인. (4) | 2025.07.31 |
| 코인 지수와 상승리듬. 장단기 금리차이 차트. (5) | 2025.07.25 |
| 코인시장과 금융시장 시황정리. (5) | 2025.07.23 |