Ants — Momentum, Volume and Price (MVP)

petech

Member
I saw this very interesting custom indicator on TradingView.
https://www.tradingview.com/script/uEaFv7tm-Ants-Momentum-Volume-and-Price-MVP/

2xK3Vsa.jpg


I haven't got the slightest clue how to code this myself in TOS, but I think it is generally understood that we want to buy stocks that are under institutional accumulation. This indicator from TV seems to attempt to spot stocks that likely being accumulated by institutions. So I hope someone here who knows how to code would also find this concept of interest and want to code a script based upon the logic below.

Also I've already done a search on this site to see if something similar already existed, if it does, I missed finding it.

From the original author on TV....

The Ants indicator is based on the research of David Ryan, three-time winner of the U.S. Investing Championship. David came up with the idea for the indicator while managing the New USA Growth Fund at William O’Neil + Company. David was interested to understand what drove some stocks higher once they were extended from their most recent base, while others had only moderate moves up.

What David found during his research was that stocks making the biggest moves often had consistent buying on volume over a period of 12 to 15 trading days. Stocks with these characteristics may be under institutional accumulation, where it may take days to weeks to fill a position.

Momentum, Volume And Price ( MVP )

The Ants indicator looks for the following:

‎ ‎ ‎ ‎■ Momentum - The stock is up at least 12 of the past 15 days.
‎ ‎ ‎ ‎■ Volume - The volume has increased over the past 15 days by 20% to 25%.
‎ ‎ ‎ ‎■ Price - The price is up at least 20% over the past 15 days.
 
Converted to scan. Should be self explanatory. This is also meant to be pasted as a study to be used in condition wizard after. You will load up the "Study" and then select which set of conditions you want and then select the IS TRUE conditional in the wizard.
Code:
# -----------------
# halcyonguy
# 21-08-25
# -----------------
# Conversion to scan on 3.20.22 by WTF_Dude

# Momentum, Volume and Price (MVP)
 #https://usethinkscript.com/threads/ants-%E2%80%94-momentum-volume-and-price-mvp.7497/
#I saw this very interesting custom indicator on TradingView.
#https://www.tradingview.com/script/uEaFv7tm-Ants-Momentum-Volume-and-Price-MVP/
#The Ants indicator is based on the research of David Ryan, three-time winner of the U.S. Investing Championship. David came up with the idea for the indicator while managing the New USA Growth Fund at William O’Neil + Company. David was interested to understand what drove some stocks higher once they were extended from their most recent base, while others had only moderate moves up.

#What David found during his research was that stocks making the biggest moves often had consistent buying on volume over a period of 12 to 15 trading days. Stocks with these characteristics may be under institutional accumulation, where it may take days to weeks to fill a position.

# — Momentum, Volume And Price ( MVP ) —

# The Ants indicator looks for the following:
#  1... Momentum - The stock is up at least 12 of the past 15 days.
#  2... Volume - The volume has increased over the past 15 days by 20% to 25%.
#  3... Price - The price is up at least 20% over the past 15 days.

# colored squares, above the candles:
#  Gray - Momen requirement met.
#  Blue - Momen and price requirement met.
#  Yellow - Momen and vol requirement met.
#  Green - Momen and vol and price requirement met.

#/////////////////////////////////////

def na = Double.NaN;
def bn = barnumber();

# ======================================

#input OOOOOO_Momentum_OOOOOOO = yes;
# MVP
# 1... Momentum - The stock is up at least 12 of the past 15 days.
#  it tests if current bar close > previous close

input series_max = 15;
input series_min = 12;
def momen_max = series_max;
def momen_min = series_min;
#input momentum_qty = 15;
#input momentum_min = 12;

def chgup = close > close[1];

def squares_price_offset = 0.02;
def vert = squares_price_offset;

#  min series , when there are 'min' quantity of bars or greater, within a 'qty' set of bars.
#   ex. if there are 12 min bars, within 15 qty bars.

#AddLabel(1, "MVP qtys " + momen_min + "/" + momen_max, Color.cyan);

# --------------------------------
# nested fold.
#  test if  x min bars, or more, are true , out of  y qty bars
#  loop1 , start at current bar, loops to future bars.
#  loop2 , on each bar of loop1, it looks back at 'momentum_qty' quantity of bars and counts the times chgup is true.
#    when done, if the count is > momentum_min, then a 1 is passed on to loop1.
#    if momupx > 0, then at least 1 valid series was found, to go across the bar.

