Compare RelativeVolumeStDev Bars

XeoNoX

Expert
VIP
Lifetime
You stated "RelativeVolumeStDev ( StdLevel not vol)."
You stated "curbar.StdLevel "

For the most part without the source code you are working with we have no clue what those syntax u mentioned above means or what you are referring to.

And 2nd of all ...the STDLEVEL syntax on the RelativeVolumeStDev is a constant that is manually inputed and does not change, so it cant be higher or lower than what you set it at input. therefore it nullifies your scan.
 
Thanks Xeo, as I said I’m a dummy when it comes to this. What I’m trying to achieve is something like the following (not in thinkscript, just how the operations would work):

def curvol = standardeviation of current bar
Def uppvol = highest standard deviation over last 10 bars

if curvol >= uppvol then return false, otherwise return true.

I’m only interested in which deviation range the volume falls and not necessarily the actual volume. I.e. 1, 2, 3, 4, etc.

Does this help?
 
@jphilli11

COUNTS NUMBER OF BARS ABOVE XYZ Relative VOLUME STD DEV in PAST XYZ BARS

ZFLPfT2.png



Code:
declare lower;
declare zerobase;
#COUNTS NUMBER OF BARS ABOVE XYZ Relative VOLUME STD DEV in PAST XYZ BARS
#BY XEONOX VIA USETHINKSCRIPT.COM

input length = 60;
input numDev = 2.0;
input allowNegativeValues = no;

def rawRelVol = (volume - Average(volume, length)) / StDev(volume, length);
plot RelVol = if allowNegativeValues then rawRelVol else Max(0, rawRelVol);
plot StDevLevel = numDev;

RelVol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
RelVol.SetLineWeight(3);
RelVol.DefineColor("Above", GetColor(0));
RelVol.DefineColor("Below", GetColor(2));
RelVol.AssignValueColor(if RelVol >= numDev then RelVol.Color("Above") else RelVol.Color("Below"));
StDevLevel.SetDefaultColor(GetColor(7));
StDevLevel.SetStyle(Curve.SHORT_DASH);
#COUNTS BARS ABOVE XYZ REL VOL STD DEV
input count_length = 10;
def count_above = Sum(RelVol > numdev, count_length);
AddLabel(yes,
         "No. of closes above " + numDev + " RelVol Std Dev in the past " + count_length + " bars = " + count_above,
         Color.ORANGE);

above code counts number of bars within xyz relative volume standard deviation
Remember to hit the like button if you found this post useful
 
i kind of love this and would also love to see it as a custom watchlist column, with numbers indicating how far back in the past the last instance of xyz rel vol stan dev took place. possible?

i've been working on it myself, not with this study but with the tape momentum one, with not a lot of luck. i'm figuring if someone can do it for this indicator, i'll be able to figure it out for the other. likely story, i know, but ya never know!
 
well, i think i did it myself. didn't seem so hard ... ifn i did it right. anyone care to double check?

Code:
#COUNTS NUMBER OF BARS ABOVE XYZ Relative VOLUME STD DEV in PAST XYZ BARS
#BY XEONOX VIA USETHINKSCRIPT.COM

input length = 60;
input numDev = 2.0;
input allowNegativeValues = no;

def rawRelVol = (volume - Average(volume, length)) / StDev(volume, length);
def RelVol = if allowNegativeValues then rawRelVol else Max(0, rawRelVol);
def StDevLevel = numDev;


#COUNTS BARS ABOVE XYZ REL VOL STD DEV
input count_length = 10;
def count_above = Sum(RelVol > numdev, count_length);

plot value = count_above;
 
Last edited:
seems to be working so far. thanks for the response. btw / if you've got a moment, how would you change it to show the number of bars back the last firing of the desired state took place?
 

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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