OPEN-SOURCE SCRIPT
Bitcoin Macro Fair Value [Structural]

//version=6
indicator("Bitcoin Macro Fair Value [Structural]", overlay=true)
// --- Model Coefficients (Derived from Python Analysis 2019-2025) ---
intercept = input.float(3.156434, "Intercept")
c_m2 = input.float(0.132827, "Real M2 Coef")
c_corp = input.float(0.742593, "Corp Spread Coef")
c_hy = input.float(-0.617968, "HY Spread Coef")
c_dxy = input.float(0.009772, "DXY Coef")
c_real30 = input.float(0.713311, "Real 30Y Coef")
c_be30 = input.float(-1.059273, "Breakeven 30Y Coef")
c_slope = input.float(0.402220, "Slope 10Y-2Y Coef")
// --- Data Fetching ---
m2 = request.security("FRED:M2SL", "M", close)
cpi = request.security("FRED:CPIAUCSL", "M", close)
real_m2 = m2 / cpi
corp = request.security("FRED:BAMLC0A0CM", "D", close)
hy = request.security("FRED:BAMLH0A0HYM2", "D", close)
dxy = request.security("TVC:DXY", "D", close)
real30 = request.security("FRED:DFII30", "D", close)
nom30 = request.security("FRED:DGS30", "D", close)
be30 = nom30 - real30
nom10 = request.security("FRED:DGS10", "D", close)
nom2 = request.security("FRED:DGS2", "D", close)
slope = nom10 - nom2
// --- Calculation ---
log_fv = intercept + (c_m2 * real_m2) + (c_corp * corp) + (c_hy * hy) + (c_dxy * dxy) + (c_real30 * real30) + (c_be30 * be30) + (c_slope * slope)
fair_value = math.exp(log_fv)
plot(fair_value, "Macro Fair Value", color=color.new(color.blue, 0), linewidth=2)
indicator("Bitcoin Macro Fair Value [Structural]", overlay=true)
// --- Model Coefficients (Derived from Python Analysis 2019-2025) ---
intercept = input.float(3.156434, "Intercept")
c_m2 = input.float(0.132827, "Real M2 Coef")
c_corp = input.float(0.742593, "Corp Spread Coef")
c_hy = input.float(-0.617968, "HY Spread Coef")
c_dxy = input.float(0.009772, "DXY Coef")
c_real30 = input.float(0.713311, "Real 30Y Coef")
c_be30 = input.float(-1.059273, "Breakeven 30Y Coef")
c_slope = input.float(0.402220, "Slope 10Y-2Y Coef")
// --- Data Fetching ---
m2 = request.security("FRED:M2SL", "M", close)
cpi = request.security("FRED:CPIAUCSL", "M", close)
real_m2 = m2 / cpi
corp = request.security("FRED:BAMLC0A0CM", "D", close)
hy = request.security("FRED:BAMLH0A0HYM2", "D", close)
dxy = request.security("TVC:DXY", "D", close)
real30 = request.security("FRED:DFII30", "D", close)
nom30 = request.security("FRED:DGS30", "D", close)
be30 = nom30 - real30
nom10 = request.security("FRED:DGS10", "D", close)
nom2 = request.security("FRED:DGS2", "D", close)
slope = nom10 - nom2
// --- Calculation ---
log_fv = intercept + (c_m2 * real_m2) + (c_corp * corp) + (c_hy * hy) + (c_dxy * dxy) + (c_real30 * real30) + (c_be30 * be30) + (c_slope * slope)
fair_value = math.exp(log_fv)
plot(fair_value, "Macro Fair Value", color=color.new(color.blue, 0), linewidth=2)
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.