#   add this to remove errors on last few bars, when bar is within (min-1) bars to the last bar,
#     while  !isnan( getvalue(close, -loop1) )

def momupx = fold loop1 = 0 to momen_max
with one
while  !isnan( getvalue(close, -loop1) )
do one + if (fold loop2 = 0 to momen_max
         with two
         do two + if GetValue(chgup , (-loop1 + loop2) ) then 1 else 0) >= momen_min then 1 else 0;

# was there at least 1 min series found ?
def momup = if momupx > 0 then 1 else 0;

# line under bars
#def offset1 = 0.999;
def offset1 = 1.0;
def htper = 0.2;
def cldht = round( (htper/100) * close, 1 );
def cldtop = if !momup[1] and momup then (low * offset1) else if momup then cldtop[1] else na;
def cldbot = cldtop - cldht;
# addcloud(cldtop, cldbot, color.cyan, color.cyan);

#input momen_series_horz_line = yes;
#def ddd = if momen_series_horz_line then cldtop else na;
#ddd.setlineweight(2);
#ddd.SetDefaultColor(Color.light_gray);


# ======================================
# ======================================

#input OOOOOO_Volume_OOOOOOO = yes;

# 2... Volume - The volume has increased over the past 15 days by 20% to 25%.
#  the 15 day average daily volume is 20% or greater than the 50 day average.

input volume_increase_percent = 20.0;
def vip = volume_increase_percent/100;

#input vol_qty = 15;
#input vol_min = 12;
#def vol_max = series_max;
#def vol_min = series_min;

input vol_avg_short_len = 15;
input vol_avg_long_len = 50;
def vol_avgshort = average(volume, vol_avg_short_len);
def vol_avglong = average(volume, vol_avg_long_len);


# compare vol15avg to (vol50avg * x%)
def volupx = if ( vol_avgshort > (vol_avglong * (1 + vip)) ) then 1 else 0;
def volup = volupx;

# ======================================

#input OOOOOO_Price_OOOOOOO = yes;

# 3... Price - The price is up at least 20% over the past 15 days.


#input price_increase_percent = 6.0;

# by default the original coder had it at only 6% and used a system of price average change which isn't part of the original conditions. Can revert to line above if needed.
input price_increase_percent = 20.0;
def prp = price_increase_percent/100;


#input pr_max = 15;
#input pr_min = 12;
def pr_max = series_max;
def pr_min = series_min;

#input price_avg_short_len = 15;
#input price_avg_long_len = 50;
#def pr_avgshort = average(close, price_avg_short_len);
#def pr_avglong = average(close, price_avg_long_len);

# original
#def prupx =  if ( pr_avgshort > (pr_avglong * (1 + prp)) ) then 1 else 0;

def prupx =  if ( close > (close[pr_max]* (1 + prp)) ) then 1 else 0;


def prup = prupx;

# //////////////////////////////////////
# //////////////////////////////////////


# 12 out of 15 bars up
plot BarMomentumOnly = (momup and !volup and !prup);

# price up 20 perccent and 12 out of 15 bars up
plot PriceUpBarMomentum = (momup and !volup and prup);

# 20%+ volume increase over 50d average and 12 out of 15 bars up
plot VolumeIncreaseandBarsMomentum = (momup and volup and !prup);

# All conditions met
plot MVPallconditionsmet = (momup and volup and prup);
This study appears to be really promising. I want to buy when the first GRAY SQUARE(which represents Momentum) emerges (based on my observations, all stocks rise after that). When I scanned "all stocks" for equities that fulfilled this criteria, no matching symbol showed up. The following is my scan code: I'd appreciate it if someone could help me.Thank you in advance

# mvp_01

# -----------------
# halcyonguy
# 21-08-25
# -----------------

# Momentum, Volume and Price (MVP)
#https://usethinkscript.com/threads/ants-—-momentum-volume-and-price-mvp.7497/
#I saw this very interesting custom indicator on TradingView.
#https://www.tradingview.com/script/uEaFv7tm-Ants-Momentum-Volume-and-Price-MVP/
#The Ants indicator is based on the research of David Ryan, three-time winner of the U.S. Investing Championship. David came up with the idea for the indicator while managing the New USA Growth Fund at William O’Neil + Company. David was interested to understand what drove some stocks higher once they were extended from their most recent base, while others had only moderate moves up.

