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


New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

PCF to count instances of 2 period moving avg above or below 8 period ma Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
sclapp
Posted : Thursday, August 30, 2018 7:58:49 AM
Registered User
Joined: 2/8/2005
Posts: 16

Hi,

Here is the output I'm seeking: watchlist with a column that has the number of days that a 2 period moving average is above (or below) an 8 period moving average. The column would display a positive number for days above and negative number for days below. I would like to sort on the column to start with +1 or -1. Thanks!

Bruce_L
Posted : Thursday, August 30, 2018 8:54:40 AM


Worden Trainer

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

Please try the following.

TrueInRow(AVGC2 > AVGC8, 20) - TrueInRow(AVGC2 < AVGC8, 20)

The formula counts up to a maximum of 20 bars in a row (but you can change both instances of 20 to something else if you want). The formula uses simple moving averages, but you can use XAVG for exponential, FAVG for front weighted, or HAVG for Hull instead AVG to change the average type.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
sclapp
Posted : Thursday, August 30, 2018 10:41:11 AM
Registered User
Joined: 2/8/2005
Posts: 16

Works great - Thank you Bruce!

Bruce_L
Posted : Thursday, August 30, 2018 11:26:39 AM


Worden Trainer

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

You're welcome.



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