"A yield curve is a line that plots yields (interest rates) of bonds having equal credit quality but differing maturity dates. The slope of the yield curve gives an idea of future interest rate changes and economic activity." (Investopedia)
When the slope is upward (longer maturity bonds have a higher interest rate than shorter maturity bonds), it generally means the economy is doing well and is expanding. When the slope is downward it generally means that there is more downside risk in the future.
The more inverted the curve is, and the more the inversion moves to the front, the more market participants are hedging against downside risk in the future.
The script draws up to 4 moments of a yield curve, which makes it easy to compare the current yield curve with past yield curves. It also draws lines in red when that part of the curve is inverted.
The script draws the lines with proper length between maturity (which most scripts do not) in order to make it more representative of the real maturity duration. The width cannot be scaled because TradingView does not allow drawing based on pixels.
This script is the only free script at time of writing with proper lengths, showing multiple yield curves, and being able to show yield curves other than the US treasury.
(The following can be configured by clicking "Settings" when the script is added to a chart)
By default the script is configured to show the US treasury (government bond) yields of all maturities, but it can be configured for any yield curve.
A ticker represents yield data for a specific maturity of a bond.
To configure different tickers, go to the "TICKERS" section. Tickers in this section must be ordered from low maturity to high maturity.
• Enable: draw the ticker on the chart.
• Ticker: ticker symbol on TradingView to fetch data for.
• Months: amount of months of bond maturity the ticker represents.
To configure general settings, go to the "GENERAL" section.
• Period: used for calculating how far back to look for data for past yield curve lines. See "Times back" further in this description for more info.
• Min spacing: minimum amount of spacing between labels. Depending on the size of the screen, value labels can overlap. This setting sets how much empty space there must be between labels.
• Value format: how the value at that part of the line should be written on the label. For example, 0.000 means the value will have 3 digits precision.
To configure line settings per yield curve, each has its own "LINE" section with the line number after it.
• Enable: whether to enable drawing of this line.
• Times back: how many times period to go back in time. When period is D, and times value is 2, the line will be of data from 2 days ago.
• Color: color of the line when not inverted.
• Style: style of the line. Possible values: sol, dsh, dot
• Inversion color: color of the line when the curve inverses between the two maturities at that part of the curve.
• Thickness: thickness of the line in pixels.
• Labels: whether to draw value labels above the line. By default, this is only enabled for the first line.
• Label text color: text color of value label.
• Label background color: background color of value label.
To configure the durations axis at the bottom of the chart, go to the "DURATIONS" section.
• Durations: whether to show maturity term duration labels below the chart.
• Offset: amount to offset durations label to be below chart.
Script originally inspired by the US Treasury Yield Curve script by @longfiat but has been completely rewritten and changed.
Dans le véritable esprit de TradingView, l'auteur de ce script l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par le règlement. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.
Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.