#What David found during his research was that stocks making the biggest moves often had consistent buying on volume over a period of 12 to 15 trading days. Stocks with these characteristics may be under institutional accumulation, where it may take days to weeks to fill a position.

# — Momentum, Volume And Price ( MVP ) —

# The Ants indicator looks for the following:
# 1... Momentum - The stock is up at least 12 of the past 15 days.
# 2... Volume - The volume has increased over the past 15 days by 20% to 25%.
# 3... Price - The price is up at least 20% over the past 15 days.

# colored squares, above the candles:
# Gray - Momen requirement met.
# Blue - Momen and price requirement met.
# Yellow - Momen and vol requirement met.
# Green - Momen and vol and price requirement met.

#/////////////////////////////////////

def na = Double.NaN;
def bn = barnumber();

# ======================================

input OOOOOO_Momentum_OOOOOOO = yes;
# MVP
# 1... Momentum - The stock is up at least 12 of the past 15 days.
# it tests if current bar close > previous close

input series_max = 15;
input series_min = 12;
def momen_max = series_max;
def momen_min = series_min;
#input momentum_qty = 15;
#input momentum_min = 12;

def chgup = close > close[1];

def squares_price_offset = 0.02;
def vert = squares_price_offset;

# min series , when there are 'min' quantity of bars or greater, within a 'qty' set of bars.
# ex. if there are 12 min bars, within 15 qty bars.

#AddLabel(1, "MVP qtys " + momen_min + "/" + momen_max, Color.cyan);

# --------------------------------
# nested fold.
# test if x min bars, or more, are true , out of y qty bars
# loop1 , start at current bar, loops to future bars.
# loop2 , on each bar of loop1, it looks back at 'momentum_qty' quantity of bars and counts the times chgup is true.
# when done, if the count is > momentum_min, then a 1 is passed on to loop1.
# if momupx > 0, then at least 1 valid series was found, to go across the bar.

# add this to remove errors on last few bars, when bar is within (min-1) bars to the last bar,
# while !isnan( getvalue(close, -loop1) )

def momupx = fold loop1 = 0 to momen_max
with one
while !isnan( getvalue(close, -loop1) )
do one + if (fold loop2 = 0 to momen_max
with two
do two + if GetValue(chgup , (-loop1 + loop2) ) then 1 else 0) >= momen_min then 1 else 0;

# was there at least 1 min series found ?
def momup = if momupx > 0 then 1 else 0;


# //////////////////////////////////////


DEF t = if MOMUP then (high * (1 + (1*vert))) else na;


# -------------------------------------

plot scan = if T > 0 and T[1] < 0 and T[2] < T[1] then 1 else Double.NaN;
 

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

This study appears to be really promising. I want to buy when the first GRAY SQUARE(which represents Momentum) emerges (based on my observations, all stocks rise after that). When I scanned "all stocks" for equities that fulfilled this criteria, no matching symbol showed up. The following is my scan code: I'd appreciate it if someone could help me.Thank you in advance

# mvp_01

# -----------------
# halcyonguy
# 21-08-25
# -----------------

# Momentum, Volume and Price (MVP)
#https://usethinkscript.com/threads/ants-—-momentum-volume-and-price-mvp.7497/
#I saw this very interesting custom indicator on TradingView.
#https://www.tradingview.com/script/uEaFv7tm-Ants-Momentum-Volume-and-Price-MVP/
#The Ants indicator is based on the research of David Ryan, three-time winner of the U.S. Investing Championship. David came up with the idea for the indicator while managing the New USA Growth Fund at William O’Neil + Company. David was interested to understand what drove some stocks higher once they were extended from their most recent base, while others had only moderate moves up.

#What David found during his research was that stocks making the biggest moves often had consistent buying on volume over a period of 12 to 15 trading days. Stocks with these characteristics may be under institutional accumulation, where it may take days to weeks to fill a position.

# — Momentum, Volume And Price ( MVP ) —

# The Ants indicator looks for the following:
# 1... Momentum - The stock is up at least 12 of the past 15 days.
# 2... Volume - The volume has increased over the past 15 days by 20% to 25%.
# 3... Price - The price is up at least 20% over the past 15 days.

# colored squares, above the candles:
# Gray - Momen requirement met.
# Blue - Momen and price requirement met.
# Yellow - Momen and vol requirement met.
# Green - Momen and vol and price requirement met.

#/////////////////////////////////////

def na = Double.NaN;
def bn = barnumber();

