ThinkorSwim Volatility Contraction Pattern (VCP) by Mark Minervini

8Nick8

Active member
2019 Donor
VIP
Does anyone know if there is a ThinkorSwim script similar to VCP or known as Volatility Contraction Pattern created by Mark Minervini?

I found this indicator VCP Daily Entries v1 but unsure if it's the same.

Code:
# VCP Daily Entries
# https://www.tradingview.com/script/s04se4eX-VCP-Daily-Entries-v1/

def MA20 = simpleMovingAvg(close, 20);
def MA50 = simpleMovingAvg(close, 50);
def MA150 = simpleMovingAvg(close, 150);
def MA200 = simpleMovingAvg(close, 200);

def vol_increase = volume > volume[1] and volume[1] > volume[2];
def ma_criteria = (MA150 > MA200) and (MA20 > MA50) and (MA50 > MA150);
def vol_ma = ma_criteria and vol_increase;
AssignPriceColor(if vol_ma then color.green else color.white);
 
Last edited:

malone1020

Member
VIP
Hi, all -

Came across this free code/translation of Mark Minervi's popular Volatility Contraction Pattern (VCP) concept from an Amibroker forum. Anyone skilled in TOS scripting wanna give this a shot? I've seen this come up in other usethinkscript posts to no avail, so thought I would put it back out there to see if we can get a scanner or indicator going.

Code:
// VCP Search



// Goal is to easily find possible VCP pivots that are tight enough to be attractive to buy



// Must be used with an Amibroker analysis that selects only a universe of stocks that meet the trend template and

// other minimum requirements for an uptrending growth stock (per Minervini parameters)



// Michael Mustillo 2020/05/04



// Tunables ////////////////////////////////////////////////

{

Timeframe = 252; // one year of trading. Looking at growth stock a base is usually starts at a new ATH

// the above concept also tends to elminate stocks with too much overhead supply



VolTf = 50; // 50 days for volume averaging (similar to most IBD-inspired charts)



// Most good bases only retrace up to 30%. Even if the base is deeper, it's probably not a good

// idea to buy cheats pivots (3C patterns) that are really deep into the base

BaseLowerLimit = 0.6;



// Pivot length. How long does the last contraction need to be to qualify?

// Three days is probably the absolute minimum if combined with a dry-up in supply

PivotLength = 5;



// How wide can the pivot be to be a pivot? 6% seems to be a sweet spot for a high quality final contraction

// 10% is the limit

PVLimit = 0.10;

}



Ticker = Name();



// Filter parameters ///////////////////////////////////////

{

// Stock should not be making a new high, but be close to it

// initial correction in the base must be less than 30%, but could be more in a volatile or bear market





// Price within base

// find the highest price over the timeframe

HighPrice = HHV(C, Timeframe);





// Make sure the current price is till within the base and not too much below

NearHigh = C < HighPrice AND C > BaseLowerLimit * HighPrice;



// Average volume is decreasing

// volume must be contracting and/or below average, preferably both to ensure supply is indeed drying up

// Use the typical 50-day average for volume

Vma = MA(V, VolTf);



// A negative slope of the linear regression of the average volume should indicate supply trends

VolSlope = LinRegSlope(Vma, VolTf);



// Volume is indeed decreasing if slope is negative

VolDecreasing = VolSlope < 0;





// Pivot Quality

// The last few days must be tight, < 10%, preferably less than 6% if possible to get a tight entry and good

// stop-loss

// The high of the pivot should be in the first day of the pivot formation to really be a contraction

// The low can occur anywhere in the pivot

PivotHighPrice = HHV(H, PivotLength);

PivotLowPrice = LLV(L, PivotLength);

PivotWidth = (PivotHighPrice - PivotLowPrice)/C;

PivotStartHP = Ref(H, -PivotLength +1);

IsPivot = PivotWidth < PVLimit AND PivotHighPrice == PivotStartHP;





// Now make sure the volume is really drying up in the pivot area

// Set initial value to true

VolDryUp = True;



// loop throught PivotLength days and ensure volume is below average

for (i = 0; i < PivotLength; i++)

VolDryup = VolDryup AND Ref(V, -i) < Ref(Vma, -i);

}



