OPEN-SOURCE SCRIPT

Yield Curve

업데이트됨
Thanks to @gwaaf for his post on how to draw the curve!!

* Charts and displays the current Treasury Yield Curve and the Spread.
* Colors Lines and Labels based off price.
* Dynamically adjusts the position of the labels as prices change.


Top Labels:
Top labels display the Spread between listed bonds in regards to Longer term Bonds minus Shorter term Bonds. This label points to the mid point on the curve. If the Spread is greater than the previous Spread at the current resolution, the label and line color on the curve turn Green. If the Spread is less than the previous Spread at the current resolution, the line on the curve and label will turn Red.

Bottom Labels:
Bottom labels display the current for each bond listed. This label points to the (POINT) in the curve that corresponds with the current price of the Bond. The label will turn Green if the current price is higher than the previous price at the current resolution and vise versa!

Known issues:
There seems to be a color swapping issues when the changed is very small. I believe I can fix this with rounding the numbers and will leave that for another time.

릴리즈 노트
** Update**

* Added display for Inverted Yields

Currently only testing for inversion of each term Bond Yield vs the next term Bond Yield.
If a shorter term Bond Yield is greater than the next longer term Bond Yield, inversion occurs.
릴리즈 노트
** Update**

* Adjusted colors to better match chart colors
* Added display if/when there is a 2Y vs 10Y inversion

** Currently working on simplifying code
릴리즈 노트
** Update **

* Update visual drawings
* Removed unused lines of code

** TODO**

* Format numbers
* Change Spread direction calculations for consistency
릴리즈 노트
** UPDATE ** Version 1.036

* Added Features *

- Added INPUT settings
- Ability to plot the Average Yield Curve of the Bonds Included in this script. (Accessible through the INPUT settings) Default OFF
- Ability to toggle On/Off the 2-10 Inversion warning (If applicable) via INPUT settings. Default ON
- Ability to toggle On/Off the Inversion warning (If applicable) via INPUT settings. Default ON
- Ability to toggle between Large/Normal Labels via INPUT settings. Default Large

* Changes *
- Due to data not updating properly after the Bond Market closes, I've added a barstate to certain lines of code. This does cause the script to not fully update until there is a changed in any of the included Bonds. While this is a minor set back, at this
time, it's the only way I have been able to acquire the correct information after the Bond Market closes.

* Notes *
- This script acquires data from 8 different securities. This being said, when the script is launched, there is a lag time for the INITIAL information to be displayed. There are times at INITIAL launch, the display becomes distorted. A simple relaunch fixes this
this issue. From what I've noticed, I believe the issue arises when the script is loading and an ad pops up.

- When using the INPUT features, information again takes a few moments to display. Again, because of the data that needs to be acquired again just like the initial launch.

- Once all the information is acquired either through initial launch or Input setting relaunch, the script runs as normal.

- This script is at this point merely for fun and learning Pinescript. I have many things running through my head as to features I would like to add and will continue to add these features as I continue to learn Pinescript!

릴리즈 노트
Welcome to Yield Curve Version 2.41

* Please read description to help understand the information displayed.

* NOTE - This script requires 1 real time update before accurate information is displayed, therefore WILL NOT display the correct information if the Bond Market is Closed over the Weekend.
* NOTE - When values are changed Via Input setting they do take a bit to display based off all the information that is required to display this script.
**FEATURES**

* Input Features let you view the information the way YOU like via Input Settings
* Displays Current Version Title - Toggleable On/Off via Input Settings - Default On
* Plots the Yield Curve of the Bonds listed (Middle Green and Red Line)
* Displays the Spread for each Bond (Top Green and Red Labels) - Toggleable On/Off via Input Settings - Change Size via Input Settings - Default On
* Displays the current Yield for each Bond (Bottom Green and Red Labels) - Toggleable On/Off via Input Settings - Change Size via Input Settings - Default On - Large Size
* Plots the Average of the Entire Yield Curve (BLUE Line within the Yield Curve) - Toggleable On/Off via Input Settings - Default On
* Displays messages based off Yield Inversions (Orange Text) - Toggleable On/Off via Input Settings - Default On if Applicable
* Displays 2 10 Inversion Warning Message (Orange Text) - Toggleable On/Off via Input Settings - Default On if Applicable
* Plots Column Data at the Bottom that tries to help determine the Stability of the Yield Curve (More information Below about Stability) - Toggleable On/Off via Input Settings - Default On
* Plots the 7,20 and 100 SMA of the STABILITY MAX OVERLOAD (More information Below about Stability Max Overload) - Toggleable On/Off via Input Settings - Default On for 100SMA Off for 7 and 20 SMA

**Bottom Columns are all about STABILITY**

