TMO Plus Volume and Volatility Indicator For ThinkOrSwim

dart966

Member
VIP
I am a huge fan of Mobius' TMO (True Momentum Oscillator). Knowing that volume is the driving factor in moving price and that high volatility means greater price swings, I decided to apply this code to volume and volatility to create a 3 in 1 indicator. (Don't sleep on this KI and ED 😉)

I have been using this for awhile to time my entries on lower timeframes and I am very impressed with the results; therefore, with all the latest scripts posted about volatility, I decided to share my favorite indicator, The TMO Plus.

Bullish reversals are more likely when TMO is under zero (even better with a bullish divergence) and Volume and Volatility are both high (over zero).

Explanation of colors:
Price Momentum - Green/Red
Volume - Cyan/Blue
Volatility - Yellow/Orange

Shared link: TMO__Plus

See attached picture and note the highlighted oval areas:

TMO_Plus.png


Upper indicators are:

Trend Pivot Points Indicator by Mobius

Dynamic Supply and Demand Zones [AlgoAlpha] by @samer800

Code:
# TMO Plus by dart966

# Original code created by Mobius
# TMO ((T)rue (M)omentum (O)scilator)
# Mobius
# V01.05.2018
# hint: TMO calculates momentum using the delta of price. Giving a much better picture of trend, tend reversals and divergence than momentum oscillators using price.

declare lower;


input length = 14; #8
input calcLength = 5; #6
input smoothLength = 3; #6
input lineWidth = 1;


def o = open;
def c = close;
def data = fold i = 0 to length
with s
do s + (if c > GetValue(o, i)
then 1
else if c < GetValue(o, i)
then - 1
else 0);
def EMA5 = ExpAverage(data, calcLength);
plot Main = ExpAverage(EMA5, smoothLength);
plot Signal = ExpAverage(Main, smoothLength);
Main.SetLineWeight(lineWidth);# Set line width
Signal.SetLineWeight(lineWidth);# Set line width

Main.AssignValueColor(if Main > Signal
then Color.GREEN
else Color.RED);
Signal.AssignValueColor(if Main > Signal
then Color.GREEN
else Color.RED);
Signal.HideBubble();
#Signal.HideTitle();
AddCloud (Main, Signal, Color.GREEN, Color.RED);



#***************************************************************************************

# TVO - True Volume Oscilator (modified TMO for volume by dart966)



input dataInput = {default volume, open_close};

input showLabels = yes;

def ov = volume;
def cv = volume;

def datav = fold iv = 0 to length
           with sv
           do sv + (if cv > GetValue(ov, iv)
                   then 1
                   else if cv < GetValue(ov, iv)
                        then - 1
                        else 0);
def EMA5v = ExpAverage(datav, calcLength);
plot Mainv = ExpAverage(EMA5v, smoothLength);
plot Signalv = ExpAverage(Mainv, smoothLength);
def sigtestv = Mainv > Signalv;

Mainv.AssignValueColor(if Mainv > Signalv
then Color.CYAN
else Color.BLUE);
Signalv.AssignValueColor(if Mainv > Signalv
then Color.CYAN
else Color.BLUE);

Signalv.HideBubble();
#Signalv.HideTitle();

AddCloud (Mainv, Signalv, Color.CYAN, Color.BLUE);


#***************************************************************************************


# True Implied Volatility Oscilator ((modified TMO for volatility by dart966)


#def imv = Sqrt(252) * stdev(log(close / close[1]), length);
def imv = impVolatility();

def oiv = imv;
def civ = imv;
def dataiv = fold iiv = 0 to length
with siv
do siv + (if civ > GetValue(oiv, iiv)
then 1
else if civ < GetValue(oiv, iiv)
then - 1
else 0);
def EMA5iv = ExpAverage(dataiv, calcLength);
plot Mainiv = ExpAverage(EMA5iv, smoothLength);
plot Signaliv = ExpAverage(Mainiv, smoothLength);
Mainiv.SetLineWeight(lineWidth);# Set line width
Signaliv.SetLineWeight(lineWidth);# Set line width

