Average Volume Deviation For ThinkOrSwim

Pelonsax

Active member
VIP
I'm playing around with the idea of volume divergences, so I wanted to see an average of volume deviated from the norm. I couldn't really find anything already scripted, so I made this. So far, I don't have any correlation other than the fact that when volume increases, range and volatility also increase. But it's interesting enough to pursue and share so here you go. Enjoy.

https://tos.mx/l0jtfkw

rgiXVjJ.png


Code:
#-------------------------------
#
# AVERAGE VOLUME DEVIATION
# Author: Ramon DV aka Pelonsax
#
#--------------------------------
declare lower;

input length = 7;
input signalLength = 10;
input averageType = AverageType.EXPONENTIAL;
input showBreakoutSignals = yes;

def V = volume;

plot AVD = MovingAverage(averageType, V, length);
plot Signal = MovingAverage(averageType, AVD, signalLength);

plot UpSignal = if AVD crosses above signal then signal else Double.NaN;
plot DownSignal = if AVD crosses below signal then signal else Double.NaN;

UpSignal.SetHiding(!showBreakoutSignals);
DownSignal.SetHiding(!showBreakoutSignals);

Signal.SetDefaultColor(GetColor(2));

AVD.SetDefaultColor(GetColor(5));
AVD.SetPaintingStrategy(PaintingStrategy.line);
AVD.SetLineWeight(3);

AVD.DefineColor("Above and Up", Color.GREEN);
AVD.DefineColor("Above and Down", Color.DARK_GREEN);
AVD.DefineColor("Below and Down", Color.RED);
AVD.DefineColor("Below and Up", Color.DARK_RED);
AVD.DefineColor("Current", Color.CURRENT);

AVD.AssignValueColor( if AVD > Signal and AVD > AVD[1] then
AVD.Color("Above and Up") else if AVD >= Signal and AVD < AVD[1] then
AVD.Color("Above and Down") else if AVD < Signal  and AVD < AVD[1] then
AVD.Color("Below and Down") else if AVD <= Signal and AVD > AVD[1] then
AVD.Color("Below and Up") else AVD.Color("Current"));
 

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
492 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