OpptionsOnly

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.

Aug 13
Release Notes: ** 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.
Aug 14
Release Notes: ** Update**

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

** Currently working on simplifying code
Aug 14
Release Notes: ** Update **

* Update visual drawings
* Removed unused lines of code

** TODO**

* Format numbers
* Change Spread direction calculations for consistency
Aug 15
Release Notes: ** 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!
Aug 21
Release Notes: 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
Aug 23
Release Notes: **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
Aug 23
Release Notes: 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
Aug 25
Release Notes: ** 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
Sep 12
Release Notes: **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.
Remove from Favorite Scripts Add to Favorite Scripts
Home Stock Screener Forex Screener Crypto Screener Economic Calendar Shows How It Works Chart Features Pricing House Rules Moderators Website & Broker Solutions Widgets Charting Solutions Lightweight Charting Library Help Center Refer a friend Feature Request Blog & News FAQ Wiki Twitter
Profile Profile Settings Account and Billing Refer a friend My Support Tickets Help Center Ideas Published Followers Following Private Messages Chat Sign Out