AGAIG DualTopsBottoms For ThinkOrSwim

csricksdds

Trader Educator
VIP
Another ThinkScript post got me thinking about Dual Tops & Bottoms (sometimes indicative of a turn in direction) and so I came up with the following script. I use it on my AsGoodAsItGets indicator for 5 minute charts and above (It's a little too busy on shorter time frames). If someone smarter than me can improve on it I would be appreciative?
Ruby:
#AsGoodAsItGets_DualTops/Bottoms
#Double Tops/Bottoms frequently show potential swings in direction especially if one of the Tops/Bottoms has a long Wick above the Dual Top Candles; or a Long Wick below Dual Bottom Candles. This is also significant if the DB or DT shows superimposed on_"AsGoodAsItGets" indicator Long or Short Bubbles.
#This may be a little too busy for charts less than 5 minutes.
#Charles Ricks 10/18/22 Thanks to ThinkScript Forum the idea!


#AsGoodAsItGets_DualTops/Bottoms
#Double Tops/Bottoms frequently show potential swings in direction especially if one of the Tops/Bottoms has a long Wick above the Top Candles or a Long Wick below candles. This is also significant if the DB or DT shows superimposed on_volume abandonedBaby AsGoodAsItGets Long or Short Bubble.
#May be a little too busy for charts less than 5 minutes.
#Charles Ricks 10/18/22 Thanks to ThinkScript Forum the idea!

#
def SL1 = 10000;
def SH1 = 0;

def DoubleTop = if high == high[1]
then if high < high[2] and high < high[-1]
then 1
else 0
else if high < high[1] and high < high[-1]
then 1
else 0;


plot SW = if DoubleTop then low else Double.NaN;

AddChartBubble(DoubleTop, low, "DB", Color.green
, no);


def DoubleBottom = if low == low[1]
then if low < low[2] and low < low[-1]
then 1
else 0
else if low > low[1] and low > low[-1]
then 1
else 0;


plot SW1 = if DoubleBottom then low else Double.NaN;
SW1.SetLineWeight(5);

AddChartBubble(DoubleBottom, high, "DT", Color.red
, yes);
 
Last edited by a moderator:

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

The alerts worked when I substituted "DoubleTop" and "DoubleBottom" for "sw" and "sw1," respectively, in the code. Many Thanks

alert(DoubleTop[1] == 1, "Low", alert.bar, sound.bell);
alert(DoubleBottom[1] == 1, "High", alert.bar, sound.ring);
 
Last edited by a moderator:
The alerts worked when I substituted "DoubleTop" and "DoubleBottom" for "sw" and "sw1," respectively, in the code. Many Thanks

alert(DoubleTop[1] == 1, "Low", alert.bar, sound.bell);
alert(DoubleBottom[1] == 1, "High", alert.bar, sound.ring);
You're welcome...that was my next move...just didn't have time to check it out!
 
Can we have little fine tune here? Meaning DB will happen at end of downtrend and DT will happen only at end of uptrend?
Meaning, avoid any DB in uptrend and DT on downtrend?
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
349 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