PROTECTED SOURCE SCRIPT
宏观风控仪表盘:金银比 + VIX + 利差 + M2

//version=5
indicator("宏观风控仪表盘:金银比 + VIX + 利差 + M2", overlay=false)
// 获取金银比(XAUUSD / XAGUSD)
gold = request.security("OANDA:XAUUSD", "D", close)
silver = request.security("OANDA:XAGUSD", "D", close)
goldSilverRatio = gold / silver
// 获取VIX指数
vix = request.security("CBOE:VIX", "D", close)
// 获取美债收益率(10Y 与 2Y)
y10 = request.security("FRED:GS10", "W", close)
y2 = request.security("FRED:GS2", "W", close)
yieldSpread = y10 - y2
// 获取M2货币供应量(单位:十亿美元)
m2 = request.security("FRED:M2SL", "W", close)
m2_change = (m2 - m2[4]) / m2[4] * 100 // 近1个月的环比变化率(大致估算)
// 画图:金银比
plot(goldSilverRatio, title="金银比 (Gold/Silver Ratio)", color=color.orange, linewidth=2)
// 画图:VIX
plot(vix, title="VIX指数", color=color.red, linewidth=1)
// 画图:收益率差(10Y-2Y)
plot(yieldSpread, title="美债利差 (10Y-2Y)", color=color.blue, linewidth=1)
// 画图:M2 增速
plot(m2_change, title="M2月环比增速(%)", color=color.green, linewidth=1)
// 发出宏观风险提示信号(可选)
risk_alert = (goldSilverRatio > 85) and (vix > 30) and (yieldSpread < 0) and (m2_change > 0)
plotshape(risk_alert, title="买入信号", location=location.bottom, color=color.lime, style=shape.labelup, text="宏观反转")
indicator("宏观风控仪表盘:金银比 + VIX + 利差 + M2", overlay=false)
// 获取金银比(XAUUSD / XAGUSD)
gold = request.security("OANDA:XAUUSD", "D", close)
silver = request.security("OANDA:XAGUSD", "D", close)
goldSilverRatio = gold / silver
// 获取VIX指数
vix = request.security("CBOE:VIX", "D", close)
// 获取美债收益率(10Y 与 2Y)
y10 = request.security("FRED:GS10", "W", close)
y2 = request.security("FRED:GS2", "W", close)
yieldSpread = y10 - y2
// 获取M2货币供应量(单位:十亿美元)
m2 = request.security("FRED:M2SL", "W", close)
m2_change = (m2 - m2[4]) / m2[4] * 100 // 近1个月的环比变化率(大致估算)
// 画图:金银比
plot(goldSilverRatio, title="金银比 (Gold/Silver Ratio)", color=color.orange, linewidth=2)
// 画图:VIX
plot(vix, title="VIX指数", color=color.red, linewidth=1)
// 画图:收益率差(10Y-2Y)
plot(yieldSpread, title="美债利差 (10Y-2Y)", color=color.blue, linewidth=1)
// 画图:M2 增速
plot(m2_change, title="M2月环比增速(%)", color=color.green, linewidth=1)
// 发出宏观风险提示信号(可选)
risk_alert = (goldSilverRatio > 85) and (vix > 30) and (yieldSpread < 0) and (m2_change > 0)
plotshape(risk_alert, title="买入信号", location=location.bottom, color=color.lime, style=shape.labelup, text="宏观反转")
Skrip dilindungi
Skrip ini diterbitkan sebagai sumber tertutup. Akan tetapi, anda boleh menggunakannya dengan percuma dan tanpa had – ketahui lebih lanjut di sini.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip dilindungi
Skrip ini diterbitkan sebagai sumber tertutup. Akan tetapi, anda boleh menggunakannya dengan percuma dan tanpa had – ketahui lebih lanjut di sini.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.