display the slope/angle of the resistance trendline

ziongotoptions

Active member
I love this indicator,
https://usethinkscript.com/threads/...tance-indicator-for-thinkorswim.158/#post-878

I was wonder would it be possible to add chart labels that display the slope/angle of the resistance trendline above the current pivot high and the support trendline below the current pivot low?

Heres what ive come up with so far for the support trendline , only issue is the chart bubble is blacked out
def srun = if pivotlow then 1 else srun[1] +1;
def srise = if pivotlow then low - getvalue(low,srun[1]) else double.NaN;
def sslope2 = srise/srun[1];
addchartBubble(pivotlow,low,sslope2, if sslope2 >0 then color.GREEN else color.PINK);
 
Last edited by a moderator:
I love this indicator,
https://usethinkscript.com/threads/...tance-indicator-for-thinkorswim.158/#post-878

I was wonder would it be possible to add chart labels that display the slope/angle of the resistance trendline above the current pivot high and the support trendline below the current pivot low?

Heres what ive come up with so far for the support trendline , only issue is the chart bubble is blacked out
def srun = if pivotlow then 1 else srun[1] +1;
def srise = if pivotlow then low - getvalue(low,srun[1]) else double.NaN;
def sslope2 = srise/srun[1];
addchartBubble(pivotlow,low,sslope2, if sslope2 >0 then color.GREEN else color.PINK);

in the bubble color if-then, try adding a check ... if srise is an error....

addchartBubble(
pivotlow,
low,
sslope2,
(if isnan(srise) then color.gray else if sslope2 >0 then color.GREEN else color.PINK)
);
 
in the bubble color if-then, try adding a check ... if srise is an error....

addchartBubble(
pivotlow,
low,
sslope2,
(if isnan(srise) then color.gray else if sslope2 >0 then color.GREEN else color.PINK)
);
Yeah it gave an error, I switched it to this now but all the angles are negative now
def srun = plbar - priorPLBar;
def srise = firstSpoint - priorSpoint;
def sslope2 = srise/srun[1];
addchartBubble(pivotlow,low,sslope2,(if isnan(srise) then color.gray else if sslope2 >0 then color.GREEN else color.PINK));
 
in the bubble color if-then, try adding a check ... if srise is an error....

addchartBubble(
pivotlow,
low,
sslope2,
(if isnan(srise) then color.gray else if sslope2 >0 then color.GREEN else color.PINK)
);
I dont know if this right but heres what i came up with
def sgannangle = roundup((atan(sslope)*180/double.Pi),2);
addchartBubble(Pivotlow, low,sgannangle, if sslope> 0 then color.GREEN else color.red);
def rgannangle = roundup((atan(rslope)*180/double.Pi),2);
addchartBubble(Pivothigh,high,rgannangle, if rslope< 0 then color.red else color.green);
 

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