# ======================================

input OOOOOO_Momentum_OOOOOOO = yes;
# MVP
# 1... Momentum - The stock is up at least 12 of the past 15 days.
# it tests if current bar close > previous close

input series_max = 15;
input series_min = 12;
def momen_max = series_max;
def momen_min = series_min;
#input momentum_qty = 15;
#input momentum_min = 12;

def chgup = close > close[1];

def squares_price_offset = 0.02;
def vert = squares_price_offset;

# min series , when there are 'min' quantity of bars or greater, within a 'qty' set of bars.
# ex. if there are 12 min bars, within 15 qty bars.

#AddLabel(1, "MVP qtys " + momen_min + "/" + momen_max, Color.cyan);

# --------------------------------
# nested fold.
# test if x min bars, or more, are true , out of y qty bars
# loop1 , start at current bar, loops to future bars.
# loop2 , on each bar of loop1, it looks back at 'momentum_qty' quantity of bars and counts the times chgup is true.
# when done, if the count is > momentum_min, then a 1 is passed on to loop1.
# if momupx > 0, then at least 1 valid series was found, to go across the bar.

# add this to remove errors on last few bars, when bar is within (min-1) bars to the last bar,
# while !isnan( getvalue(close, -loop1) )

def momupx = fold loop1 = 0 to momen_max
with one
while !isnan( getvalue(close, -loop1) )
do one + if (fold loop2 = 0 to momen_max
with two
do two + if GetValue(chgup , (-loop1 + loop2) ) then 1 else 0) >= momen_min then 1 else 0;

# was there at least 1 min series found ?
def momup = if momupx > 0 then 1 else 0;


# //////////////////////////////////////


DEF t = if MOMUP then (high * (1 + (1*vert))) else na;


# -------------------------------------

plot scan = if T > 0 and T[1] < 0 and T[2] < T[1] then 1 else Double.NaN;
Did you ever figure out the scan? I've been trying to scan for this as well but not having much luck.
 
Did you ever figure out the scan? I've been trying to scan for this as well but not having much luck.
I've had no luck, either. I've been putting in a lot of effort. I scanned the entire universe of stocks in all time frames. There wasn't a single stock that came up in my scan (to find the stocks with the FIRST Gray square above the candle). Could someone please help? If we can figure it out, I feel it will be a game changer.
Thank you in advance
 
I've had no luck, either. I've been putting in a lot of effort. I scanned the entire universe of stocks in all time frames. There wasn't a single stock that came up in my scan (to find the stocks with the FIRST Gray square above the candle). Could someone please help? If we can figure it out, I feel it will be a game changer.
Thank you in advance
@Santhosh ... This indicators gives the signal after 12 or 15 days depends on what you are looking at... if it detects momentum condition for 12 or 15 days then it will gives the signal and back paint all the bars. So it is no value as such. I would recommend that find these stocks that already meets MVP condition and keep a watchlist and when it pulls back and rise again then you can decide to take a position or not.
 
@Santhosh ... This indicators gives the signal after 12 or 15 days depends on what you are looking at... if it detects momentum condition for 12 or 15 days then it will gives the signal and back paint all the bars. So it is no value as such. I would recommend that find these stocks that already meets MVP condition and keep a watchlist and when it pulls back and rise again then you can decide to take a position or not.
Your strategy appeals to me. I'll keep a watchlist on these stocks from now on and take a position in the future based on the stock's performance. Thank you so much for your suggestions and input. For example, on 3/16/2020, the first GRAY square (above the candle) emerged in EXC Stock (Daily timeframe). The stock soared for several days after this gray candle. On March 16 (or at least March 17), I wanted to buy this stock, but my scan code did not return it on that day. Could you or someone else please check my scan code and confirm that it is correct? (to me the code appears to be correct). If it isn't correct, could someone please assist by providing the correct code?. Thank you in advance for your consideration.
 
@Santhosh ... This indicators gives the signal after 12 or 15 days depends on what you are looking at... if it detects momentum condition for 12 or 15 days then it will gives the signal and back paint all the bars. So it is no value as such. I would recommend that find these stocks that already meets MVP condition and keep a watchlist and when it pulls back and rise again then you can decide to take a position or not.
I just took the time to carefully read each of your sentences. It BACK PAINTS ALL THE BARS, something I had no idea about. This helps to explain why my SCAN (to find stocks when the first GRAY Square appears) yielded no results. Thank you
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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