Mainiv.AssignValueColor(if Mainiv > Signaliv
then Color.GRAY
else Color.LIGHT_GRAY);
Signaliv.AssignValueColor(if Mainiv > Signaliv
then Color.YELLOW
else Color.ORANGE);
Signaliv.HideBubble();
Signal.HideTitle();
AddCloud (Mainiv, Signaliv, Color.YELLOW, Color.ORANGE);
plot zeroiv = if IsNaN(civ) then Double.NaN else 0;

plot zerov = if IsNaN(cv) then Double.NaN else 0;
zerov.SetDefaultColor(Color.GRAY);
zerov.HideBubble();
#zerov.HideTitle();


plot obv = if IsNaN(cv) then Double.NaN else Round(length * .7);
obv.SetDefaultColor(Color.GRAY);
obv.HideBubble();
obv.HideTitle();
plot osv = if IsNaN(cv) then Double.NaN else -Round(length * .7);
osv.SetDefaultColor(Color.GRAY);
osv.HideBubble();
osv.HideTitle();


DefineGlobalColor("OverBought", CreateColor(100, 40, 40));
DefineGlobalColor("OverSold", CreateColor(40, 40, 100));
AddCloud(obv, length, GlobalColor("OverBought"), GlobalColor("OverBought"));
AddCloud(-length, osv, GlobalColor("OverSold"), GlobalColor("OverSold"));

# end of script
 
Last edited:

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

I am a huge fan of Mobius' TMO (True Momentum Oscillator). Knowing that volume is the driving factor in moving price and that high volatility means greater price swings, I decided to apply this code to volume and volatility to create a 3 in 1 indicator. (Don't sleep on this KI and ED 😉)

I have been using this for awhile to time my entries on lower timeframes and I am very impressed with the results; therefore, with all the latest scripts posted about volatility, I decided to share my favorite indicator, The TMO Plus.

Bullish reversals are more likely when TMO is under zero (even better with a bullish divergence) and Volume and Volatility are both high (over zero).

Explanation of colors:
Price Momentum - Green/Red
Volume - Cyan/Blue
Volatility - Yellow/Orange

Shared link: TMO__Plus

See attached picture and note the highlighted oval areas:

View attachment 25808

Upper indicators are:

Trend Pivot Points Indicator by Mobius

Dynamic Supply and Demand Zones [AlgoAlpha] by @samer800

Code:
# TMO Plus by dart966

# Original code created by Mobius
# TMO ((T)rue (M)omentum (O)scilator)
# Mobius
# V01.05.2018
# hint: TMO calculates momentum using the delta of price. Giving a much better picture of trend, tend reversals and divergence than momentum oscillators using price.

declare lower;


input length = 14; #8
input calcLength = 5; #6
input smoothLength = 3; #6
input lineWidth = 1;


def o = open;
def c = close;
def data = fold i = 0 to length
with s
do s + (if c > GetValue(o, i)
then 1
else if c < GetValue(o, i)
then - 1
else 0);
def EMA5 = ExpAverage(data, calcLength);
plot Main = ExpAverage(EMA5, smoothLength);
plot Signal = ExpAverage(Main, smoothLength);
Main.SetLineWeight(lineWidth);# Set line width
Signal.SetLineWeight(lineWidth);# Set line width

Main.AssignValueColor(if Main > Signal
then Color.GREEN
else Color.RED);
Signal.AssignValueColor(if Main > Signal
then Color.GREEN
else Color.RED);
Signal.HideBubble();
#Signal.HideTitle();
AddCloud (Main, Signal, Color.GREEN, Color.RED);



#***************************************************************************************

# TVO - True Volume Oscilator (modified TMO for volume by dart966)



input dataInput = {default volume, open_close};

input showLabels = yes;

def ov = volume;
def cv = volume;

def datav = fold iv = 0 to length
           with sv
           do sv + (if cv > GetValue(ov, iv)
                   then 1
                   else if cv < GetValue(ov, iv)
                        then - 1
                        else 0);
def EMA5v = ExpAverage(datav, calcLength);
plot Mainv = ExpAverage(EMA5v, smoothLength);
plot Signalv = ExpAverage(Mainv, smoothLength);
def sigtestv = Mainv > Signalv;

