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

Scan Condition for Close vs. Moving Average Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
gator41
Posted : Tuesday, November 5, 2013 8:52:52 PM
Registered User
Joined: 3/29/2011
Posts: 27

I know how to set up a condition for price crossing a moving average up or down, but is there a way to scan for a stock that has closed  above the MA today and yesterday, but three days ago it closed below the MA?

The formula for one of the moving averages I am interested in is

 

((h+l+c)/3+(h1+l1+c1)/3+(h2+l2+c2)/3)/3

 

Thanks!

 

Dan

Bruce_L
Posted : Wednesday, November 6, 2013 9:36:05 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

If the formula given is being plotted as a Custom PCF Indicator in the same pane and scale as price, you could write a formula for the close being above Custom PCF Indicator both for the current bar and 1-bar ago but below the moving average 3-bars ago as:

3 * C > AVGH3 + AVGL3 + AVGC3 AND 3 * C1 > AVGH3.1 + AVGL3.1 + AVGC3.1 AND 3 * C3 < AVGH3.3 + AVGL3.3 + AVGC3.3

Condition Formulas will probably be the quickest and easiest way to do this if everything can be reproduced using formulas.

There is a more generalized approach which can be done without creating formulas, but it can take a while to set up. It involves adding offset 1-period simple moving averages to both of the indicators you wish to compare. The trick is to set the Offset setting of both moving averages to the number of bars ago for which you wish to check.

So in this case, you would need to add four 1-period simple moving averages in total. You would add a 1-period simple moving average with an offset of 1 to both price and the moving average and you would add a 1-period simple moving average with an offset of 3 to both price and the moving average.

You end up with 3 pairs of indicators. The actual indicators are one set, the second set is offset by 1-bar and the third set is offset by 3-bars. You can click on 1 of the indicators in each set and select Create Scan Condition to make three conditions.

Create Conditions from Your Chart

The first condition would be for price being above the moving average.

The second condition would be for the moving average of price which is offset 1-bar being above the moving average of the moving average which is offset 1-bar.

The third condition would be for the moving average of price which is offset 3-bars being below the moving average of the moving average which is offset by 3-bars.

Then you would need to add all three conditions to the same EasyScan as EasyScan Conditions.

Building a Scan with Multiple Conditions



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
gator41
Posted : Wednesday, November 6, 2013 10:09:59 AM
Registered User
Joined: 3/29/2011
Posts: 27

I'll give it a shot, thanks.

Bruce_L
Posted : Wednesday, November 6, 2013 10:16:43 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

If you have additional formulas for moving averages you want to use, I can help you with the crossover formulas. It is easier to copy and paste the formulas into TC2000 than to add all of the moving averages, create the conditions from the chart and then combine them using an EasyScan.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Quiktdr
Posted : Tuesday, December 3, 2013 2:30:35 PM
Registered User
Joined: 10/7/2004
Posts: 794

I had a corrupted PCF file and support helped me but they had me delete these two PCF's as the possible source of problem. Is there anything wrong with these?                                                                               

1)C > AVGC200 AND AVGC5 < AVGC13                                                                                                                                                                                                            2) ((H + L + C) / 3) > AVGC5 AND ((H1 + L1 + C1) / 3) < AVGC5.1

Bruce_L
Posted : Tuesday, December 3, 2013 2:42:15 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

If the formulas were corrupted, there was probably an issue with the way they were stored in the program. As long as those formulas do not include the 1) or 2) at the beginning, there is nothing wrong with the syntax as posted.



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

Forum Jump
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.