Script to alert Current Candle closed with Higher Volume than Prior Candle

eulin87

Member
I have searched in the forum but have only found scripts that plot higher average over certain amount of days or candles. I'm looking for a way to alert if current candle had higher volume than the prior candle. If it matters, I'm usually on the 15 minute when using this method with Supply and Demand. Would be nice to use with all time frames but I'm mostly on the 15. Just looking to have a basic arrow or even a colored candle perhaps? Just something to alert me because sometimes the volume is pretty close or at times I might forget to check the volume so this would visually help. Thank you!

Also, I'm aware of that there are scripts that have a whole setup for VPA and volume but I like to keep my chart simple so would just like a simple indication. Thank you!

Screenshot-2022-09-02-170132.png
Screenshot-2022-09-02-170239.png
 

Attachments

  • Screenshot-2022-09-02-170132.png
    Screenshot-2022-09-02-170132.png
    89.3 KB · Views: 380
Last edited:
Solution
I have searched in the forum but have only found scripts that plot higher average over certain amount of days or candles. I'm looking for a way to alert if current candle had higher volume than the prior candle. If it matters, I'm usually on the 15 minute when using this method with Supply and Demand. Would be nice to use with all time frames but I'm mostly on the 15. Just looking to have a basic arrow or even a colored candle perhaps? Just something to alert me because sometimes the volume is pretty close or at times I might forget to check the volume so this would visually help. Thank you!

Also, I'm aware of that there are scripts that have a whole setup for VPA and volume but I like to keep my chart simple so would just like a...
I have searched in the forum but have only found scripts that plot higher average over certain amount of days or candles. I'm looking for a way to alert if current candle had higher volume than the prior candle. If it matters, I'm usually on the 15 minute when using this method with Supply and Demand. Would be nice to use with all time frames but I'm mostly on the 15. Just looking to have a basic arrow or even a colored candle perhaps? Just something to alert me because sometimes the volume is pretty close or at times I might forget to check the volume so this would visually help. Thank you!

Also, I'm aware of that there are scripts that have a whole setup for VPA and volume but I like to keep my chart simple so would just like a simple indication. Thank you!

Screenshot-2022-09-02-170132.png
Screenshot-2022-09-02-170239.png

Try this

def vol = volume > volume[1];

input pricecolor = yes;
AssignPriceColor(if pricecolor and vol
then Color.YELLOW
else Color.CURRENT);

input arrows = yes;
plot arrowvol = if arrows and vol then high else Double.NaN;
arrowvol.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
arrowvol.SetDefaultColor(Color.YELLOW);
arrowvol.SetLineWeight(5);
 

Attachments

  • Screenshot-2022-09-02-170132.png
    Screenshot-2022-09-02-170132.png
    89.3 KB · Views: 272
Solution

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

You're amazing! Simple, love it and thank you for placing options to remove both arrows and candle coloring. I was wondering if there is anyway to only have it signal when the candle is hitting/crossing a Price Line. Just wondering if there is a way to limit the other signals that are not within a zone. Obviously I would not buy/sell just because of the signal but would be more for aesthetic which won't be such a big deal if not doable. Thank you again!
Screen-Shot-2022-09-03-at-2-44-56-PM.png
 
You're amazing! Simple, love it and thank you for placing options to remove both arrows and candle coloring. I was wondering if there is anyway to only have it signal when the candle is hitting/crossing a Price Line. Just wondering if there is a way to limit the other signals that are not within a zone. Obviously I would not buy/sell just because of the signal but would be more for aesthetic which won't be such a big deal if not doable. Thank you again!
Screen-Shot-2022-09-03-at-2-44-56-PM.png

If your lines are script, should be able to do. If drawing tool created lines, then it will not work.
 
Ah ok I understand! I'm trying to come up with another condition to limit the signals but this should work for now. Thank you again!

This may give a better way to test to see what might be helpful.

It allows you to create how many volume > volume[1] in a row through input bars and the sum() function.

Added also are inputs for two price lines and crosses of those by price will be required for an arrow or candle color. These can be used similar to the drawing tool or in conjuntion with it
.
Capture.jpg


The settings in the image are 2 bars in a row of volume > volume[1] and crosses of either line.

Ruby:
input bars = 1;
def vol    = sum(volume > volume[1], bars) == bars;

input price = close;
input line1 = 14.10;
plot pline1 = line1;
input line2 = 14.03;
plot pline2 = line2;

input pricecolor = yes;
AssignPriceColor(if pricecolor and vol and
                    (price crosses pline1 or
                     price crosses pline2)
then Color.YELLOW
else Color.CURRENT);

input arrows = yes;
plot arrowvol = if arrows and vol and
                   (price crosses pline1 or
                    price crosses pline2)
                     then high else Double.NaN;
arrowvol.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
arrowvol.SetDefaultColor(Color.YELLOW);
arrowvol.SetLineWeight(5);
 