Mainv.AssignValueColor(if Mainv > Signalv
then Color.CYAN
else Color.BLUE);
Signalv.AssignValueColor(if Mainv > Signalv
then Color.CYAN
else Color.BLUE);

Signalv.HideBubble();
#Signalv.HideTitle();

AddCloud (Mainv, Signalv, Color.CYAN, Color.BLUE);


#***************************************************************************************


# True Implied Volatility Oscilator ((modified TMO for volatility by dart966)


#def imv = Sqrt(252) * stdev(log(close / close[1]), length);
def imv = impVolatility();

def oiv = imv;
def civ = imv;
def dataiv = fold iiv = 0 to length
with siv
do siv + (if civ > GetValue(oiv, iiv)
then 1
else if civ < GetValue(oiv, iiv)
then - 1
else 0);
def EMA5iv = ExpAverage(dataiv, calcLength);
plot Mainiv = ExpAverage(EMA5iv, smoothLength);
plot Signaliv = ExpAverage(Mainiv, smoothLength);
Mainiv.SetLineWeight(lineWidth);# Set line width
Signaliv.SetLineWeight(lineWidth);# Set line width

Mainiv.AssignValueColor(if Mainiv > Signaliv
then Color.GRAY
else Color.LIGHT_GRAY);
Signaliv.AssignValueColor(if Mainiv > Signaliv
then Color.YELLOW
else Color.ORANGE);
Signaliv.HideBubble();
Signal.HideTitle();
AddCloud (Mainiv, Signaliv, Color.YELLOW, Color.ORANGE);
plot zeroiv = if IsNaN(civ) then Double.NaN else 0;

plot zerov = if IsNaN(cv) then Double.NaN else 0;
zerov.SetDefaultColor(Color.GRAY);
zerov.HideBubble();
#zerov.HideTitle();


plot obv = if IsNaN(cv) then Double.NaN else Round(length * .7);
obv.SetDefaultColor(Color.GRAY);
obv.HideBubble();
obv.HideTitle();
plot osv = if IsNaN(cv) then Double.NaN else -Round(length * .7);
osv.SetDefaultColor(Color.GRAY);
osv.HideBubble();
osv.HideTitle();


DefineGlobalColor("OverBought", CreateColor(100, 40, 40));
DefineGlobalColor("OverSold", CreateColor(40, 40, 100));
AddCloud(obv, length, GlobalColor("OverBought"), GlobalColor("OverBought"));
AddCloud(-length, osv, GlobalColor("OverSold"), GlobalColor("OverSold"));

# end of script
Looks very promising. Thanks for sharing
 
Many thanks for posting this helpful indicator! Have you setup a scan to look for optimal bullish reversal, and if so can you please share? Thx, Fred
 
Many thanks for posting this helpful indicator! Have you setup a scan to look for optimal bullish reversal, and if so can you please share? Thx, Fred

mod note:
This is only the basic TMO scanner without pivot point interaction
Code:
# TMO Bullish Scanner by dart966 (based on Mobius' TMO)

input length = 14;
input calcLength = 5;
input smoothLength = 3;

def o = open;
def c = close;
def data = fold i = 0 to length
    with s
    do s + (if c > GetValue(o, i)
        then 1
        else if c < GetValue(o, i)
        then -1
        else 0);
def EMA5 = ExpAverage(data, calcLength);
def Main = ExpAverage(EMA5, smoothLength);
def Signal = ExpAverage(Main, smoothLength);

# Bullish condition: Main crosses above Signal
plot scan = Main crosses above Signal;
https://tos.mx/!6heGd7VV bullish scanner

1761251489120.png
 
Last edited by a moderator:
TMO itself is a great indicator. Adding volume and volatility like price even makes it better. Here is consolidated buy or sell signal using all three! This is not holy grail but if used on different timeframes, may make your decision easier.

Here is the script with labels. Please feel free for any suggestion to make it better! (labels logic)
Code:
# Original code created by Mobius
# TMO ((T)rue (M)omentum (O)scilator)
# Mobius
# V01.05.2018
# hint: TMO calculates momentum using the delta of price. Giving a much better picture of trend, tend reversals and divergence than momentum oscillators using price.

