Platinum Customer
Joined: 5/16/2014 Posts: 17

Hi there,
I'm attempting to create a scan condition where as the two moving averages I select are of the same value.
For example, if using the 10day exponential moving average & the 20day simple moving average, I'm attempting to locate stocks that have the same equal value for both moving averages. It doesn't matter what the actual value is as along as it is equal.
Greater than, less than, crossing up, crossing down, etc doesn't help in this scenario...
Any suggestions or insight would be greatly appreciated!
Thank you

Worden Trainer
Joined: 10/7/2004 Posts: 63,727

A 10 day exponential moving average is pretty much never going to be exactly equal to a 20 day simple moving average.
XAVGC10 = AVGC20
But you could check for the moving average to be within say $0.001 of each other.
ABS(XAVGC10  AVGC20) <= .001
Or within say 0.1% of each other.
ABS(XAVGC10 / AVGC20  1) <= .001
You can adjust the .001 in either the second or third formula to adjust the net or percent difference allowed.
Bruce Personal Criteria Formulas TC2000 Support Articles

Platinum Customer
Joined: 5/16/2014 Posts: 17

Can i somehow use the Boolean formula v = w when comparing any two moving averages that I select?

Worden Trainer
Joined: 10/7/2004 Posts: 63,727

That is the first formula given in my previous response. It just isn't going to find many results (if any) because those moving averages really are going to almost never exactly equal.
The test window might round off to two digits after the decimal marker, but the actual comparison is going to use about seven significant digits.
If you want to round to the nearest penny, you could use something like the following.
(100 * XAVGC10) \ 1 = (100 * AVGC20) \ 1
Note the \ is for integer divide and not the / for normal division.
Bruce Personal Criteria Formulas TC2000 Support Articles

Platinum Customer
Joined: 5/16/2014 Posts: 17

Thank you for your help! I'm going to search for some videos on the topic to get better accustomed.
Even though it is rare, on occasion this will present itself in the moving averages you choose. So just because it does manifest now, it may in the future. Does the formula written recognizes that and produce only when conditions are meet OR are you stating that those moving averages are going to almost never exactly equal?

Worden Trainer
Joined: 10/7/2004 Posts: 63,727

Those moving averages are almost never exactly equal (in fact, if the computer thought they were exactly equal it would most likely be due to rounding and the computer only using seven significant digits).
If you were comparing shorter simple moving averages it would be far more likely to happen.
Bruce Personal Criteria Formulas TC2000 Support Articles

Platinum Customer
Joined: 5/16/2014 Posts: 17

You're so on point...I have found single day moving averages have a better chance of mirroring each other.
Great insight!

Platinum Customer
Joined: 10/7/2004 Posts: 758

I am looking to scan stocks that are > = the XAVGC10 by at leat 20%
This is my attempt C>= XAVGC10*1.20 is this correct?
Thank you in advance!

Administration
Joined: 9/30/2004 Posts: 9,077

You can drop the trailing zero, but yes, the formula is correct.

Platinum Customer
Joined: 10/7/2004 Posts: 758

Was this lost in cyberspace?
I am looking to scan stocks that are > = the XAVGC10 by at leat 20%
This is my attempt C>= XAVGC10*1.20 is this correct?
Thank you in advance!

Worden Trainer
Joined: 10/7/2004 Posts: 63,727

Yes, your formula should work fine.
Bruce Personal Criteria Formulas TC2000 Support Articles

Platinum Customer
Joined: 10/7/2004 Posts: 758

Ok thank you

Worden Trainer
Joined: 10/7/2004 Posts: 63,727

You're welcome.
Bruce Personal Criteria Formulas TC2000 Support Articles
