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
0
Comments
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) ] ]
Thank you for your prompt reply.
So the key is to use double brackets. I'll try it.
Dr. T