How to code this support/ resistance level indicator

hockeycoachdoug

Active member
2019 Donor
VIP
I have a stand alone indicator (outside of TOS) that spits out 15 levels of potential support/ resistance levels and displays the levels in a text format. I would like to have an indicator that I can input all 15 levels in the input area of the indicator and it will draw a horizontal line at all the price levels. It is very time consuming trying to draw each horizontal line with the drawing tool. I would also like to be able to choose the color of the horizontal line so I can differentiate between support and resistance. I think this should be pretty simple to code, Just need a place to input all the levels, then have them plotted on the chart in the color chosen by user. Thanks in advance for any help or guidance
 
Solution
All you need to do is Plot each of you desired Support/Resistance levels based on your 15 Inputs... Short simple example below... Because the values are manually entered, rather than defined by a dynamic price value, the line remains horizontal...

Ruby:
input sr1 = 601;
input sr2 = 598;

plot sr1_line = sr1;
sr1_line.SetDefaultColor(Color.CYAN);
sr1_line.SetLineWeight(1);

plot sr2_line = sr2;
sr2_line.SetDefaultColor(Color.VIOLET);
sr2_line.SetLIneWeight(2);
All you need to do is Plot each of you desired Support/Resistance levels based on your 15 Inputs... Short simple example below... Because the values are manually entered, rather than defined by a dynamic price value, the line remains horizontal...

Ruby:
input sr1 = 601;
input sr2 = 598;

plot sr1_line = sr1;
sr1_line.SetDefaultColor(Color.CYAN);
sr1_line.SetLineWeight(1);

plot sr2_line = sr2;
sr2_line.SetDefaultColor(Color.VIOLET);
sr2_line.SetLIneWeight(2);
 
Last edited:
Solution
Rad14733- thanks for the assist. What do I need to add to be able to change colors of the line in the inputs area of the indicator?

See my code previously posted... I included both line color and line weight options... Also, even after all these years, I always have a browser tab open to the Thinkscript portion of the Thinkorswim Learning Center...
 

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
333 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