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 formula for stocks under moving average
I am looking for the scan formula to find stocks that have been below their 50-day moving average for at least 85% of the time over the past two years
0
Comments
But, in most normally behaving stocks, the stock would have to be in a long term down trend. This is an off-the-top of my head approach to capture that condition:
and [ROC(251) < 0]
and [251 days ago ROC(251) < 0]
So, in other words, for two years (not necessarily calendar years) in a row, the stock has lost ground between the beginning and end of a 251 day period. That allows for a lot of fluctuation, but overall the trend will be down.
Very rough and ready, but maybe a useful starting point.
Set up a chart with MACD Hist(1,30,0) instead of the default parameters. With these parameters, the Hist bar represents the distance between the close and the ema. When the close (ema(1, close)) is above the ema(30, close), the Hist bar is positive (above the zero line).
To scan for the close above the zero line for 30 days, you would scan for
and [min(30, MACD Hist(1,30,0)) > 0]
In other words, the smallest difference between the close and the ema is not less than (or equal to) zero.
Then you would have to test for the close below the ema 31 days ago, so
and [30 days ago close < 31 days ago ema(30)]
or you could say
and [31 days ago MACD Hist(1,30,0) < 0]
same thing.
and [251 days ago ROC(251) < 0] and [30 days ago close < 31 days ago ema(30)]