* I have tried to come up with an algorithm that helps understand the Stability of the Yield Curve. There are 3 Sections to the Bottom Columns.

* Section 1 - STABILITY (Displayed as the lightest Green or Red Column) Values range from 0 to 1 where 1 equals the MOST UNSTABLE Curve and 0 equals the MOST STABLE Curve
* Section 2 - STABILITY OVERLOAD (Displayed just above the Stability Column a shade darker Green or Red Column)
* Section 3 - STABILITY MAX OVERLOAD (Displayed just above the Stability Overload Column a shade darker Green or Red Column)

What this section tries to do is help understand the Stability of the Curve based on the inversions data. Lower values represent a MORE STABLE curve. If the Yield Curve currently has 0 Inversions all Stability factors should equal 0 and therefore not plot any lower columns. As the Yield Curve becomes more inverted each section represents a value based off that data. GREEN columns represent a MORE Stable Curve from the resolution prior and vise versa.

STABILITY tests the current Stability of the Curve itself again ranging from 0 to 1 where 0 equals the MOST Stable Curve and 1 equals the MOST Unstable Curve.
STABILIY OVERLOAD adds a value to STABLITY based off STABILITY itself.
STABILITY MAX OVERLOAD adds the Entire value to STABILITY derived again from STABILITY.

This section also allows us to see the 7,20 and 100 SMA of the STABILITY MAX OVERLOAD which should always be the GREATEST of ALL STABILTY COLUMNS.

Remember - All information displayed can be tuned On or Off besides the Curve itself. There are also other Features Accessible Via the Input Settings.

I will continue to update this script as there is more information I would like to gather and display!


I hope you enjoy,

OpptionsOnly
릴리즈 노트
**New Features**

*Indicator Labels*

* Added ability to display Indicator Label Name and Value via Input Settings. Indicators included - Yield Curve Average, Stability Max Overload, Stability Overload and Stability. => (YCA SMO SO S)
* Added ability to display Stability Max Overload SMA Label Name and Value via Input Settings. => (SMO SMA)

*How to use*

Indicator Labels by default are turned off. Enable "Indicators" via Input Settings to turn on. Once on, Indicator Labels will be displayed for (YCA SMO SO S). To switch to (SMO SMA) Labels, toggle "Indicator Labels / SMO SMA Labels", via Input Settings.
Once the "Indicators" feature has been enabled, you will be able to toggle between the two Display Labels. To turn the Indicator Labels Off, simply disable "Indicators" via Input Settings.

Minor chart scale adjustments might be needed as the labels display to the right of the Yield Curve in time that has not come to pass.

*Bug Fixes*

*Version Mismatch from Version 2.41 beings displayed and 2.0
*Updated Version to reflect Version 2.55.2
릴리즈 노트
Release Notes: Yield Curve Version 2.58.4

** New Features **

* Added Ability to View Stability, Stability Overload and Stability Max Overload History via Input Settings
* Added Ability to View Stability Max Overload SMA History via Input Setting
릴리즈 노트
** BUG FIX UPDATE** In previous Versions, STABILITY would not generate the correct number given certain criteria.

* Fixed the equation as to how STABILITY is calculated.
* Added a trigger if this value becomes greater than 1.

It is very unlikely that the greater than 1 trigger will come in to play but as it is still possible, I added it in for safety.

Best wishes,
OpptionsOnly
릴리즈 노트
**UPDATES**
******************************************************************************

- Added Total Inversion line ( Sum of all inversions )
- Added Spread of YCA and Total inversion ( Tracks the Spread of the entire Yield Curve Average vs. the Total Inversion )

- Added labels for Total Inversion
- Added labels for Spread(YCA/TI)

- Added Toggleable inputs for TI Data (And Labels)
- Added Toggleable inputs for Spread(YCA/TI) (And Labels)

- Total Inversion and YCA/TI Spread are turned off by default and can be turned on via Input settings.

**FIXES**
******************************************************************************

- Fixed Labels to display the correct position based off the current resolution (WIP)


**CHANGES**
******************************************************************************

- Changed Label size from size.normal to size.large


**Known Issues**
******************************************************************************

While Display Labels can be turned on or off, they do tend to overlap if the data values are too close together. At this point, it's highly unlikely I will address this issue as it's not a priority.
bondsbondspreadbondyieldsMoving AveragestreasurybondsTrend AnalysisUS02Yus02yus10yUS10Yyieldcurve

오픈 소스 스크립트

진정한 TradingView 정신에 따라, 이 스크립트의 저자는 트레이더들이 이해하고 검증할 수 있도록 오픈 소스로 공개했습니다. 저자에게 박수를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰에 의해 관리됩니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.

차트에 이 스크립트를 사용하시겠습니까?

면책사항