Candlestick Sentiment Indicator for ThinkorSwim

BenTen

Administrative
Staff member
Staff
VIP
Lifetime
My recent discovery in terms of trading learning materials is "YTC Price Action Trader" book. It contains numerous invaluable clues, which I couldn't find anywhere else. One YTC chapter covers Candle Sentiment analysis. Watching where 'close' of the candle happens can give early hints about future market action. Most of time you get those hints before the indicators provide it.

Close Sentiment: This is single-candle analysis. Divide entire range of a candle (low to high) into 3 equal parts. The candle is:
  • "High Close" - if 'close' is in the upper 1/3
  • "Mid Close" - if 'close' is in the middle 1/3
  • "Low Close" - if 'close' is in the lower 1/3
Close Comparison: Compare position of 'close' with entire range of the previous candle. The candle is:
  1. Bull Candle - if 'close' is above 'high' of the previous candle
  2. Range Candle - if 'close' is between 'high' and 'low' of the previous candle
  3. Bear Candle - if 'close' is below 'low' of the previous candle
What can you do with this? It gives very good and early reversal hints. Mid/ranging signals should be considered "no signals" - in other words: market will continue in the same direction.

piIs08j.png

sTNEfZn.png


thinkScript Code

Code:
# YTC Candlestick Sentiment
# Assembled by BenTen at useThinkScript.com
# Converted from https://www.tradingview.com/script/5fSgjYoM-YTC-Candlestick-Sentiment/

def highclose = (close - low) >= (2 * (high - low) / 3);
def midclose=(close-low)>((high-low)/3) and (close-low)<(2* (high-low)/3);
def lowclose = (close - low) <= ((high - low) / 3);
def YTCbullcandle = close > high[1];
def YTCrangecandle = close < high[1] and close>low[1];
def YTCbearcandle = close < low[1];

assignPriceColor(if YTCbullcandle then Color.GREEN else if YTCbearcandle then Color.RED else Color.WHITE);
 

Attachments

  • piIs08j.png
    piIs08j.png
    83.5 KB · Views: 143
  • sTNEfZn.png
    sTNEfZn.png
    84.5 KB · Views: 156

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

You may have stumbled onto something here.... on the ROKU chart you seem to get a white candle between polarity changes. Just a clue? Maybe.
 
ben - very cool - glad you're bring/porting price based indicators. this one has potential!

Does a nice job on daily chart stop trends and reversal - here is the longer time frame 1Y on SPY

Qs1KGZp.png
 

Attachments

  • Qs1KGZp.png
    Qs1KGZp.png
    104.2 KB · Views: 157
Last edited by a moderator:
Here is the revised version.

Ruby:
# YTC Candlestick Sentiment
# Assembled by BenTen at useThinkScript.com
# Converted from https://www.tradingview.com/script/5fSgjYoM-YTC-Candlestick-Sentiment/
# 2019.10.08 - diazlaz - Adding states, thresholds, arrows and color bars.

def highclose = (close - low) >= (2 * (high - low) / 3);
def midclose=(close-low)>((high-low)/3) and (close-low)<(2* (high-low)/3);
def lowclose = (close - low) <= ((high - low) / 3);
def YTCbullcandle = close > high[1];
def YTCrangecandle = close < high[1] and close>low[1];
def YTCbearcandle = close < low[1];

# assignPriceColor(if YTCbullcandle then Color.GREEN else if YTCbearcandle then Color.RED else Color.WHITE);

#INPUTS
input showColorBars = yes;
input showArrows = yes;
input YTCThreshold = 2;

#STATES
def sYTC1 = if YTCbullcandle then 100 else if YTCbearcandle then -100 else sYTC1[1];
def sYTC2 = if Sum(sYTC1, YTCThreshold) >= (YTCThreshold * 100) then 100 else if Sum(sYTC1, YTCThreshold) <= (YTCThreshold * -100) then -100 else sYTC2[1];
def sState = sYTC2;

#ARROWS
def sUP = sState crosses above 0;
def sDown = sState crosses below 0;

plot pUP = if !isNan(sUP) then sUP else Double.NaN;
pUP.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
pUP.SetDefaultColor(Color.GREEN);
pUP.SetLineWeight(2);
pUP.SetHiding(!showArrows);

plot pDown = if !isNan(sDown) then sDown else Double.NaN;
pDown.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
pDown.SetDefaultColor(Color.RED);
pDown.SetLineWeight(2);
pDown.SetHiding(!showArrows);

#COLORBARS
def pCB = sState;

AssignPriceColor(
if showColorBars then
 
 if IsNaN(pCB) then Color.DARK_GRAY else
 if pCB == 100 then Color.GREEN else
 Color.RED

else

  Color.CURRENT
);

# End of YTC Candlestick Sentiment
 
Last edited by a moderator:
Nice using this indicator today would have caught and or confirmed many moves in PANW today.
 
@Charles Wish I can take credit but I can't. The original developer was the real genius. I just converted his script from TradingView to ThinkorSwim.
 
Most reversals of a trend occur with a consolidation phase of two or more candles. Since this highlights range bound candles it may highlight those areas of potential reversal. Be careful of trading isolated white candles.
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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