Volume Based Candles Identifier for ThinkorSwim

BenTen

Administrative
Staff member
Staff
VIP
Lifetime
Note: For this ThinkorSwim version, I have made changes to the coloring a bit.
  • LIGHT GREEN = WHITE and Orange = BLUE

d35CP2B.png


Most of the time traders are confused about if the price movements were supported by VOLUME. This indicator colors the bars into volume weighted signals...When prices go down bars are red and controversially when up, bars are green. Additionally we have two more colors for each situation:
  • DARK RED when prices go down and VOLUME is bigger than 150% of its (default 21 day) average, that indicates us price action is supported by a strong BEARISH VOLUME
  • RED when prices go down and VOLUME is BETWEEN 50% AND 150% of its (default 21 day) average, at this situation we can think that volume is neither strong nor weak
  • ORANGE when prices go down and VOLUME is just less than 50% of its (default 21 day) average, so the volume is weak and doesn't support the price action much
  • DARK GREEN when prices go UP and VOLUME bigger than 150% of its (default 21 day) average, that indicates us price action is supported by a strong BULLISH VOLUME
  • GREEN when prices go UP and VOLUME is BETWEEN 50% AND 150% of its (default 21 day) average, at this situation we can think that volume is neither strong nor weak
  • LIGHT GREEN when prices go UP and VOLUME is just less than 50% of its (default 21 day) average, so the volume is weak and doesn't support the price action much

thinkScript Code

Code:
# Volume Based Coloured Bars
# Assembled by BenTen at useThinkScript.com
# Converted from https://www.tradingview.com/script/8RPiMMmn-Volume-Based-Coloured-Bars/

# Note: LIGHT GREEN = WHITE and Orange = BLUE

input length = 21;

def avrg = simpleMovingAvg(volume, length);

def vold1 = volume > avrg * 1.5 and close<open;
def vold2 = volume >= avrg*0.5 and volume<=avrg*1.5 and close<open;
def vold3 = volume < avrg *0.5 and close<open;

def volu1 = volume > avrg*1.5 and close>open;
def volu2 = volume >= avrg * 0.5 and volume<=avrg*1.5 and close>open;
def volu3 = volume < avrg * 0.5 and close>open;

assignPriceColor(if vold1 then color.dark_red else if vold2 then color.red else if vold3 then color.blue else if volu1 then color.dark_green else if volu2 then color.uptick else if volu3 then color.white else color.CYAN);
 

CashPrince

New member
I like the idea but find it a bit confusing especially with the color white and blue. maybe it is because I am not catching its use from a day trading perspective. I wonder if it is possible to eliminate some colors or somehow correlate them with the distance of VWAP or some type of relation to the 50 and 200 EMA?
 

CashPrince

New member
@BenTen when I day-trade, I like to take into account the distance of the stock move away from the 9 EMA, VWAP, 50 & 200 EMA respectively. To have the indicator configurable for those targets on a 14 or 50 day period would be gold because you can backtest the method for a conservative entry with stop loss.

Another candle-coloring option would be to leverage the 4 periods RSI at 90 and 10 percent as an oversold/overbought indicator on a multi-timeframe--especially 30 minutes or day. So in other words, over 90% and 10% would indicate a customizable respective colored candle.

I think the Z-Score indicator covers my thoughts on the distance from the VWAP but leveraging that logic and other logics suggested above on the candle color would help a great deal because it would give you not only volume customization option but others as well.

I know it is a bit of a loaded request that could be for a different indicator but it would add diverse flexibility to different-styled day traders that need one less indicator on their chart.

Thanks for the consideration, you rock!
Prince
 
Last edited:

SupaDupa

New member
Is there a way to show volume by increasing decreasing the width of the candle i.e. fatter candles would represent increase volume and vice versa TY
 
@BenTen, could you possibly add to the code the ability to color the candles based on the average of the last 3 candles let's say (you can leave that open for everyone to put their own number). I think this will help us "Smooth" the noise that may come from just 1 candle/print. And if we can combine that with what @DeusMecanicus shared, I think we would have a GREAT indicator. Much appreciated and thank you for your help in advance.
 

BenTen

Administrative
Staff member
Staff
VIP
Lifetime
This indicator was requested by a member of ours. Here is his concept of the script:
  • When volume is drying up while the RSI is overbought = bearish
  • When volume is rising while the RSI is oversold = bullish
Test it out and let us know if it helps. Give the candles sometime to play the trend out even if it's already in overbought or oversold territory.

Paintbars and arrows are being plotted by default. You can easily turn either one off via the indicator's setting. No need to touch the code.

KARuTuV.png


thinkScript Code

Code:
# Volume Based Reversal Candles
# When volume is drying up while it's overbought = bearish
# When volume is rising while it's oversold = bullish
# Assembled by BenTen at useThinkScript.com

input paintbar = yes;
input arrows = yes;

# Start RSI
input length = 14;
input over_Bought = 65;
input over_Sold = 35;
input price = close;
input averageType = AverageType.WILDERS;
def NetChgAvg = MovingAverage(averageType, price - price[1], length);
def TotChgAvg = MovingAverage(averageType, AbsValue(price - price[1]), length);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;
def RSI = 50 * (ChgRatio + 1);
def OverSold = over_Sold;
def OverBought = over_Bought;

