Mark Minervini, Trend Template TOS Scanner

AGD

AGD

New member
Marketplace
##########################################################################################################################
## 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
;
 
A

abraham

New member
Awesome! How to incorporate this into the TOS tool? I did not find anything in the SETUP to import this code?
 
S

soary

Member
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?
 
N

Nick

Member
VIP
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😅
 
markos

markos

Well-known member
VIP
Warehouse
How do we do that?
Hi @Nick please go to the Tutorials and see the Thread: How to Drive the Scanner. There are 3 videos there. :) Glad you are back with us!
 
markos

markos

Well-known member
VIP
Warehouse
@AGD If you could code the VCP as mentioned, it would be greatly appreciated. Is that along the same lines as Gil Morales' VDU?
 
N

Nick

Member
VIP
Hi @Nick please go to the Tutorials and see the Thread: How to Drive the Scanner. There are 3 videos there. :) Glad you are back with us!
@markos. Yes, i have fully recovered and ready to support whenever possible.
 
N

Nick

Member
VIP
@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

AGD

New member
Marketplace
@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.
 
L

Likos

Member
VIP
@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?
 
2

2sureshk

Member
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
 

Top