4 Candle High Low Retracement Watchlist Column For ThinkOrSwim

Mr D

New member
4 Candle Swing Retracement Watchlist Column For ThinkOrSwim
This study tells you the strength of movement on a given timeframe. Set up 3-4 WL columns for your timeframes of interest, say 1m 5m 15m 60m. When they are all bright green or bright red, that's strong momentum.

Ruby:
``````##############################
# Retracement WL Column      #
# 4 candle swing retracement #
# Color codes:               #
# >  0.79: bright green      #
# < -0.79: bright red        #
# <  0.38: cyan              #
# > -0.38: magenta           #
# < 0: dark_red              #
# > 0: dark_green            #
##############################

def H = if high >= high[1] and high >= high[2] and high>=high[3] then high
else if high[1] >= high and high[1] >= high[2] and high[1]>=high[3] then high[1]
else if high[2] >= high and high[2] >= high[1] and high[2]>=high[3] then high[2]
else high[3];
def L = if low <= low[1] and low <= low[2] and low <= low[3] then low
else if low[1] <= low and low[1] <= low[2] and low[1] <= low[3] then low[1]
else if low[2] <= low and low[2] <= low[1] and low[2] <= low[3] then low[2]
else low[3];
def HP =if high >= high[1] and high >= high[2] and high>=high[3] then 0
else if high[1] >= high and high[1] >= high[2] and high[1]>=high[3] then 1
else if high[2] >= high and high[2] >= high[1] and high[2]>=high[3] then 2
else 3;
def LP = if low <= low[1] and low <= low[2] and low <= low[3] then 0
else if low[1] <= low and low[1] <= low[2] and low[1] <= low[3] then 1
else if low[2] <= low and low[2] <= low[1] and low[2] <= low[3] then 2
else 3;

plot rsi= if lp>hp then (close - L)/(H-L) else if hp>lp then (close - H)/(H-L)
else if close>open[2] then (close-L)/(H-L) else (close-H)/(H-L);
def up = rsi>0.79;
def dn = rsi<-0.79;
def ur = rsi>0 and rsi<0.38;
def dr = rsi<0 and rsi>-0.38;

rsi.assignValueColor( if dn or up or ur or dr then color.black else color.white);
assignbackgroundcolor(if up then color.green else if dn then color.red
else if ur then color.cyan else if dr then color.magenta
else if rsi>0 then color.dark_green else color.dark_red);

#######
# END #
#######``````

Last edited by a moderator:
This is a good study. I think its great because you can see multiple stocks on watch while using it. I would defiantly like to see this as an addlabel in the future so it doesn't have to take up space on the watchlist. In conclusion though, great work.

Not the exact question you're looking for?

87k+ Posts
324 Online

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• 1 full year of unlimited support

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?