def bearish_vol = VOLUMEAVG(LENGTH = 20) < VOLUMEAVG(LENGTH = 20)[5];
def bullish_vol = VOLUMEAVG(LENGTH = 20) > VOLUMEAVG(LENGTH = 20)[5];

def bullish_signal = RSI(length = length, averageType = averageType) < over_Sold and bullish_vol;
def bearish_signal = RSI(length = length, averageType = averageType) > over_Bought and bearish_vol;

assignPriceColor(if paintbar and bullish_signal then color.green else if paintbar and bearish_signal then color.red else if paintbar then color.white else color.current);

# Plot Signals
plot bullish = if arrows and bullish_signal then bullish_signal else double.nan;
bullish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
bullish.SetDefaultColor(Color.CYAN);
bullish.SetLineWeight(1);
plot bearish = if arrows and bearish_signal then bearish_signal else double.nan;
bearish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
bearish.SetDefaultColor(Color.CYAN);
bearish.SetLineWeight(1);
 
Last edited:

Wiinii

Member
VIP
I really like this idea, thanks for making it!

I've customized it just a bit to my liking to make the highest volume bars the brightest, and the lowest volume bars the darkest (first pic).

EDIT: I've added color/transparency options for the bars under Globals in options. The second pic below shows settings of Red and Green at RGB Colors Low=80, Med=175, High=255.

Code:
# Volume Based Coloured Bars
# Assembled by BenTen at useThinkScript.com
# Converted from https://www.tradingview.com/script/8RPiMMmn-Volume-Based-Coloured-Bars/
# Modified by Wiinii (added color/transparency options under Global
# Recommended Colors Low=80, Med=175, High=255

input length = 21;

def avrg = simpleMovingAvg(volume, length);

def UVolHi = volume > avrg*1.5 and close>open;
def UVolMed = volume >= avrg * 0.5 and volume<=avrg*1.5 and close>open;
def UVolLow = volume < avrg * 0.5 and close>open;

def DVolHi = volume > avrg * 1.5 and close<open;
def DVolMed = volume >= avrg*0.5 and volume<=avrg*1.5 and close<open;
def DVolLow = volume < avrg *0.5 and close<open;

DefineGlobalColor("DVolHi", Color.red);
DefineGlobalColor("DVolMed", Color.downtick);
DefineGlobalColor("DVolLow", Color.dark_red);
DefineGlobalColor("UVolHi", Color.green);
DefineGlobalColor("UVolMed", Color.uptick);
DefineGlobalColor("UVolLow", Color.dark_green);
DefineGlobalColor("NoVol", Color.CYAN);

assignPriceColor(if UVolHi then GlobalColor("UVolHi") else if UVolMed then  GlobalColor("UVolMed") else if UVolLow then GlobalColor("UVolLow") else if DVolHi then GlobalColor("DVolHi") else if DVolMed then GlobalColor("DVolMed") else if DVolLow then GlobalColor("DVolLow") else GlobalColor("NoVol"));

3FCnKDz



3EFV0rX
 
Last edited:

Nari2007

Member
@princesly How would you like to eliminate some colors? Do you just want to keep the price bar that isn't being supported by volume? For example, say the stock is moving up, but volume is less than 50%? As far as distance from VWAP goes, you can take a look at this indicator: https://usethinkscript.com/threads/vwap-deviation-z-score-with-chart-and-lower-indicators.602/
anyway to add to Candle Coloring Scripts? seems like one overrides the other,,,,, id like to add rsi candles to this,,,

or maybe a script that shows bullish when rsi is over 50 line, bearish when below the 50 line,,, but the turn a different color when it is above 70 line and below 30 line,,,

seems like it only takes ones candle coloring script at once
 

Nari2007

Member
thanks Mate,, any way to add RSI conditions alone with this set up???

if rise is above 70 change color if below 30 change color,, otherwise keep the candles with your code...
 
Last edited by a moderator:

Wiinii

Member
VIP
Note: For this ThinkorSwim version, I have made changes to the coloring a bit.
  • LIGHT GREEN = WHITE and Orange = BLUE

d35CP2B.png




thinkScript Code

Code:
# Volume Based Coloured Bars
# Assembled by BenTen at useThinkScript.com
# Converted from https://www.tradingview.com/script/8RPiMMmn-Volume-Based-Coloured-Bars/

# Note: LIGHT GREEN = WHITE and Orange = BLUE

input length = 21;

def avrg = simpleMovingAvg(volume, length);

def vold1 = volume > avrg * 1.5 and close<open;
def vold2 = volume >= avrg*0.5 and volume<=avrg*1.5 and close<open;
def vold3 = volume < avrg *0.5 and close<open;

def volu1 = volume > avrg*1.5 and close>open;
def volu2 = volume >= avrg * 0.5 and volume<=avrg*1.5 and close>open;
def volu3 = volume < avrg * 0.5 and close>open;

assignPriceColor(if vold1 then color.dark_red else if vold2 then color.red else if vold3 then color.blue else if volu1 then color.dark_green else if volu2 then color.uptick else if volu3 then color.white else color.CYAN);

This changes the volume bars too, which is great. Any way to add an average volume line to it?
 

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.
Top