New Members: Be sure to confirm your email address by clicking on the link that was sent to your email inbox. You will not be able to post messages until you click that link.
Scanning for 200-day moving average has been trending higher for X days
I am trying to scan for stocks that are in an uptrend with a volume.
But the specific condition I am looking for us is to check if a stock is above 200-day SMA for more than 14 days in a row.
Below is what I have so far with other conditions I was checking. Stuck on the SMA trend
[type is stock]
and [country = US]
and [Close > 2]
and [weekly volume > 1 week ago sma(10, volume) * 2]
and [weekly close > 1 week ago close]
and [Daily SMA(10,Daily Close) > Yesterdays Daily SMA(10,Daily Close)]
and [Daily SMA(200,Daily Volume) > 1000000]
and [SMA(50) > yesterdays SMA(50)]
// add condition for checking if the stock is higher than SMA(200) for X days in a row
Thanks in advance.
There is a function in the Technical Attributes dropdown called DistFromSMA
it defaults in like this
and [DistFromSMA(200) > 0]
If you want to check for 14 days the DistFromSMA is greater than 0, meaning the price is above the SMA, you could use the Min function in conjunction with it. Min is in the Technical Attributes dropdown as well.
Min defaults in like this
and [Min(253,close) > 99.9]
It's saying that the Minimum price close in the last 253 days is > 99.9
You would change the 253 to 14, and the close to the DistFromSMA(200) to find ones that the min distance from the SMA is greater than 0, or, in other words, the price has been above the SMA for 14 days.
and [Min(14,DistFromSMA(200)) > 0]
Note the double )) after the 200. Your number of left ( must equal the number of right ). There is a ( after min and after SMA.
Tip: If you get a 'failure to parse..." error, it is usually caused by the number of ( not equalling the number of )
Adding code in case anyone else finds it interesting or if anyone sees issues with the scan itself. I intentionally removed ETFs. A bit of backtesting shows a pretty good list to trade.
Weinstein Stage analysis is a fascinating study. Remember, he also placed Mansfield Relative Strength awareness into the mix. StockCharts.com doesn't have the Mansfield Relative Strength indicator like Stan Weinstein used on his charts. You can view the relative performance on your chart by using the Price or Price Performance indicator on your chart and then using $Symbol:$Spx for the parameter. symbol colon symbol. $Symbol will take the symbol of the chart and put it there in the parameter automatically.
You can also use $Symbol:$Industry to get the symbol vs its assigned industry or $Industry:$Sector to get the assigned industry vs the assigned sector or $Industry:AAPL assigned industry for the symbol vs AAPL for other examples and comparisons. Use them anyway you want.
StockCharts.com doesn't have the Mansfield Relative Strength indicator scan either but it does have a PctRelative function that will allow you to scan performance relative to another symbol over a period of time.
That defaults into the workbench like this
and [PctRelative(20,$spx) > 0]
That is saying to find securities in your universe that have a positive return (greater than 0%), relative to the $spx, over the last 20 day period. Mansfield RS is relative to the index but also relative to 0. Much like a MACD.
Something you may find of interest is to create a scan to look for the Stage 1's. Save those to a list and then create your Stage 2 breakout scan to look at the Stage 1 chartlist.
There is another site called ChartMill.com that has Weinstein screen terms built in to their screening and chart indicator options. It's free to join and use. Like everything in life, it's got positives and negatives. It doesn't have Point and Figure Charts for example. I do run some screens over there from time to time and pull the results into a StockCharts chartlist. It is a decent site, but I still do all of my final research on StockCharts.com.