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.
Comparing Dif Bet Two SMAs for Dif Days
Hi!
To build a scan, after I test that today's SMA (9) is above today's SMA (26) and that yesterday's SMA(9) is above yesterday's SMA(26), which I know how to do,
is there a way to test that
the difference between today's SMA(9) and today's SMA(26)
is greater than
the difference between yesterday's SMA(9) and yesterday's SMA(26)?
How do I write it?
Thank you!
Dr. T
To build a scan, after I test that today's SMA (9) is above today's SMA (26) and that yesterday's SMA(9) is above yesterday's SMA(26), which I know how to do,
is there a way to test that
the difference between today's SMA(9) and today's SMA(26)
is greater than
the difference between yesterday's SMA(9) and yesterday's SMA(26)?
How do I write it?
Thank you!
Dr. T
0
Comments
-
If you wanted to use emas, you could just use MACD Line(9,26,9) > 1 day ago MACD Line(9,26,9).
For sma you have to write it out, which just involves some brackets and a time modifier.
So you have your basic condition frame work
and [ ]
then brackets around the first subtraction operation for today, to tell you how far apart they smas are:
[ sma(9,close) - sma(26, close) ]
then brackets around the second subtraction operation for yesterday (1 day ago):
[ 1 day ago sma(9, close) - 1 day ago sma(26, close) ]
then a comparison operator between the two subtraction operations makes it:
and [ [ sma(9,close) - sma(26, close) ] > [ 1 day ago sma(9, close) - 1 day ago sma(26, close) ] ]0 -
Dear Mark D,
Thank you for your prompt reply.
So the key is to use double brackets. I'll try it.
Dr. T0 -
Well, the "extra" brackets are for clarity. The scan engine's syntax doesn't require them in this case. But I always use them to group the elements of an operation, just to make it clear what you are comparing to what.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