OPEN-SOURCE SCRIPT
已更新 Yield Curve Widget (Nasdaq)

📊 Yield Curve Risk Widget — Nasdaq (MNQ)
🔍 What this indicator does
This indicator is a macro risk widget designed for Nasdaq (MNQ) traders.
It combines the US Treasury yield curve (10Y vs 2Y) with price confirmation from Nasdaq itself to provide a directional bias.
⚠️ This is NOT an entry signal.
It is a context and risk filter to help you decide which side of the market to prioritize.
🧠 What each element means
🔹 10Y (e.g. 4.17)
The 10-year US Treasury yield, expressed as annual percentage (%).
Tech stocks and Nasdaq are highly sensitive to the 10Y
Falling 10Y → supportive for Nasdaq
Rising 10Y → pressure on Nasdaq
🔹 2Y (e.g. 3.54)
The 2-year US Treasury yield, closely tied to Federal Reserve expectations.
🔹 Spread (10Y − 2Y)
Represents the slope of the yield curve.
Spread expanding → curve normalizing → healthier macro environment
Spread contracting → curve flattening or inverting → higher risk
🔹 10Y slope / Spread slope (▲ ▼ •)
Shows the recent direction of movement:
▲ Rising
▼ Falling
• Flat / neutral
👉 Direction matters more than absolute level.
🔹 Regime (BULL / BEAR / NEUT)
Structural interpretation of the yield curve:
BULL → rates favor risk assets
BEAR → rates pressure risk assets
NEUT → mixed macro signals
🔹 RISK ON / RISK OFF / NEUTRAL
Combination of macro (yield curve) and price confirmation (Nasdaq trend):
RISK ON
→ Favorable curve and Nasdaq above its trend EMA
RISK OFF
→ Unfavorable curve and Nasdaq below its trend EMA
NEUTRAL
→ No confirmation
🔹 Intensity (0–100)
Measures the strength of the current regime.
0–40 → weak / noisy environment
40–60 → transition phase
60–100 → strong macro regime
🔹 Trade Bias (BUY / SELL / WAIT)
This is the practical conclusion of the indicator:
BUY NASDAQ
→ Risk ON confirmed + intensity above threshold
SELL NASDAQ
→ Risk OFF confirmed + intensity above threshold
WAIT
→ Mixed conditions, no clear edge
⚠️ This is NOT a trade trigger, only a directional filter.
🎯 How to use it (the right way)
✅ Use it as a FILTER
BUY NASDAQ → prioritize long setups only
SELL NASDAQ → prioritize short setups only
WAIT → trade only A+ setups or stay flat
❌ What NOT to do
Do not enter trades solely because BUY/SELL appears
Do not ignore your own risk management rules
Do not rely on it during major news events (CPI, FOMC, NFP)
⚙️ Suggested settings (MNQ)
Day Trading (1m / 5m)
MNQ Trend EMA: 200
Slope lookback: 5–10
Min Risk Intensity: 55–65
Intraday / Swing
Yields TF: 15m or 60m
Min Risk Intensity: 60–75
🧩 Quick summary
📉 Falling rates → Nasdaq tends to rise
📈 Rising rates → Nasdaq tends to fall
🧠 Yield curve + price confirmation = directional edge
🎯 Use as a filter, not as an entry signal
Disclaimer:
This indicator provides macro context only. Always combine it with your own technical setups, execution rules, and risk management.
🔍 What this indicator does
This indicator is a macro risk widget designed for Nasdaq (MNQ) traders.
It combines the US Treasury yield curve (10Y vs 2Y) with price confirmation from Nasdaq itself to provide a directional bias.
⚠️ This is NOT an entry signal.
It is a context and risk filter to help you decide which side of the market to prioritize.
🧠 What each element means
🔹 10Y (e.g. 4.17)
The 10-year US Treasury yield, expressed as annual percentage (%).
Tech stocks and Nasdaq are highly sensitive to the 10Y
Falling 10Y → supportive for Nasdaq
Rising 10Y → pressure on Nasdaq
🔹 2Y (e.g. 3.54)
The 2-year US Treasury yield, closely tied to Federal Reserve expectations.
🔹 Spread (10Y − 2Y)
Represents the slope of the yield curve.
Spread expanding → curve normalizing → healthier macro environment
Spread contracting → curve flattening or inverting → higher risk
🔹 10Y slope / Spread slope (▲ ▼ •)
Shows the recent direction of movement:
▲ Rising
▼ Falling
• Flat / neutral
👉 Direction matters more than absolute level.
🔹 Regime (BULL / BEAR / NEUT)
Structural interpretation of the yield curve:
BULL → rates favor risk assets
BEAR → rates pressure risk assets
NEUT → mixed macro signals
🔹 RISK ON / RISK OFF / NEUTRAL
Combination of macro (yield curve) and price confirmation (Nasdaq trend):
RISK ON
→ Favorable curve and Nasdaq above its trend EMA
RISK OFF
→ Unfavorable curve and Nasdaq below its trend EMA
NEUTRAL
→ No confirmation
🔹 Intensity (0–100)
Measures the strength of the current regime.
0–40 → weak / noisy environment
40–60 → transition phase
60–100 → strong macro regime
🔹 Trade Bias (BUY / SELL / WAIT)
This is the practical conclusion of the indicator:
BUY NASDAQ
→ Risk ON confirmed + intensity above threshold
SELL NASDAQ
→ Risk OFF confirmed + intensity above threshold
WAIT
→ Mixed conditions, no clear edge
⚠️ This is NOT a trade trigger, only a directional filter.
🎯 How to use it (the right way)
✅ Use it as a FILTER
BUY NASDAQ → prioritize long setups only
SELL NASDAQ → prioritize short setups only
WAIT → trade only A+ setups or stay flat
❌ What NOT to do
Do not enter trades solely because BUY/SELL appears
Do not ignore your own risk management rules
Do not rely on it during major news events (CPI, FOMC, NFP)
⚙️ Suggested settings (MNQ)
Day Trading (1m / 5m)
MNQ Trend EMA: 200
Slope lookback: 5–10
Min Risk Intensity: 55–65
Intraday / Swing
Yields TF: 15m or 60m
Min Risk Intensity: 60–75
🧩 Quick summary
📉 Falling rates → Nasdaq tends to rise
📈 Rising rates → Nasdaq tends to fall
🧠 Yield curve + price confirmation = directional edge
🎯 Use as a filter, not as an entry signal
Disclaimer:
This indicator provides macro context only. Always combine it with your own technical setups, execution rules, and risk management.
版本注释
## ✅ Update: Fixed Timeframe Mode (Why the widget no longer changes when you switch charts)
This version uses a **fixed widget timeframe** (`Widget Timeframe`, default **60 minutes**) for **all calculations**:
* 10Y / 2Y yields
* Spread (10Y–2Y)
* Slopes (10Y slope / Spread slope)
* Risk ON/OFF confirmation
* Intensity (0–100)
* Trade Bias (BUY / SELL / WAIT)
So when you switch your chart from **5m → 1h → 4h**, the widget does **not** “recalculate to the chart timeframe” anymore.
This makes the macro read **stable and consistent**, which is the correct behavior for yield-curve context.
---
## 🔎 Why small numbers may still change slightly (this is normal)
Even with a fixed timeframe, values like:
* `Spread slope -0.01` vs `-0.03`
* `10Y slope 0.00` vs `0.01`
* Intensity moving from `39 → 12 → 7`
can change a bit **during the current (unfinished) 60-minute candle**.
That happens because the 60m candle is still updating in real time, and:
* EMA values update intrabar
* slopes near zero are sensitive to tiny moves
* rounding can display small differences as 0.00 / -0.01 / -0.03
✅ This is expected and not a bug.
The important part is that the widget is **anchored to the same timeframe** and the **core yields/spread remain consistent**.
---
## ⭐ Recommended settings: 60-minute widget timeframe
For MNQ day trading, the best default is:
* **Widget Timeframe:** `60` (1H)
### Why 60 minutes?
* Filters intraday noise from yields and curve movements
* Prevents “flip-flopping” Risk ON/OFF signals
* Captures meaningful macro regime shifts
* Lets you trade execution on **1m/5m** while keeping macro bias stable
**Rule of thumb:**
> Use **1H macro bias** (this widget) + **1m/5m execution** (your setup).
---
## 🧭 How to use Trade Bias safely
* **BUY NASDAQ** → prioritize long setups, avoid shorts
* **SELL NASDAQ** → prioritize short setups, avoid longs
* **WAIT** → mixed environment: trade only A+ setups or stay flat
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。