OPEN-SOURCE SCRIPT
Macro Stress Monitor (USDJPY + JGB + Yield Curve)

# **Note‑Style Description**
This indicator provides a consolidated framework for monitoring two of the most systemically important channels of global USD liquidity transmission: **offshore USD funding conditions in Japan** and **front‑end U.S. rates stress linked to repo and collateral dynamics**. While TradingView does not supply direct access to cross‑currency basis swaps or repo benchmarks, the script employs market‑validated proxies that closely track the same underlying pressures observed in dealer balance‑sheet constraints, FX‑hedged flows, and Treasury funding markets.
### **1. USD/JPY Funding Pressure (Basis‑Swap Proxy)**
The USD/JPY cross‑currency basis is a primary indicator of offshore USD funding premia for Japanese banks, insurers, and real‑money accounts. Basis widening typically reflects elevated USD demand, reduced hedge ratios, and impaired FX swap market liquidity.
To approximate this behavior in real time, the indicator combines:
- **USDJPY spot**, which tends to accelerate higher during USD funding stress, FX swap dislocations, or shifts in BOJ/Fed policy differentials.
- **JP10Y (Japan 10‑year yield)**, which captures JGB‑market stress, duration‑hedging flows, and the impact of FX‑hedged UST carry dynamics on domestic rates.
The joint behavior of these two series provides a high‑signal proxy for USD/JPY basis conditions, particularly around quarter‑end, fiscal year‑end, and BOJ policy events.
### **2. U.S. Front‑End Curve Stress (Repo/Collateral Proxy)**
Stress in the U.S. repo market often manifests first in the front end of the Treasury curve, where funding volatility, collateral scarcity, and dealer balance‑sheet compression drive rapid curve distortions.
The indicator tracks:
- **US02Y – US10Y (2s10s spread)** as a public‑market proxy for repo tightness, GC specialness, and leveraged Treasury basis‑trade unwind risk.
A deeper inversion or accelerated flattening of the 2s10s curve frequently coincides with rising funding premia, increased margin requirements, and deleveraging across rates‑sensitive strategies.
### **3. Stress Diagnostics**
The script highlights three conditions that historically align with elevated cross‑asset fragility:
- **USDJPY > 20‑day SMA** — proxy for USD funding stress / basis widening
- **JP10Y < 20‑day SMA** — proxy for JGB‑market stress or hedging‑related duration flows
- **2s10s < –0.50** — proxy for front‑end funding pressure and repo‑related curve distortions
These are not directional trading signals. They are **liquidity‑risk diagnostics** intended to identify periods when global funding markets become more vulnerable to synchronized deleveraging.
### **4. Intended Use Case**
This tool is designed for macro practitioners, cross‑asset strategists, and risk managers who monitor:
- USD funding premia and cross‑currency basis dynamics
- FX‑hedged UST flows and Japanese institutional positioning
- Treasury basis‑trade leverage and repo‑driven volatility
- BOJ/Fed policy interactions and quarter‑end balance‑sheet effects
- Systemic liquidity conditions across FX, rates, and credit
The indicator provides a real‑time dashboard for identifying early‑stage liquidity stress that may precede broader cross‑asset volatility.
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.