Mark Minervini Trend Template ThinkorSwim Scanner

Thank you for this.

I have 2 comments:

1. For relative strength, I've been using the Mansfield Relative Strength Index (from Stan Weinsteins book, see explanation here (https://www.chartmill.com/documentation/technical-analysis-indicators/35-Mansfield-Relative-Strength). When the value is greater than the 0 line, it means the relative strength is better than the SP500. I'm sure there'd be a way to figure out the top ones, but right now I added this to the scan as a binary so it at least filters for stocks that are relatively stronger than the SP500, and then I can analyze each charts RS line to see if its accelerating or decelerating RS.

Here is the code - I take no credit (source: https://www.stageanalysis.net/forum...500-NYSE-Nasdaq-Stock-Charts?pid=9135#pid9135)

Daily Mansfield

Code:
declare lower;

input CorrelationWithSecurity = "SPX";
def SPXclose = close(CorrelationWithSecurity);
def R200 = close/SPXclose;


def RS_today = close / SPXclose;
def BSAverage = (sum(r200, 200)/200);
Plot RS2 = ((R200/BSAverage)-1)*10;
plot zeroline = 0;

RS2.SetDefaultColor(GetColor(6));plot Data = close;

EDIT: Markos has some relative strength stuff in here, I will play around with. Probably better than Mansfield: https://usethinkscript.com/threads/ibd-style-chart-and-scan.532/

2. I'm really new to ToS, and I'm trying to figure out how to convert this into a WatchList indicator. The value of this indicator gives 1 or 0, and I was wondering if there's an easy way to port that to a Watchlist Column. 1 being it meets the criteria, 0 being it doesnt.
 
Last edited:

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

ToS has a built-in RelativeStrength study to compare against the index. above the zero-line, strong strength below, weakness, or trading below.
 
Gave this a little bit more flexibility to be able to switch it to other numbers, securities, etc. Also, the multiplier was supposed to 100, not 10 like posted here. For some reason the indices are cutting off at the end of 2019, so I just switched it to spy for now.
Code:
declare lower;

input Correlation_with_Security = "SPY";
input length = 200;
input Period = AggregationPeriod.DAY;
input averagetype = AverageType.Simple;

def price = close;
def RSD = close/(close(correlation_with_security));
def RSDavg = MovingAverage(averagetype, RSD, length);

plot RSM = (( RSD / RSDavg) - 1 ) * 100;
plot zeroline = 0;

zeroline.SetDefaultColor(GetColor(2));
 
I compared and these are getting the same results, but yours is probably cleaner because you don't have to hide the data plot line. Thanks!
 
I compared and these are getting the same results, but yours is probably cleaner because you don't have to hide the data plot line. Thanks!
oh yea, it's just the multiplier is higher so you can get a better picture of the change. Also made it easier to change out the variables.
 
@AGD Straight unmodified, it gives me 333 results. How would you best modify it to narrow that down to what you think we would want? One of the cheapest ones it gives me is KR Kroger
 
@AGD
Straight unmodified, it gives me 333 results. How would you best modify it to narrow that down to what you think we would want?
One of the cheapest ones it gives me is KR Kroger
Add higher volume requirements, or use elbow grease to find linearity......
 
@AGD
Straight unmodified, it gives me 333 results. How would you best modify it to narrow that down to what you think we would want?
One of the cheapest ones it gives me is KR Kroger
Here dude, this guy took really good notes from the Minervini book. Read it over and decide what's most important to you. If price is a problem (since you mentioned KR being cheaper), just put a price max filter on it.

Trade Like A Stock Market Wizard notes
 
I've been reading those notes. I'm about half way done with it.

I'm watching the results from this scan every day.
For example, today was a major green day.
Yet 6/7 of my scan results are very red. (I kept it for stocks under $70)

My Campbells and Kroger specifically have been trending down and looks like they will be red for awhile.
Any advice?
Am I not implementing this scan correctly?

Also, why is the Market Sentiment tool in the forums not updating?
Thanks!
 
I've been playing around with this script, which is great BTW, but the main issue is any stock that doesn't have 200 trading days is automatically excluded since it cannot generate a 200 SMA value to meet the criteria. Since I don't want to exclude IPO's that are still trending up or may be forming bases, I've been trying to figure out the best way to edit this script to do that. Does anyone have any experience using BarNumber or CountTradingDays functions? I don't need someone to write script for me, just wondering which one of these would be better.

I essentially want to check if a stock has 200 trading bars or more, and if it does then run through the regular criteria. If it doesn't have 200 or more, I'd subject it to a less stringent criteria. I could simply run a less stringent test, but there's two issues:

A) I still want stocks to pass the test
B) If I run open ended on all stocks (not just IPO's) on a less stringent test, I'm going to get hundreds, if not thousands, of more stocks and the majority of them won't be ones I'm interested it, since I only want to be able to capture IPO stocks that can't meet the 200 DMA criteria solely because they haven't existed that long.

Thanks for any help
 
I've been playing around with this script, which is great BTW, but the main issue is any stock that doesn't have 200 trading days is automatically excluded since it cannot generate a 200 SMA value to meet the criteria. Since I don't want to exclude IPO's that are still trending up or may be forming bases, I've been trying to figure out the best way to edit this script to do that. Does anyone have any experience using BarNumber or CountTradingDays functions? I don't need someone to write script for me, just wondering which one of these would be better.

I essentially want to check if a stock has 200 trading bars or more, and if it does then run through the regular criteria. If it doesn't have 200 or more, I'd subject it to a less stringent criteria. I could simply run a less stringent test, but there's two issues:

A) I still want stocks to pass the test
B) If I run open ended on all stocks (not just IPO's) on a less stringent test, I'm going to get hundreds, if not thousands, of more stocks and the majority of them won't be ones I'm interested it, since I only want to be able to capture IPO stocks that can't meet the 200 DMA criteria solely because they haven't existed that long.

Thanks for any help
maybe you could just do it like an if then statement? like an if 200day sma is not NaN then x>200day else (run through all the shorter averages, etc etc) Sounds like it would work in theory
 
Thats a great point, for some reason I didn't think of that. Let me try that and I'll share my results if I'm successful.

EDIT: So I created a scan with 2 plots - 1 with a modified Minervini trend for IPO's and then another plot "plot data = if BarNumber()<200 then 1 else Double.Nan;". If I combined the two the script was timing out for some reason, but it works if I split them up.
 
Last edited:
Thats a great point, for some reason I didn't think of that. Let me try that and I'll share my results if I'm successful.

EDIT: So I created a scan with 2 plots - 1 with a modified Minervini trend for IPO's and then another plot "plot data = if BarNumber()<200 then 1 else Double.Nan;". If I combined the two the script was timing out for some reason, but it works if I split them up.
hmm post what you have so far when you get a chance and I'll see if I can think of a way to get it to run. I'd be happy to run this scan as well with so many things kicking into gear
 
Thats a great point, for some reason I didn't think of that. Let me try that and I'll share my results if I'm successful.

EDIT: So I created a scan with 2 plots - 1 with a modified Minervini trend for IPO's and then another plot "plot data = if BarNumber()<200 then 1 else Double.Nan;". If I combined the two the script was timing out for some reason, but it works if I split them up.
Run a scan on the US Market and ADR's,.....filter it out for earnings one year,.......what doesn't show earnings is your IPO list....
 
Run a scan on the US Market and ADR's,.....filter it out for earnings one year,.......what doesn't show earnings is your IPO list....
He's not looking for IPO's. The minervini scan makes sure that the 200,150,50,10 averages are all above each other to confirm trend. The problem is that if you have an IPO, it may not have 200 days to confirm the average. He wants to be able just skip the longer averages as necessary and just check with the shortest averages.
 
hmm post what you have so far when you get a chance and I'll see if I can think of a way to get it to run. I'd be happy to run this scan as well with so many things kicking into gear

I scrapped it so I dont have it anymore, but essentially what I took was the plot from the OP's code and added if BarNumber()<200 to the beginning. So the plot would only plot the data if the barnumber was less than 200. It timed out so I then split it out to a separate plot and therefore a second custom scan filter and it is now working.
 
I'm still in Kroger and Campbell's soup because of this script but the results of those 2 stocks have been very much a laggard to the performance of the market
 
I'm still in Kroger and Campbell's soup because of this script but the results of those 2 stocks have been very much a laggard to the performance of the market

You really shouldnt just use random indicators or scans without understanding them (even though many people on this forum do.)

This scan is the first step of many steps in Marks SEPA system. The purpose of this scan is to find stocks in confirmed uptrends. From there, you filter through the charts and fundamentals. Mark will never trade anything without showing VCP characteristics (violatility contraction pattern). In the past month Id say about 50% of the stocks from this scan meet my low fundamental criteria (so i weed out the clearly bad ones). From there about another 20-25% get weeded out when i analyze their fundamentals more. Im usually left with 100 to 150 stocks and out of those usually only 10% or less are showing VCP characteristics.

Kroger and Campbells arent high growth stocks and therefore would not have passed Marks fundamental scan. Secondly, neither has shown VCP, therefore no buy point has been triggered. Lastly, both stocks have been laggards and have had RS in the 80s at best. Mark only wants the stocks leading the market and he buys them after they come out of a base with a VCP.

Ive been studying stocks and investing since I was 13 and it still took me 4 or 5 times of reading both of Marks books to grasp everything. Its not that complex, but you have to be very precise. This is not an improperly backtested system where you see a random indicator light up and you hit "buy" like a brainless monkey.

If you need more guidance after reading both of his books then PM me and I can give you some helpful resources.

Exit: so you know, i run this scan with the following filters

Price 10$ or greater (mark usually doesnt buy stocks lower than that and it weeds out a ton of garbage stocks)
50 day moving avg of volume 150k of greater (weed out thinly traded junk)
Mansfield rs above 0 (see my posts above for formula)
Filter on all listed stocks (dont want otc garbage)
Exclude etfs (some etfs still sneak into the results but this weeds out most)

After that i have a custom excel sheet which brings in the scan results and weeds out any stock that has an IBD rs rating of 79 or less and ibd composite rating of 69 or less. From there i analyze the charts and fundamentals more in depth. As i said, recently ive been getting 250 to 270 on this TOS scan and the initial IBD criteria filters down to about 100 to 150. From there only about 50 to 100 meet my more stringent fundamental criteria and of those only about 5 to 15 are showing strong technical activity which includes VCP. These are the ones i watch to buy when their stock moves through the pivot point on heavy volume
 
Last edited:
@wtf_dude hi, for my learning, may request you to explain what does this scan do? what type of stocks can we get from this scan? Can i change this to weekly timeframe, if so, what input length is recommended... thank you very much
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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