Mark Minervini Trend Template ThinkorSwim Scanner

AGD

New member
Below is the scan conditions for ThinkorSwim based on Mark Minervini’s Trend Template.

Code:
##########################################################################################################################
##  1. The current stock price is above both the 150-day (30-week) and the 200-day (40-week) moving average price lines.
##  2. The 150-day moving average is above the 200-day moving average.
##  3. The 200-day moving average line is trending up for at least 1 month (preferably 4?5 months minimum in most cases).
##  4. The 50-day (10-week) moving average is above both the 150-day and 200-day moving averages.
##  5. The current stock price is trading above the 50-day moving average.
##  6. The current stock price is at least 30 percent above its 52-week low. (Many of the best selections will be 100 percent, 300 percent,
##     or greater above their 52-week low before they emerge from a solid consolidation period and mount a large scale advance.)
##  7. The current stock price is within at least 25 percent of its 52-week high (the closer to a new high the better).
##  8. The relative strength ranking (as reported in Investor?s Business Daily) is no less than 70, and preferably in the 80s or 90s,
##     which will generally be the case with the better selections
##  NOTE: Point 8, I have not implemented, because TOS doesn'thave IDB rating.
##
## Reference to conditions above
##     3)     (Average(close, length) > Average(close, length)[LookBack])
##     2) and SimpleMovingAvg("length" = 150)."SMA" is greater than SimpleMovingAvg("length" = 200)."SMA"
##     4) and SimpleMovingAvg("length" = 50)."SMA"  is greater than SimpleMovingAvg("length" = 150)."SMA"
##     4) and SimpleMovingAvg("length" = 50)."SMA"  is greater than SimpleMovingAvg("length" = 200)."SMA"
##     1) and close is greater than SimpleMovingAvg("length" = 200)."SMA"
##     1) and close is greater than SimpleMovingAvg("length" = 150)."SMA"
##     5) and close is greater than SimpleMovingAvg("length" = 50)."SMA"
##     6) and price > x
##     7) and price > y
##########################################################################################################################

## Code Start

input range = 252;                                                            #Number of Trading days
input price = close;                                                          #Current closing price
input length = 200;                                                           #hint length: The length of the moving average
input LookBack = 60;                                                          #hint LookBack: The agg-bars back moving average being compared to

def lo = lowest(low,range);
def hi = highest(high,range);

#The current stock price is at least 30 percent above its 52-week low.
def x = 1.3 * lo;           #30%  above its 52-week low
#def x = 2.0 * lo;           #100% above its 52-week low

#The current stock price is within at least 25 percent of its 52-week high
def y = 0.75 *  hi;         #25%  of its 52-week high
#def y = 0.80 *  hi;         #20%  of its 52-week high
#def y = 0.90 *  hi;         #10%  of its 52-week high

# The below reads as SimpleMovingAvg("length" = 200) is greater than SimpleMovingAvg("length" = 200) from 60 agg-bars ago.
#(Average(close, length) > Average(close, length)[LookBack])

plot scan = (Average(close, length) > Average(close, length)[LookBack])
and SimpleMovingAvg("length" = 150)."SMA" is greater than SimpleMovingAvg("length" = 200)."SMA"
and SimpleMovingAvg("length" = 50)."SMA"  is greater than SimpleMovingAvg("length" = 150)."SMA"
and SimpleMovingAvg("length" = 50)."SMA"  is greater than SimpleMovingAvg("length" = 200)."SMA"
and close is greater than SimpleMovingAvg("length" = 200)."SMA"
and close is greater than SimpleMovingAvg("length" = 150)."SMA"
and close is greater than SimpleMovingAvg("length" = 50)."SMA"
and price >= x
and price >= y
;
 

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

Awesome! How to incorporate this into the TOS tool? I did not find anything in the SETUP to import this code?
 
Looks interesting for position trading. The 252 trading days in the trd yr suggest it's for trading LEAPS or 2X per year. It reminded me of my DIS stock trade that I held for months and sold it when it hit high and bought it back when it was low again. Have you back tested the strategy yet? If so what were your results?
 
I made this after reading Mark's first book, Chapter 5. In chapter 10 he talks about VCP (Volume Contraction Pattern).
@AGD i had briefly read abt Mark book and was wondering if the VCP can be detect by a scan? Tried to put a pullback scan but does not seem to look like vcp setup😅
 
@AGD If you could code the VCP as mentioned, it would be greatly appreciated. Is that along the same lines as Gil Morales' VDU?
 
@markos. Yes, i have fully recovered and ready to support whenever possible.
@AGD I may not have posted my questions properly, i briefly scan thru his book, he mentioned that he pays attention to company's fundamentals such as accelerating year-over-year earnings, accelerating sales, expanding profit margin (15-17% or higher) , preferred high P/E. Just wondering do you have certain FA criteria that we can configure in the TOS scan. Thank u
 
@AGD If you could code the VCP as mentioned, it would be greatly appreciated. Is that along the same lines as Gil Morales' VDU?

I have not coded VCP, I find it very difficult to code, based on my limited knowledge of TOS coding.
 
@AGD does this work for scanning pre & after hours? Looks like it does. Would the 'x' time be ideally be selected as Day or minutes?
 
Thank you for the code and I have validated with 4 hrs, Daily and Wk. Results are interesting and positive for Buy .

How to modify this scan to get the Short list (Sell)? Down trend

Thx
 
Happy Day! I have been working the logic through as to how to create a watchlist of stocks that I want to trade.
This is the perfect basis. Thank you for sharing.
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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