# Volatility Based Momentum Indicator for ThinkorSwim

#### BenTen

Staff member
Staff
VIP
The Volatility Based Momentum (VBM) indicator is a variation on the rate-of-change ( ROC ) indicator. Instead of expressing momentum in a percentage gain or loss, VBM normalizes momentum using the historical volatility of the underlying security...The calculation for a volatility based momentum (VBM) indicator is very similar to ROC , but divides by the security’s historical volatility instead. The average true range indicator (ATR) is used to compute historical volatility.

For example, on a daily chart , VBM(22,65) calculates how many MoV price has increased or decreased over the last 22 trading days (approximately one calendar month). The second parameter is the number of periods to use with the ATR indicator to normalize the momentum in terms of volatility.

For more details, there is an article further describing VBM and its applicability versus ROC.

### thinkScript Code

Code:
``````declare lower;

input rocPeriod = 22;
input atrPeriod = 65;

def rateOfChange = close[0] - close[rocPeriod];
def normalizationATR = atr(atrPeriod)[0];
def volatilityBasedMomentum = rateOfChange / normalizationATR;

plot VBM = volatilityBasedMomentum;
plot ZeroLine = 0;
ZeroLine.AssignValueColor(GetColor(0));``````

#### Attachments

• U03412B.png
107.4 KB · Views: 181
Can we have buy and sell arrows inside of the momentum indicator? Buy signal above 0 and sell signal below 0

I looked at this request, after adding the snippet that @BenTen posted earlier, the resulting display does look a bit squished. I was thinking that perhaps it might be a better idea to transform this into an upper study so that the arrows can be clearly marked on the chart. However perhaps this might not be a perfect study to use for buy/sell as we see the convergence of the so-called "buy"/"sell" arrows that make the signal not clear and confusing. However if the requester really wishes to see those arrows, here is version 1.1 based on @BenTen original study

Code:
``````# Volatility Based Momentum
# tomsk
# 1.12.2020

# V1.0 - 12.03.2019 - BenTen - Initial release of Volatility Based Momentum study (Lower Study)
# V1.1 - 01.12.2020 - tomsk  - Converted to upper study so that intended signals can be displayed

input rocPeriod = 22;
input atrPeriod = 65;

def rateOfChange = close[0] - close[rocPeriod];
def normalizationATR = atr(atrPeriod)[0];
def volatilityBasedMomentum = rateOfChange / normalizationATR;
def VBM = volatilityBasedMomentum;

plot bull = if VBM crosses above 0 then low * 0.996  else Double.NaN;
plot bear = if VBM crosses below 0 then high * 1.004 else Double.NaN;

bull.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
bull.SetDefaultColor(Color.YELLOW);
bull.SetLineWeight(3);

bear.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
bear.SetDefaultColor(Color.CYAN);
bear.SetLineWeight(3);
# End Volatility Based Momentum``````

thanks @tomsk - Quick testing on lower time frames, a value of 15, 39 seems to be a good optimization for lower time frame intraday scalps (e.g. 1 to 3 min TF).

87k+ Posts
371 Online

## The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• 1 full year of unlimited support

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?