Yield Curve Chart Indicator for ThinkorSwim

BenTen

Administrative
Staff member
Staff
VIP
Lifetime
mod note:
This script gives you a clean, at‑a‑glance read of the yield curve by plotting the 30‑yr, 10‑yr, 5‑yr, and 3‑month rates directly in one lower panel. Each maturity is color‑coded and labeled so you instantly see:
» Curve shape (steepening, flattening, or inversion)​
» Where stress is building (short end spiking vs long end anchored)​
» Risk‑on / risk‑off tone (steepening = expansionary, inversion = defensive)​
» Macro regime shifts without needing a separate dashboard​

Most traders only look at TNX or a single spread. This gives you the full curve structure in real time, with no interpretation lag and no need to calculate spreads manually. It’s a behavioral cue engine: when the short end rips above the long end, you see it instantly; when the long end lifts, you see duration demand shift immediately.

Bottom line:
This script turns the yield curve into a visual macro indicator you can read in one glance—no math, no guesswork, no switching charts. It keeps you aligned with the macro regime that drives equity momentum, liquidity, and volatility.

This indicator was shared by Ken Rose of TD Ameritrade to help you build your own Yield curve chart in ThinkorSwim. Be sure to visit the ToS' settings page and set your chart type to Line.

YzlTIlV.png


thinkScript Code

Code:
#TWITTER: @KROSE_TDA
#Yield curve two indexes
#declare lower;
def barn = if !IsNaN(close) then BarNumber() else Double.NEGATIVE_INFINITY;
input line_Weight = 3;
#input color = ("Light_Background", "Dark_Bacjkground");
Input Bubble_Offset = 12;
################################################
plot ThirtyYear = close("TYX");
thirtyYear.AssignValueColor(color.YELLOW);
thirtyYear.SetLineWeight(line_Weight);
addChartBubble  (barNumber()==highestAll(barn)-bubble_offset,thirtyYear,"30Yr",color.yellow);
#################################################
plot TenYear = close("TNX");
tenYear.AssignValueColor(color.GREEN);
tenYear.SetLineWeight(line_Weight);
addChartBubble  (barNumber()==highestAll(barn)-(bubble_offset -4),tenyear,"10Yr",color.GREEN);
########################################
plot FiveYear = close("FVX");
FiveYear.AssignValueColor(color.LIME);
FiveYear.SetLineWeight(line_Weight);
addChartBubble  (barNumber()==highestAll(barn)-(bubble_offset -6),fiveyear,"5Yr",color.LIME);
########################################
plot Threemonth = close("IRX");
threemonth.AssignValueColor(color.RED);
threemonth.SetLineWeight(line_Weight);
addChartBubble  (barNumber()==highestAll(barn)-(bubble_offset -8),threemonth,"3Mo",color.RED);

Shareable Link

https://tos.mx/EYw42x
 

Attachments

  • YzlTIlV.png
    YzlTIlV.png
    184.1 KB · Views: 1,046
Last edited by a moderator:
I did it! TNX Label; @MerryDay This is what I am looking for:

Code:
declare upper;
input Temporalidad = AggregationPeriod.day;
Input Indicador=  {"SPY", "QQQ", "DIA", default "TNX"};
input Color_del_recuadro = {"magenta", "green", "pink", default "cyan", "orange", "red", "blue", "gray", "violet"};

def Indicador_ = close(Indicador,period = Temporalidad);

AddLabel(yes, Indicador +": " + Indicador_, GetColor(Color_del_recuadro));
 
Last edited by a moderator:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
1746 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top