declare lower;


input length = 9; #8
input calcLength = 5; #6
input smoothLength = 3; #6
input lineWidth = 1;


def o = open;
def c = close;
def data = fold i = 0 to length
with s
do s + (if c > GetValue(o, i)
then 1
else if c < GetValue(o, i)
then - 1
else 0);
def EMA5 = ExpAverage(data, calcLength);
plot Main = ExpAverage(EMA5, smoothLength);
plot Signal = ExpAverage(Main, smoothLength);
Main.SetLineWeight(lineWidth);# Set line width
Signal.SetLineWeight(lineWidth);# Set line width

Main.AssignValueColor(if Main > Signal
then Color.GREEN
else Color.RED);
Signal.AssignValueColor(if Main > Signal
then Color.GREEN
else Color.RED);
Signal.HideBubble();
#Signal.HideTitle();
AddCloud (Main, Signal, Color.GREEN, Color.RED);



#***************************************************************************************

# TVO - True Volume Oscilator (modified TMO for volume by dart966)



input dataInput = {default volume, open_close};

input showLabels = yes;

def ov = volume;
def cv = volume;

def datav = fold iv = 0 to length
with sv
do sv + (if cv > GetValue(ov, iv)
then 1
else if cv < GetValue(ov, iv)
then - 1
else 0);
def EMA5v = ExpAverage(datav, calcLength);
plot Mainv = ExpAverage(EMA5v, smoothLength);
plot Signalv = ExpAverage(Mainv, smoothLength);
def sigtestv = Mainv > Signalv;

Mainv.AssignValueColor(if Mainv > Signalv
then Color.CYAN
else Color.BLUE);
Signalv.AssignValueColor(if Mainv > Signalv
then Color.CYAN
else Color.BLUE);

Signalv.HideBubble();
#Signalv.HideTitle();

AddCloud (Mainv, Signalv, Color.CYAN, Color.BLUE);


#***************************************************************************************


# True Implied Volatility Oscilator ((modified TMO for volatility by dart966)


#def imv = Sqrt(252) * stdev(log(close / close[1]), length);
def imv = impVolatility();

def oiv = imv;
def civ = imv;
def dataiv = fold iiv = 0 to length
with siv
do siv + (if civ > GetValue(oiv, iiv)
then 1
else if civ < GetValue(oiv, iiv)
then - 1
else 0);
def EMA5iv = ExpAverage(dataiv, calcLength);
plot Mainiv = ExpAverage(EMA5iv, smoothLength);
plot Signaliv = ExpAverage(Mainiv, smoothLength);
Mainiv.SetLineWeight(lineWidth);# Set line width
Signaliv.SetLineWeight(lineWidth);# Set line width

Mainiv.AssignValueColor(if Mainiv > Signaliv
then Color.GRAY
else Color.LIGHT_GRAY);
Signaliv.AssignValueColor(if Mainiv > Signaliv
then Color.YELLOW
else Color.ORANGE);
Signaliv.HideBubble();
Signaliv.HideTitle();
AddCloud (Mainiv, Signaliv, Color.YELLOW, Color.ORANGE);
plot zeroiv = if IsNaN(civ) then Double.NaN else 0;

plot zerov = if IsNaN(cv) then Double.NaN else 0;
zerov.SetDefaultColor(Color.GRAY);
zerov.HideBubble();
#zerov.HideTitle();


plot obv = if IsNaN(cv) then Double.NaN else Round(length * .7);
obv.SetDefaultColor(Color.GRAY);
obv.HideBubble();
obv.HideTitle();
plot osv = if IsNaN(cv) then Double.NaN else -Round(length * .7);
osv.SetDefaultColor(Color.GRAY);
osv.HideBubble();
osv.HideTitle();


DefineGlobalColor("OverBought", CreateColor(100, 40, 40));
DefineGlobalColor("OverSold", CreateColor(40, 40, 100));
AddCloud(obv, length, GlobalColor("OverBought"), GlobalColor("OverBought"));
AddCloud(-length, osv, GlobalColor("OverSold"), GlobalColor("OverSold"));

