# convergence and divergence of correlation

#### nicksalv

##### New member
this is an indicator on thinkorswim that i saw some guy use. i know its hard to see but if you can zoom in you'll see, and it basically has vertical bars showing the amount of divergence between a stock of choice and is compared to spy (s&p500) and basically showing how much a stock is following spy, for example on the 1 minute chart tesla was going down while spy was going up so tesla was showing weakness and the indicator had a vertical bar that was red (not following spy) and the height of the bar is how much it isn't corresponding with spy. another example is tesla was going up and spy was going up on the 1 minute chart, since it was following spy the indicator showed a black bar (following spy) and the height of the bar is based on how much is it exactly following spy, the more closely it corresponds the higher the black bar. please can someone code this indicator for me i have been trying to code this for like 5 days now non stop and i just cant figure it out.

#### Attachments

• Screenshot 2024-04-05 122131.png
57.8 KB · Views: 62
is it possible to make it so instead of the Mansfield Relative Strength
https://usethinkscript.com/threads/mansfield-relative-strength-for-thinkorswim.18260/ being a line, it be a bar for each candlestick and the bars only go up from 0 instead of going below it, for example if im using this indicator to see the divergence between SPX and Tesla, if Tesla goes up on the 1 minute chart and so does SPX, the indicator shows a cyan colored bar going up and the height of the bar depends on how much it is correlating with SPX (the closer to 0 the closer Tesla is following SPX), and lets say Tesla is going down while SPX is going up which means Tesla is weak compared to SPX it would show a bar going up but it being a different colored bar lets say red and the height of the bar be dependent on how much Tesla isn't correlating with SPX (the more Tesla is doing the opposite of SPX the higher the bar), and lets say Tesla is going up while SPX is going down which means Tesla is strong compared to SPX it would shows a bar going up but it be the color red just like as if Tesla is weak against SPX since Tesla is doing the opposite of SPX. I would have to find a picture to find an example of this so let me know if you would need to see a picture

Last edited by a moderator:

### Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
354 Online

## The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• 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?