// Filter results ///////////////////////////////////////////



Filter = NearHigh AND VolDecreasing AND IsPivot AND VolDryUp;



//EOF
 
Last edited by a moderator:

silver8ack

New member
I tried... but I dont think its working as expected:
Code:
# VCP Search
declare lower;

# Goal is to easily find possible VCP pivots that are tight enough to be attractive to buy

# Must be used with an Amibroker analysis that selects only a universe of stocks that meet the trend template and
# other minimum requirements for an uptrending growth stock (per Minervini parameters)

# Michael Mustillo 2020/05/04

# Tunables ########################
input Timeframe          = 252;  # one year of trading. Looking at growth stock a base is usually starts at a new ATH
# the above concept also tends to elminate stocks with too much overhead supply

input VolTf             = 50;  # 50 days for volume averaging (similar to most IBD-inspired charts)

# Most good bases only retrace up to 30%. Even if the base is deeper, it's probably not a good
# idea to buy cheats pivots (3C patterns) that are really deep into the base
input BaseLowerLimit     = 0.6;

# Pivot length. How long does the last contraction need to be to qualify?
# Three days is probably the absolute minimum if combined with a dry-up in supply
input PivotLength     = 5;

# How wide can the pivot be to be a pivot? 6% seems to be a sweet spot for a high quality final contraction
# 10% is the limit
input PVLimit         = 0.10;



# Filter parameters ###################/
# Stock should not be making a new high, but be close to it
# initial correction in the base must be less than 30%, but could be more in a volatile or bear market


# Price within base
# find the highest price over the timeframe
#def HighPrice = Highest(close, Timeframe);
def HighPrice = Highest(high, Timeframe);


# Make sure the current price is till within the base and not too much below
def NearHigh  = close < HighPrice and close > BaseLowerLimit * HighPrice;

# Average volume is decreasing
# volume must be contracting and/or below average, preferably both to ensure supply is indeed drying up
# Use the typical 50-day average for volume
def Vma = SimpleMovingAvg(volume, VolTf);

# A negative slope of the linear regression of the average volume should indicate supply trends
def VolSlope = LinearRegressionSlope(Vma, VolTf);

# Volume is indeed decreasing if slope is negative
def VolDecreasing = VolSlope < 0;


# Pivot Quality
# The last few days must be tight, < 10%, preferably less than 6% if possible to get a tight entry and good
# stop-loss
# The high of the pivot should be in the first day of the pivot formation to really be a contraction
# The low can occur anywhere in the pivot
def PivotHighPrice  = Highest(high, PivotLength);
def PivotLowPrice    = Lowest(low, PivotLength);
def PivotWidth         = (PivotHighPrice - PivotLowPrice) / close;
#def PivotStartHP    = Ref(H, -PivotLength +1);
def PivotStartHP    = Highest(high, PivotLength)[PivotLength];
def IsPivot         = PivotWidth < PVLimit and PivotHighPrice == PivotStartHP;


# Now make sure the volume is really drying up in the pivot area
# Set initial value to true
#def VolDryUp = yes;

# loop throught PivotLength days and ensure volume is below average
#plot factorial = fold index = 1 to n + 1 with p = 1 do p * index;
def VolumeDrying = fold i = 0 to PivotLength - 1 with VolDryUp = yes do if VolDryUp and volume[i] < Vma[i] then yes else no;

#for (i = 0;
#i < PivotLength;
#i++)
#    VolDryup = VolDryup AND Ref(V, -i) < Ref(Vma, -i);
#}

# Filter results #####################/

plot scan = NearHigh and VolDecreasing and IsPivot and VolumeDrying;

#EOF
 
Not sure if this would be the proper thread for this post, it is a volume related post though. my apologies if im posting in the wrong place
I been searching all over the net and this site for a indicator or scan that looks for and shows that volume has been drying up over a 3 to 7 day period, something along the lines of the VCP or tight price action where volume dry's up just before a stock breaks out to the upside. not 100% sure how to explain what im looking for but this is the best way i can explain it for now
thank you to anyone who might be able to something like this
 

Similar threads

Top