FRED: Credit Demand vs. Actual Loan Growth (Fixed YoY)

mmccann231 · study · 23 行 · 点赞 5 · TradingView 原页

本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。

Pine Script

//@version=6
indicator("FRED: Credit Demand vs. Actual Loan Growth (Fixed YoY)", overlay=false)
 
// 1. Fetch the Data from FRED via TradingView Tickers
// DRSDCILM: Net % of banks reporting stronger corporate loan demand (Quarterly)
// BUSLOANS: Total Commercial and Industrial Loans outstanding (Weekly)
float demand_index = request.security("FRED:DRSDCILM", "D", close)
float total_loans  = request.security("FRED:BUSLOANS", "D", close)
 
// 2. Calculate YoY % Change using weekly data points (52 weeks in a year)
float loans_yoy = ta.roc(total_loans, 52)
 
// 3. Reference Zero Line
hline(0, "Zero Line", color=color.gray, linestyle=hline.style_dashed)
 
// 4. Plot the Metrics
// Demand Index plotted as a semi-transparent blue area chart
plot(demand_index, title="Net % Reporting Stronger Demand (DRSDCILM)", 
     color=color.new(color.blue, 30), linewidth=2, style=plot.style_area)
 
// Actual Loan Growth plotted as a crisp, solid orange line
plot(loans_yoy, title="Actual Corporate Loan Growth YoY % (BUSLOANS YoY)", 
     color=color.orange, linewidth=2, style=plot.style_line)

← 返回列表