This may give a better way to test to see what might be helpful.

It allows you to create how many volume > volume[1] in a row through input bars and the sum() function.

Added also are inputs for two price lines and crosses of those by price will be required for an arrow or candle color. These can be used similar to the drawing tool or in conjuntion with it
.
Capture.jpg


The settings in the image are 2 bars in a row of volume > volume[1] and crosses of either line.

Ruby:
input bars = 1;
def vol    = sum(volume > volume[1], bars) == bars;

input price = close;
input line1 = 14.10;
plot pline1 = line1;
input line2 = 14.03;
plot pline2 = line2;

input pricecolor = yes;
AssignPriceColor(if pricecolor and vol and
                    (price crosses pline1 or
                     price crosses pline2)
then Color.YELLOW
else Color.CURRENT);

input arrows = yes;
plot arrowvol = if arrows and vol and
                   (price crosses pline1 or
                    price crosses pline2)
                     then high else Double.NaN;
arrowvol.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
arrowvol.SetDefaultColor(Color.YELLOW);
arrowvol.SetLineWeight(5);
Wow! AMAZING. This would actually be helpful too because it would force one to be patient for an entry which is the way I like to trade! Is there any way to have the option to also just leave it open like the first code? That way if I wanted to use this same script but on a lower time frame, I can just "TURN OFF" that feature where it would need to hit a price line and instead just go off of volume instead of having to input the price lines. I guess I can just use the old script as well "V1" And "V2".


Screen-Shot-2022-09-03-at-7-21-30-PM.png
 
Last edited:
Wow! AMAZING. This would actually be helpful too because it would force one to be patient for an entry which is the way I like to trade! Is there any way to have the option to also just leave it open like the first code? That way if I wanted to use this same script but on a lower time frame, I can just "TURN OFF" that feature where it would need to hit a price line and instead just go off of volume instead of having to input the price lines. I guess I can just use the old script as well "V1" And "V2".


Screen-Shot-2022-09-03-at-7-21-30-PM.png

Sure, here is the uselinecross input to turn off/on the cross portion of the code

Ruby:
input bars = 1;
def vol    = sum(volume > volume[1], bars) == bars;

input uselinecross = no;
input price = close;
input line1 = 14.10;
plot pline1 = line1;
input line2 = 13.03;
plot pline2 = line2;

input pricecolor = yes;
AssignPriceColor(if pricecolor and vol and !uselinecross or
                    pricecolor and vol and uselinecross and
                         (price crosses pline1 or
                          price crosses pline2)
                 then Color.YELLOW
                 else Color.CURRENT);

input arrows = yes;
plot arrowvol = if arrows and vol and !uselinecross or
                   arrows and vol and uselinecross and       
                    (price crosses pline1 or
                     price crosses pline2)
                then high
                else Double.NaN;
arrowvol.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
arrowvol.SetDefaultColor(Color.YELLOW);
arrowvol.SetLineWeight(5);
 
Sure, here is the uselinecross input to turn off/on the cross portion of the code
I took the liberty and renamed the lines to "Demand" and "Supply". I also changed the default arrows to thinner wedge ones. OCD thing I guess. lol. Here is the code in case anyone else wants it as well. Thank you again @SleepyZ ! 🤘

Code:
input bars = 1;
def vol    = sum(volume > volume[1], bars) == bars;

input uselinecross = no;
input price = close;
input Demand = 14.10;
plot DemandLine = Demand;
input Supply = 13.03;
plot SupplyLine = Supply;

input pricecolor = no;
AssignPriceColor(if pricecolor and vol and !uselinecross or
                    pricecolor and vol and uselinecross and
                         (price crosses DemandLine or
                          price crosses SupplyLine)
                 then Color.YELLOW
                 else Color.CURRENT);

input arrows = yes;
plot arrowvol = if arrows and vol and !uselinecross or
                   arrows and vol and uselinecross and       
                    (price crosses DemandLine or
                     price crosses SupplyLine)
                then high
                else Double.NaN;
arrowvol.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP);
arrowvol.SetDefaultColor(Color.YELLOW);
arrowvol.SetLineWeight(1);

Screen-Shot-2022-09-04-at-11-20-20-AM.png


Screen-Shot-2022-09-04-at-11-17-52-AM.png
 
I was wondering if there was a way to only have the Volume bar below colored when volume surpasses prior candles volume. Trying to find ways to simplify the chart even more.

Screenshot-2022-09-19-195038.png
 
I was wondering if there was a way to only have the Volume bar below colored when volume surpasses prior candles volume. Trying to find ways to simplify the chart even more.

Screenshot-2022-09-19-195038.png

This should help

Ruby:
declare on_volume;
plot v = if volume()>volume()[1] then volume else double.nan;
v.setlineWeight(5);
v.setdefaultColor(color.yellow);
v.setpaintingStrategy(paintingStrategy.HISTOGRAM);
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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