## New version 18 available now

Download software Tutorial videos
Subscription & data-feed pricing Class schedule

New account application Trading resources
Margin rates Stock & option commissions

 Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

 Moving Averages are EQUAL? Rate this Topic:
 Previous Topic · Next Topic Watch this topic · Print this topic ·
RobHood
 Posted : Monday, May 14, 2018 4:59:38 PM
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 10-day exponential moving average & the 20-day 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

Bruce_L
 Posted : Monday, May 14, 2018 5:04:09 PM

Worden Trainer

Joined: 10/7/2004
Posts: 64,759

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
RobHood
 Posted : Monday, May 14, 2018 5:15:58 PM
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?

Bruce_L
 Posted : Monday, May 14, 2018 5:50:38 PM

Worden Trainer

Joined: 10/7/2004
Posts: 64,759

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
RobHood
 Posted : Tuesday, May 15, 2018 11:08:02 AM
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?

Bruce_L
 Posted : Tuesday, May 15, 2018 11:11:46 AM

Worden Trainer

Joined: 10/7/2004
Posts: 64,759

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
RobHood
 Posted : Tuesday, May 15, 2018 11:27:19 AM
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!

Quiktdr
 Posted : Monday, June 18, 2018 7:37:36 AM
Platinum Customer

Joined: 10/7/2004
Posts: 785

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!

StockGuy
 Posted : Monday, June 18, 2018 10:31:44 AM

Administration

Joined: 9/30/2004
Posts: 9,167

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

Quiktdr
 Posted : Monday, June 18, 2018 10:32:12 AM
Platinum Customer

Joined: 10/7/2004
Posts: 785

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!

Bruce_L
 Posted : Monday, June 18, 2018 10:34:22 AM

Worden Trainer

Joined: 10/7/2004
Posts: 64,759

Yes, your formula should work fine.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Quiktdr
 Posted : Monday, June 18, 2018 10:43:40 AM
Platinum Customer

Joined: 10/7/2004
Posts: 785

Ok thank you

Bruce_L
 Posted : Monday, June 18, 2018 10:50:03 AM

Worden Trainer

Joined: 10/7/2004
Posts: 64,759

You're welcome.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Users browsing this topic
Guest-1

 Forum Jump Customer Training & Support - Ask a Trainer - TC2000 version 12/18 - Ask a Trainer - TC2000 version 7 - Ask a Trainer - StockFinder 5.0 - PCFs, EasyScan and Custom Indicators General Discussions - Stock and Market Talk - TC2000 version 12 or 18 - TC2000 version 7 - StockFinder 5.0 - RealCode for StockFinder 5.0 Tutorial Videos - TC2000 version 12 tutorial videos - TC2000 version 7 tutorial videos You cannot post new topics in this forum. You cannot reply to topics in this forum. You cannot delete your posts in this forum. You cannot edit your posts in this forum. You cannot create polls in this forum. You cannot vote in polls in this forum.