#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

# 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

• mod
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) ] ]
• Dear Mark D,