OnBalanceOptionVolumeIndicator For ThinkOrSwim

LetsMakeMoney

New member
VIP
This indicator simulates an OnBalanceVolume indicator for markets that don't provide volume directly in thinkorswim script. Uses a constant to simulate the total
option value each trading day. The formula is the same as the one for the OnBalanceVolume indicator created by Joseph Granville. Plots an average of the accumVol variable. Above 100000 the price is trending up, below 100000 the price is trending down. I created this specifically for day trading the XSP ticker, 0DTE. I'll use it in
conjunction with Fast Stochastics to get a directional bias for the day. Looking at the plot and historical XSP values for different time frames it seems like it can
be useful.

Code:
# OnBalanceOptionsVolume #
# Script by LetsMakeMoney #
# Free for General Use #
# Use at your own risk #

# This indicator simulates an OnBalanceVolume indicator for
# markets that don't provide volume directly in
# thinkorswim script. Uses a constant to simulate the total
# option value each trading day. The formula is the same as
# the one for the OnBalanceVolume indicator created by
# Joseph Granville. Plots an average of the accumVol variable.
# Above 100000 the price is trending up, below 100000 the
# price is trending down (when using the default value of
# 100000).  I created this specifically for
# day trading the XSP ticker, 0DTE. I'll use it in
# conjunction with Fast Stochastics to get a directional
# bias for the day. Looking at the plot and historical
# XSP values for different time frames it seems like it can
# be useful.

declare lower;
input length = 14;
input OptionVolume = 100000;

def OV = OptionVolume;
plot accumVol = if close > close[1] then OV[1] + OV else if close==close[1] then OV[1] else OV[1] - OV;
accumVol.Hide();

def AccumVolAvg = ExpAverage(accumVol,length);
plot ACV = AccumVolAvg;
ACV.SetDefaultColor(color.gray);

plot line100 = 100000;
line100.SetDefaultColor(color.gray);
 
Last edited:
This indicator simulates an OnBalanceVolume indicator for markets that don't provide volume directly in thinkorswim script. Uses a constant to simulate the total
option value each trading day. The formula is the same as the one for the OnBalanceVolume indicator created by Joseph Granville. Plots an average of the accumVol variable. Above 100000 the price is trending up, below 100000 the price is trending down. I created this specifically for day trading the XSP ticker, 0DTE. I'll use it in
conjunction with Fast Stochastics to get a directional bias for the day. Looking at the plot and historical XSP values for different time frames it seems like it can
be useful.

Code:
# OnBalanceOptionsVolume #
# Script by LetsMakeMoney #
# Free for General Use #
# Use at your own risk #

# This indicator simulates an OnBalanceVolume indicator for
# markets that don't provide volume directly in
# thinkorswim script. Uses a constant to simulate the total
# option value each trading day. The formula is the same as
# the one for the OnBalanceVolume indicator created by
# Joseph Granville. Plots an average of the accumVol variable.
# Above 100000 the price is trending up, below 100000 the
# price is trending down (when using the default value of
# 100000).  I created this specifically for
# day trading the XSP ticker, 0DTE. I'll use it in
# conjunction with Fast Stochastics to get a directional
# bias for the day. Looking at the plot and historical
# XSP values for different time frames it seems like it can
# be useful.

declare lower;
input length = 14;
input OptionVolume = 100000;

def OV = OptionVolume;
plot accumVol = if close > close[1] then OV[1] + OV else if close==close[1] then OV else OV[1] - OV;
accumVol.Hide();

def AccumVolAvg = ExpAverage(accumVol,length);
plot ACV = AccumVolAvg;
ACV.SetDefaultColor(color.gray);

plot line100 = 100000;
line100.SetDefaultColor(color. Gray);
Made a couple of modifications. Added a plot that smooths the accumVol plot, and also made a modification such that the 'baseline' will reset to the appropriate value when the OptionVolume input is varied. The gray plot is a smoothed average of the red plot, and can be used as a trigger.

Code:
# OnBalanceOptionsVolume #
# Script by LetsMakeMoney #
# Free for General Use #
# Use at your own risk #

# This indicator simulates an OnBalanceVolume indicator for
# markets that don't provide volume directly in
# thinkorswim script. Uses a constant to simulate the total
# option value each trading day. The formula is the same as
# the one for the OnBalanceVolume indicator created by
# Joseph Granville. Plots an average of the accumVol variable.
# Above 100000 the price is trending up, below 100000 the
# price is trending down (when the default of 100000 is used).
# I created this specifically for day trading the XSP ticker, 0DTE.
# I'll use it in conjunction with Fast Stochastics to get a directional
# bias for the day. Looking at the plot and historical
# XSP values for different time frames it seems like it can
# be useful.

# Edit: I added plot that smooths the accumVol plot. Also made
# a modification to ensure that the 'baseline' of the plot
# resets to the appropriate value with respect to the
# OptionVolume input.

declare lower;
input VolumeLookback = 14;
input SmoothingLength = 3;
input OptionVolume = 100000;

def OV = OptionVolume;
plot accumVol = if close > close[1] then OV[1] + OV else if close == close[1] then OV[1] else OV[1] - OV;
accumVol.Hide();

def AccumVolAvg = ExpAverage(accumVol, VolumeLookback);
plot ACV = AccumVolAvg;
ACV.SetDefaultColor(Color.RED);

def AvgOfAvg = ExpAverage(ACV, SmoothingLength);
plot AOA = AvgOfAvg;
AOA.SetDefaultColor(Color.GRAY);


plot line = OptionVolume;
line.SetDefaultColor(Color.GRAY);
 
Last edited:

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