# Updated Additions for Buy/Sell Labels Based on Alignment
# Best Buy/Sell labels derived from the 8 primary labels, focusing on full alignment (price direction + volume confirmation via accelerating volume + volatility state).
# "All three align" means:
# - Price bullish/bearish (Main >/< Signal and Main >/< 0 for strength).
# - Volume confirming the move (Mainv > Signalv and Mainv > 0, indicating accelerating volume for conviction in either direction).
# - Volatility in supportive state (low/decreasing for stable trends, rising for momentum plays).
# Best Buy Labels (bullish alignment):
# - Strong Buy: Strong Uptrend - Volume Confirmed, Low Volatility (stable trend entry).
# - Momentum Buy: Bullish Momentum - Volume Supported, Rising Volatility (breakout/momentum entry).
# Best Sell Labels (bearish alignment):
# - Strong Sell: Strong Downtrend - Volume Confirmed, Low Volatility (stable downtrend entry).
# - Pressure Sell: Bearish Pressure - Volume Driven, Rising Volatility (panic/momentum exit).


def isOB = Main > obv or Mainv > obv or Mainiv > obv;
def isOS = Main < osv or Mainv < osv or Mainiv < osv;

AddLabel(showLabels,
if !isOB and !isOS then
if Main > Signal and Main > -5 and Mainv > Signalv and Mainv > -5 and Mainiv < Signaliv then "Strong Buy: Strong Uptrend - Volume Confirmed, Low Volatility"
else if Main > Signal and Main > 0 and Mainv > Signalv and Mainv > 0 and Mainiv > Signaliv then "Momentum Buy: Bullish Momentum - Volume Supported, Rising Volatility"
else if Main < Signal and Main < 5 and Mainv > Signalv and Mainv > 5 and Mainiv < Signaliv then "Strong Sell: Strong Downtrend - Volume Confirmed, Low Volatility"
else if Main < Signal and Main < 0 and Mainv > Signalv and Mainv > 0 and Mainiv > Signaliv then "Pressure Sell: Bearish Pressure - Volume Driven, Rising Volatility"
else if Main > Signal and Main > 0 and Mainv < Signalv and Mainv < 0 and Mainiv < Signaliv then "Weak Buy: Weak Uptrend - Volume Fading, Low Volatility"
else if Main > Signal and Main > 0 and Mainv < Signalv and Mainv < 0 and Mainiv > Signaliv then "Tentative Buy: Tentative Uptrend - Unconfirmed, High Volatility"
else if Main < Signal and Main < 0 and Mainv < Signalv and Mainv < 0 and Mainiv < Signaliv then "Weak Sell: Weak Downtrend - Volume Fading, Low Volatility"
else if Main < Signal and Main < 0 and Mainv < Signalv and Mainv < 0 and Mainiv > Signaliv then "Tentative Sell: Tentative Downtrend - Unconfirmed, High Volatility"
else "Neutral: Sideways/Neutral - Await Confirmation"
else if isOB then "Overbought: Reversal Risk - Hold"
else if isOS then "Oversold: Bounce Potential - Hold"
else "Neutral: Sideways/Neutral - Await Confirmation",
if !isOB and !isOS then
if Main > Signal and Main > 0 and Mainv > Signalv and Mainv > 0 and (Mainiv < Signaliv or Mainiv > Signaliv) then Color.GREEN
else if Main < Signal and Main < 0 and Mainv > Signalv and Mainv > 0 and (Mainiv < Signaliv or Mainiv > Signaliv) then Color.RED
else if Main > Signal and Main > 0 and Mainv < Signalv and Mainv < 0 and (Mainiv < Signaliv or Mainiv > Signaliv) then Color.LIGHT_GREEN
else if Main < Signal and Main < 0 and Mainv < Signalv and Mainv < 0 and (Mainiv < Signaliv or Mainiv > Signaliv) then Color.LIGHT_RED
else Color.GRAY
else if isOB then Color.ORANGE
else if isOS then Color.CYAN
else Color.GRAY
);

# end of script
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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