VRM -- Volume Required for Movement For ThinkOrSwim

mashume

Expert
VIP
Lifetime

VRM

Volume Per Movement

http://tos.mx/aTJtmmw

The theory here is that sometimes a security will move more easily up or down given the same volume. This indicator attempts to discern whether movement up or down takes less volume and is therefore more likely in a given market.

IMPORTANT This indicator is 'upside down' where the lower the value the more easily the stock moves. Since it is volume required for a given movement, this makes sense. When the green line is below the red, it takes less volume to move up and when the red line is below the green, it takes less volume to move lower. When either line is very low, it takes very little volume to move a signifigant distance, and conversely if the lines are both quite high, it takes a lot of volume to move the price.

That is, if you see volume as driving price movement.

Eye Candy

ekd0FwC.png


Code:
################################
#
# VISCOSITY
#
# Volume Required for Movement
#
# By Mashume for the UseThinkScript Community
#
# 2022-05-08
#
################################

declare lower;
input length = 20;
input k_length = 8;
input d_length = 34;

script worden {
    input values = close;
    input count = 25;
    input length = 25;
    input k = 3;
    input d = 5;

    def rank = fold i = 0 to length 
        with rankcounter = 0 
        do if values != 0 and values > GetValue(values, i) 
            then rankcounter + 1 else rankcounter;

    def w = ( 100 / ( count + 0 ) ) * rank;

    plot Worden = SimpleMovingAvg(w, k);
    plot signal = SimpleMovingAvg(Worden, d);
}

def up = if close > open then 1 else 0;
def dn = if close < open then 1 else 0;
def nc = if close == open then 1 else 0;

def up_vols = if up == 1 then volume else Double.POSITIVE_INFINITY;
def dn_vols = if dn == 1 then volume else Double.POSITIVE_INFINITY;

def change = if AbsValue(close - open) != 0 then AbsValue((close - open) / open) else 1;

def up_change_per_volume = up_vols / change;
def dn_change_per_volume = dn_vols / change;

def up_worden = worden(up_change_per_volume, (sum(up, length) + sum(nc, length)), length, k = k_length, d = d_length).signal;
def dn_worden = worden(dn_change_per_volume, (sum(dn, length) + sum(nc, length)), length, k = k_length, d = d_length).signal;
def vol_worden = worden(VOLUME, length * 1.5, k = k_length, d = d_length).signal;

plot pos_indicator = up_worden;
plot neg_indicator = dn_worden;

pos_indicator.SetDefaultColor(Color.GREEN);
neg_indicator.SetDefaultColor(Color.RED);

As always, this is provided free for the UseThinkScript community under applicable open source licenses.

Happy Trading,
mashume
 

VRM

Volume Per Movement

http://tos.mx/aTJtmmw

The theory here is that sometimes a security will move more easily up or down given the same volume. This indicator attempts to discern whether movement up or down takes less volume and is therefore more likely in a given market.

IMPORTANT This indicator is 'upside down' where the lower the value the more easily the stock moves. Since it is volume required for a given movement, this makes sense. When the green line is below the red, it takes less volume to move up and when the red line is below the green, it takes less volume to move lower. When either line is very low, it takes very little volume to move a signifigant distance, and conversely if the lines are both quite high, it takes a lot of volume to move the price.

That is, if you see volume as driving price movement.

Eye Candy

ekd0FwC.png


Code:
################################
#
# VISCOSITY
#
# Volume Required for Movement
#
# By Mashume for the UseThinkScript Community
#
# 2022-05-08
#
################################

declare lower;
input length = 20;
input k_length = 8;
input d_length = 34;

script worden {
    input values = close;
    input count = 25;
    input length = 25;
    input k = 3;
    input d = 5;

    def rank = fold i = 0 to length
        with rankcounter = 0
        do if values != 0 and values > GetValue(values, i)
            then rankcounter + 1 else rankcounter;

    def w = ( 100 / ( count + 0 ) ) * rank;

    plot Worden = SimpleMovingAvg(w, k);
    plot signal = SimpleMovingAvg(Worden, d);
}

def up = if close > open then 1 else 0;
def dn = if close < open then 1 else 0;
def nc = if close == open then 1 else 0;

def up_vols = if up == 1 then volume else Double.POSITIVE_INFINITY;
def dn_vols = if dn == 1 then volume else Double.POSITIVE_INFINITY;

def change = if AbsValue(close - open) != 0 then AbsValue((close - open) / open) else 1;

def up_change_per_volume = up_vols / change;
def dn_change_per_volume = dn_vols / change;

def up_worden = worden(up_change_per_volume, (sum(up, length) + sum(nc, length)), length, k = k_length, d = d_length).signal;
def dn_worden = worden(dn_change_per_volume, (sum(dn, length) + sum(nc, length)), length, k = k_length, d = d_length).signal;
def vol_worden = worden(VOLUME, length * 1.5, k = k_length, d = d_length).signal;

plot pos_indicator = up_worden;
plot neg_indicator = dn_worden;

pos_indicator.SetDefaultColor(Color.GREEN);
neg_indicator.SetDefaultColor(Color.RED);

As always, this is provided free for the UseThinkScript community under applicable open source licenses.

Happy Trading,
mashume
Hey mashume congratulation! This is a very nice indicator, I changed simple for exponential and even its small movement it show you a good signals. I change the numbers too a little be to 20, 5, 30 and the signal is good as I said!
 
Last edited:
Hey mashume congratulation! This is a very nice indicator, I changed simple for exponential and even its small movement it show you a good signals. I change the numbers too a little be to 20, 5, 30 and the signal is good as I said!
I had not extensively backtested to determine optimum lengths before releasing the code. I'm glad you found a setting that works for you and the instruments you trade!

And thanks for reporting back on this one. It's always good to hear whether and how other traders find these scripts I come up with useful.

Thanks,
-mashume
 
Thank you for this indicator. I am studying it. meantime, what inspired you to this indicator?
 
Thank you for this indicator. I am studying it. meantime, what inspired you to this indicator?
I've been trying to find an angle on volume for some time. I was studying the pdf in this thread:

https://usethinkscript.com/threads/stokes-law-and-reynolds-number.10904/#post-95749

and was trying to come up with some notion of viscosity in terms of volume and hit on the notion that the amount of volume required to move an instrument a given distance might be analogous to the force required (volume) to move through a viscous fluid (price) and that the more force required to move or the more viscous the liquid the less movement you would see for a given force.

That ratio and calculating the ratios for up and down candles and comparing them is what I've tried to accomplish in this indicator. The Worden stochastic (which is used here) is just a way of ranking the values based not on value like a normal stochastic, but rather on rank out of the last n values. It does away with a lot of the pre and post market hours change in absolute volume by ranking the points rather than using their values. This helps me with trading futures which have such long pre and after session hours and a large volume increase during regular trading hours.

-mashume
 

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