Futures Correlation Indicator for ThinkorSwim

BenTen

Administrative
Staff member
Staff
VIP
Lifetime
This indicator plot a lower study that shows level of correlation between different futures market such as /ES, /NQ, and /YM. You can adjust these futures indexes based on your liking.

J8GZRip.png


thinkScript Code

Code:
# Correlate with others futures
declare lower;

input length    = 10;
input sym1      = "/ES";
input sym2      = "/YM";
input sym3      = "/NQ";
input sym4      = "/TF";
input sym5      = "/CL";
input sym6      = "/GC";
input sym7      = "/DX";
input sym8      = "/6E";

plot Symbol_1   = correlation(close, close( sym1 ), length);
plot Symbol_2 = correlation(close, close( sym2 ), length);
plot Symbol_3   = correlation(close, close( sym3 ), length);
plot Symbol_4   = correlation(close, close( sym4 ), length);
plot Symbol_5   = correlation(close, close( sym5 ), length);
plot Symbol_6   = correlation(close, close( sym6 ), length);
plot Symbol_7   = correlation(close,! close( sym7 ), length);
plot Symbol_8   = correlation(close, close( sym8 ), length);

Symbol_1.DefineColor( "sym1", GetColor( 0 ) );
Symbol_1.AssignValueColor( Symbol_1.Color( "sym1" ) );
Symbol_1.HideBubble();
Symbol_2.DefineColor( "sym2", GetColor( 1 ) );
Symbol_2.AssignValueColor( Symbol_2.Color( "sym2" ) );
Symbol_2.HideBubble();
Symbol_3.DefineColor( "sym3", GetColor( 2 ) );
Symbol_3.AssignValueColor( Symbol_3.Color( "sym3" ) );
Symbol_3.HideBubble();
Symbol_4.DefineColor( "sym4", GetColor( 3 ) );
Symbol_4.AssignValueColor( Symbol_4.Color( "sym4" ) );
Symbol_4.HideBubble();
Symbol_5.DefineColor( "sym5", GetColor( 4 ) );
Symbol_5.AssignValueColor( Symbol_5.Color( "sym5" ) );
Symbol_5.HideBubble();
Symbol_6.DefineColor( "sym6", GetColor( 5 ) );
Symbol_6.AssignValueColor( Symbol_6.Color( "sym6" ) );
Symbol_6.HideBubble();
Symbol_7.DefineColor( "sym7", GetColor( 6 ) );
Symbol_7.AssignValueColor( Symbol_7.Color( "sym7" ) );
Symbol_7.HideBubble();
Symbol_8.DefineColor( "sym8", GetColor( 7 ) );
Symbol_8.AssignValueColor( Symbol_8.Color( "sym8" ) );
Symbol_8.HideBubble();

AddLabel( yes, "Correlate " + GetSymbol() + " with:", GetColor( 8 ) );
AddLabel( yes, sym1, Symbol_1.Color( "sym1" ) );
AddLabel( yes, sym2, Symbol_2.Color( "sym2" ) );
AddLabel( yes, sym3, Symbol_3.Color( "sym3" ) );
AddLabel( yes, sym4, Symbol_4.Color( "sym4" ) );
AddLabel( yes, sym5, Symbol_5.Color( "sym5" ) );
AddLabel( yes, sym6, Symbol_6.Color( "sym6" ) );
AddLabel( yes, sym7, Symbol_7.Color( "sym7" ) );
AddLabel( yes, sym8, Symbol_8.Color( "sym8" ) );

Shareable Link

https://tos.mx/hlT3W5
 

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.
Top