FX Yield Spread Pro

744
FX Yield Spread Pro allows traders to clearly see the relationship between government bond yield spreads and FX rates. For whichever currency pair is on the chart, it finds the two countries' government bond yields and draws their spread (base-currency yield minus quote-currency yield) over the price, on its own scale, with a trend line showing whether the spread is rising or falling. The spread is dated exactly, bar for bar. Two further readings can be switched on: colouring the spread by which country's yield is doing the moving, and an implied price drawn among the candles that shows where the spread says the pair should be.

WHAT IT SHOWS
1. The yield spread, over the price chart on a separate left-hand scale. EURUSD shows EU10Y minus US10Y, USDJPY shows US10Y minus JP10Y, GBPCAD shows GB10Y minus CA10Y, and so on. The pair is detected from the chart symbol, so nothing needs changing when you move to another pair. Maturities of 2, 5, 10, 20 and 30 years are available.
syot kilat

2. The spread's trend. A fast and a slow average of the spread (exponential, 5 and 10 bars by default) are shown as a single line: green while the fast average is above the slow one, red while it is below. The spread line itself can be coloured by the trend instead, or switched off to leave the trend line on its own.
syot kilat

3. Which yield is driving (optional). The spread line can take one colour while the base currency's yield has moved more over a lookback and another while the quote currency's yield has moved more. A fall in the spread drawn in the quote colour, for example, is the quote country's yields rising rather than the base country's falling.
syot kilat

4. Implied price (optional). A line among the candles showing the price the pair would have if it sat exactly on its recent relationship with the spread, so the gap between price and the yield spread can be read on the price axis.
syot kilat

5. A caption (optional): the spread in use and its current value; how far each of the two yields has moved over the lookback, in basis points, with the larger move highlighted; the implied price, when that is switched on, with the distance of price from it (in pips on forex symbols); and the spread's trend. Hovering over the caption gives the detail.
syot kilat

HOW IT WORKS
Pair detection: the chart's base and quote currencies are mapped to TradingView's government bond yield symbols (TVC:US10Y, TVC:EU10Y, TVC:GB10Y, TVC:JP10Y and so on) at the selected maturity. The plotted spread is requested as a single spread symbol, so it matches what you get by adding, for example, TVC:EU10Y-TVC:US10Y to a chart by hand.

Dating of values: yield markets do not all close at the same time as the chart symbol. US yields close 30 minutes after the forex daily bar, and a script only receives another symbol's daily bar once that bar has closed. If the two yields are simply requested and subtracted, every past bar of a US dollar pair therefore pairs one country's close for that day with the US close from the day before. This script avoids that. On daily, weekly and monthly charts it requests each value together with the trading day it belongs to and places it on the chart bar with the same date, so each bar is same-day minus same-day. You can check this by adding the spread symbol itself (for example TVC:US10Y-TVC:CA10Y on USDCAD) to the chart: the indicator's line sits on it.

Spread trend: two moving averages of the spread, exponential by default. The trend is rising while the fast one is above the slow one, and the line drawn is the slow average.

Driver colouring: the two yields are also requested individually. For each bar the script compares the absolute change in the base yield with the absolute change in the quote yield over the lookback, and colours the line according to the larger.

Implied price: a rolling least-squares regression of the pair's closing price on the spread, over the last N completed bars (60 by default, about three months of daily bars). The implied price for a bar is the regression's intercept plus its slope times that bar's spread. The regression for a bar is estimated on earlier bars only, so a bar never contributes to its own fit. The fit is measured by the correlation between price and the spread over the window. When it is below a threshold you choose (0.5 by default), the line is drawn faded and the caption marks the fit as weak. A negative correlation means the pair has been moving against the spread, so the implied price is never treated as a fit then, however strong the correlation: the line stays faded, and the caption marks it as inverse once the correlation is at least as strong as the threshold. The caption's tooltip gives the correlation itself.

HOW TO USE IT
Start on a daily or weekly chart of a major pair. Read the spread line as you would any yield-spread overlay, and use the trend line to see whether the yield spread is currently moving for or against the pair. Switch on driver colouring to see which country is behind each move. Switch on the implied price to compare where the pair is with where the spread says it should be: when the fit is good and price is far from the line, either the pair has run ahead of the yield spread or something other than yields is driving it. When the line is faded, the recent relationship is too loose, or inverted, to read anything from it. Alert conditions are provided for the spread trend turning up or down.

SETTINGS
Yields: maturity, and the EUR yield source (euro-area benchmark or German Bund). Spread line: on or off; one colour, coloured by driving yield, or coloured by spread trend, with the driver lookback and colours. Spread trend: trend line on or off, average type, fast and slow lengths, and colours. Implied price: on or off, fit window, the correlation below which the fit is treated as weak, how many bars to draw, and colour. Caption: on or off, its position, and whether to show a short note on charts where there is nothing to draw.

WHAT IS ORIGINAL
Other yield-spread scripts plot the spread on its own scale, sometimes with averages, or compare spread and price as normalised oscillators. This script does three things differently. The spread is date-exact: on every pair, including US dollar pairs where the US yield's later close would otherwise put one leg a bar behind the other, each bar matches TradingView's own spread symbol. It attributes each move in the spread to one of its two legs and can show that directly in the colour of the line. And it can express the spread in the pair's own price units, with a measure of fit, so the divergence can be read on the price axis in pips. All of this is computed for the chart's pair automatically.

LIMITATIONS AND IMPORTANT NOTES
Plots offset into the past: the plots whose names end in "(confirmed close)" are offset one bar to the left. This is deliberate. A yield's daily bar can close after the chart's bar of the same date, in which case its value only becomes available on the following chart bar, and the offset puts it back on the bar of the date it belongs to. The colours of each point are likewise decided once the closes for that date are known. On daily, weekly and monthly charts these confirmed plots are the lines you see, joined to the live value on the current bar. Only the script's name is shown in the status line; the plotted values are in the Data Window. No lookahead is used anywhere in the script.

Implied price line: the implied price is drawn with a line object rather than a plot, because it is in price units and the spread is not. It covers the most recent bars only (500 by default), does not appear in the Data Window, and is redrawn as the current bar updates. The current implied price is shown in the caption when the caption is switched on.

Live values: on the current bar the spread, its colour, the trend, the implied price and the caption update as yields move, and are final only once the bar's official yield closes have arrived. The trend alerts use confirmed closes, so they fire one bar after the change. While the market is closed, a yield whose official close has not yet arrived for the last bar is represented by its last hourly reading inside that bar until the official value replaces it.

The implied price is descriptive, not a forecast, and price being far from it is not a reversal signal. It is a regression on a rolling window of two trending series. The relationship between yield spreads and exchange rates strengthens, weakens and sometimes reverses, which is why the fit is reported and should be read first. The spread trend likewise describes the direction of the yield spread; it does not predict price.

A yield spread is not an interest rate differential, and this script does not measure one. An interest rate differential compares two currencies' short-term interest rates, which follow central-bank policy rates. A yield spread compares what the market pays on two governments' bonds of the same maturity, so it also reflects where policy rates are expected to go, inflation expectations and the extra return investors ask for holding longer bonds. The two can move quite differently.

Date matching applies to daily, weekly and monthly charts. On intraday charts values are used as they arrive. Yield data is not available for every currency at every maturity; where it is missing, or on symbols that are not currency pairs, the script shows a short note and nothing else. This script is an analytical and educational tool and does not give trading advice.

Penafian

Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.