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.
MA Moving Closer Together
Hi trying to write the following scan:
2 moving averages are closer today than they were 3 days ago
I tried PctDiff:
[PctDiff(SMA(50,close), SMA(200,CLOSE)) < PctDiff(3 days ago SMA(50,close),3 days ago SMA(200,CLOSE))]
Is this is right approach? Most of the scan results look right but a couple of the charts appear to show divergence
Thanks!
2 moving averages are closer today than they were 3 days ago
I tried PctDiff:
[PctDiff(SMA(50,close), SMA(200,CLOSE)) < PctDiff(3 days ago SMA(50,close),3 days ago SMA(200,CLOSE))]
Is this is right approach? Most of the scan results look right but a couple of the charts appear to show divergence
Thanks!
0
Comments
-
There are actually four ways MAs can move closer together
200 MA rising 50 MA above and falling
200 MA rising 50 MA below and rising
200 MA falling 50 MA above and falling
200 MA falling 50 MA below and rising
If PctDiff produces a negative numbers (I'm not sure whether it does), diverging MAs, although wider apart, will satisfy your condition (e.g. -10 per cent apart is less than -5 per cent apart).
You could write out each case long hand, including MA directions and difference today vs difference 3 days ago.
A slightly shorter method might be to use PPO Hist with certain parameters that I can't remember, and compare Hist values three days apart. But that requires testing for cases as well (first hist above 0, first hist below 0). If I can remember those parameters I'll edit this post. (I'm guessing PPO Hist(200,50, 1) but I'm not sure). If someone remembers, please chime in.
0 -
Hi markd, thanks for the suggestions, will give it a try0
-
@BKInvestor This seems to take care of all possibilities:
and [absval(sma(200)-sma(50)) < absval(3 days ago sma(200) - 3 days ago sma(50))]
The AbsVal function (which I had forgotten about) always returns a positive number, so relative position of the MAs doesn't matter.0 -
Thanks works great!0
-
PPO or MACD both show EMA difference, not SMA.0
Categories
- All Categories
- 2.3K StockCharts
- 395 SharpCharts
- 146 Other Charting Tools
- 69 Saved Charts and ChartLists
- 1.5K Scanning
- 73 Data Issues
- 177 Other StockCharts Questions
- 218 Technical Analysis
- 155 Using Technical Analysis
- 2 InterMarket and International
- 19 Market and Breadth Indicators
- 42 Market Analysis
- 109 Trading
- 109 Trading Strategies
- 163 S.C.A.N the StockCharts Answer Network forum
- 65 Using this StockCharts Answer Network forum
- 98 s.c.a.n. archives
- 5 Off-Topic
- 6 The Cogitation & Rumination Emporium
- Forum Test Area