PHP Code:
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © InvestorUnknown | TRW: @Andrej S.
// {||}
// , {||}
// ,,,,, {||}
// ,,,,, , ,, {||}
// , ,,,, , ,, ,,, {||}
// . , , ,,,, , ,,,, .,, {||} ╔╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╗
// ,, , ,, ,,,,,,, , , , {||} ╠╬╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╬╣
// ,, ,, , ,, ,,,,,, ,,,, , , {||} ╠╣ /$$$$$$ /$$ ╠╣
// ., , ,,, ,,,,,,,,,,,,,, ,, ,, , , ,, {||} ╠╣ |_ $$_/ | $$ ╠╣
// , . ,, ,,,,,,,,,,,,, , ,,, , ,, , , {||} ╠╣ | $$ /$$$$$$$ /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ ╠╣
// ,, ,,, ,,,,,,,,,,,,,,,,,,,,,, ,,, ,, {||} ╠╣ | $$ | $$__ $$| $$ /$$//$$__ $$ /$$_____/|_ $$_/ /$$__ $$ /$$__ $$ ╠╣
// , , ,,, .,,,,,,,,,,,, ,,, ,,,,,,,, ,,, ,, {||} ╠╣ | $$ | $$ \ $$ \ $$/$$/| $$$$$$$$| $$$$$$ | $$ | $$ \ $$| $$ \__/ ╠╣
// ., , ,, ,, ,,, ,,,,,,, ,, ,,, ,,,,, ,,, , ,, ,, {||} ╠╣ | $$ | $$ | $$ \ $$$/ | $$_____/ \____ $$ | $$ /$$| $$ | $$| $$ ╠╣
// , ,,,,, , ,,,, ,, , ,,,,,,,,,,,,,,,,,,,,,, ,, ,, {||} ╠╣ /$$$$$$| $$ | $$ \ $/ | $$$$$$$ /$$$$$$$/ | $$$$/| $$$$$$/| $$ ╠╣
// . //./ /// ,,,,,,,,,,,,,,,. ,,,,,,,,,,,,,,,,,, {||} ╠╣ |______/|__/ |__/ \_/ \_______/|_______/ \___/ \______/ |__/ ╠╣
// , / ,., ,,,,,,,,,,, ,,,,,,, ,,,,,,, {||} ╠╣ ╠╣
// . ,,, ,/ ///./ ,,,.,,,,,,,,,,,,,,, ,, , , {||} ╠╣ ╠╣
// ,,,,,, //./ , / .,,.,,, ,,,,,, ,. ,,,,,,, {||} ╠╣ ╠╣
// ,,,, // *, / / ,,,,,,,,,,,, ,, ,,,,, {||} ╠╣ /$$ /$$ /$$ ╠╣
// ,, // ////.*/// / ,.,,,,,.,, ,, ,,,, ,,,,,, {||} ╠╣ | $$ | $$ | $$ ╠╣
// , ///// // , ,,,,,, ,,,, ,,,,, ,,, / /. {||} ╠╣ | $$ | $$ /$$$$$$$ | $$ /$$ /$$$$$$$ /$$$$$$ /$$ /$$ /$$ /$$$$$$$ ╠╣
// ,, , ////// ,,,,,,,,, ,,,,,,,,/ /// / // {||} ╠╣ | $$ | $$| $$__ $$| $$ /$$/| $$__ $$ /$$__ $$| $$ | $$ | $$| $$__ $$ ╠╣
// ///// .// ,,,,,, ,, ,,,, ,,, ///* //*/// {||} ╠╣ | $$ | $$| $$ \ $$| $$$$$$/ | $$ \ $$| $$ \ $$| $$ | $$ | $$| $$ \ $$ ╠╣
// // . ,, .// ,, ///, /// {||} ╠╣ | $$ | $$| $$ | $$| $$_ $$ | $$ | $$| $$ | $$| $$ | $$ | $$| $$ | $$ ╠╣
// ////// ,,,, ///// ,. , {||} ╠╣ | $$$$$$/| $$ | $$| $$ \ $$| $$ | $$| $$$$$$/| $$$$$/$$$$/| $$ | $$ ╠╣
// *///////. // / */////* {||} ╠╣ \______/ |__/ |__/|__/ \__/|__/ |__/ \______/ \_____/\___/ |__/ |__/ ╠╣
// .,, // ,,,,,,,,,, //* ,,, ////// {||} ╠╬╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╬╣
// ,,,,, ,,,,,, ,.,,,,,,, {||} ╚╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╝
// ,,,,,,,,,,,, ,, {||}
// ,,,,,,,,, {||}
// {||}
// {||}
//@version=5
indicator("Bitcoin Cycle Master [InvestorUnknown]", "Bitcoin Cycle Master", overlay = true)
// - - - - - INPUTS - - - - - //{
plot_topcap = input.bool(true, "Plot Top Cap")
plot_delta = input.bool(true, "Plot Delta Top")
plot_term = input.bool(true, "Plot Terminal Price")
plot_real = input.bool(true, "Plot Realized Price")
plot_cvdd = input.bool(true, "Plot CVDD")
plot_bala = input.bool(true, "Plot Balanced Price")
//}
// - - - - - Request.Securities - - - - - //{
f_resInMinutes() =>
_resInMinutes = timeframe.multiplier * (
timeframe.isseconds ? 1. / 60 :
timeframe.isminutes ? 1. :
timeframe.isdaily ? 60. * 24 :
timeframe.isweekly ? 60. * 24 * 7 :
timeframe.ismonthly ? 60. * 24 * 30.4375 : na)
f_resInDays() => f_resInMinutes() / 60 / 24
timeframe_divisor = f_resInDays() // Use when doing moving averages
MCR = request.security("COINMETRICS:BTC_MARKETCAPREAL","D", close)
Supply = request.security("GLASSNODE:BTC_SUPPLY", "D", close)
TV = ta.sma(request.security("GLASSNODE:BTC_TOTALVOLUME", "D", close), math.round(500 / timeframe_divisor)) //Total Volume of transfer
btc_price = request.security("INDEX:BTCUSD", "1D", close)
btc_age = request.security("INDEX:BTCUSD", "1D", bar_index + 1)
//}
// - - - - - FUNCTIONS - - - - - //{
Time_dif() =>
date = ta.valuewhen(bar_index == 0, time, 0)
sec_r = math.floor(date / 1000)
min_r = math.floor(sec_r / 60)
h_r = math.floor(min_r / 60)
d_r = math.floor(h_r / 24)
// Launch of BTC
start = timestamp(2009, 1, 3, 00, 00)
sec_rb = math.floor(start / 1000)
min_rb = math.floor(sec_rb / 60)
h_rb = math.floor(min_rb / 60)
d_rb = math.floor(h_rb / 24)
difference = d_r - d_rb
RealizedPrice() =>
MCR / Supply
AverageCap() =>
ta.cum(btc_price) / (Time_dif() + btc_age)
TopCap() =>
// To calculate Top Cap, it is first necessary to calculate Average Cap, which is the cumulative sum of Market Cap divided by the age of the market in days.
// This creates a constant time-based moving average of market cap.
// Once Average cap is calculated, those values are multiplied by 35. The result is Top Cap.
// For AverageCap the BTC price was used instead of the MC because it has more history
// (the result should have minimal if any deviation since MC would have to be divided by Supply)
AverageCap() * 35
DeltaTop() =>
// Delta Cap = Realized Cap - Average Cap
// Average Cap is explained in the Top Cap section above.
// Once Delta Cap is calculated, its values over time are then multiplied by 7. The result is Delta Top.
(RealizedPrice() - AverageCap()) * 7
CVDD() =>
// CVDD stands for Cumulative Value Coin Days Destroyed.
// Coin Days Destroyed is a term used for bitcoin to identify a value of sorts to UTXO’s (unspent transaction outputs). They can be thought of as coins moving between wallets.
(MCR - TV) / 21000000
TerminalPrice() =>
// Theory:
// Before Terminal price is calculated, it is first necessary to calculate Transferred Price.
// Transferred price takes the sum of > Coin Days Destroyed and divides it by the existing supply of bitcoin and the time it has been in circulation.
// The value of Transferred Price is then multiplied by 21. Remember that there can only ever be 21 million bitcoin mined.
// This creates a 'terminal' value as the supply is all mined, a kind of reverse supply adjustment.
// Instead of heavily weighting later behavior, it normalizes historical behavior to today. By normalizing by 21, a terminal value is created
// Unfortunately the theoretical calculation didn't produce results it should, in pinescript.
// Therefore the calculation was slightly adjusted/improvised
TransferredPrice = CVDD() / (Supply * math.log(btc_age))
tp = TransferredPrice * 210000000 * 3
BalancedPrice() =>
// It is calculated by subtracting Transferred Price from Realized Price
RealizedPrice() - (TerminalPrice() / (21 * 3))
//}
// - - - - - PLOTS - - - - - //{
plot(plot_topcap ? TopCap() : na, "Top Cap", color = color.blue, linewidth = 2)
plot(plot_delta ? DeltaTop() : na, "Delta Top", color = color.purple, linewidth = 2)
plot(plot_term ? TerminalPrice() : na, "Terminal Price", color = color.red, linewidth = 2)
plot(plot_real ? RealizedPrice() : na, "Realized Price", color = color.orange, linewidth = 2)
plot(plot_cvdd ? CVDD() : na, "CVDD", color = color.green, linewidth = 2)
plot(plot_bala ? BalancedPrice() : na, "Balanced Price", color = color.yellow, linewidth = 2)
//}
kodu...bu...
Yer İmleri