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 |

moving averages crossing Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
mccl
Posted : Monday, November 29, 2010 9:27:26 AM
Gold Customer Gold Customer

Joined: 10/20/2007
Posts: 27
How do you write a pcf for the exact day that a moving average crosses another? i.e.  3day ex crossing 5 day ex    (yesterday)  not 7 days ago     TY Mccl
StockGuy
Posted : Monday, November 29, 2010 10:57:59 AM

Administration

Joined: 9/30/2004
Posts: 9,187
PCFs are exact in nature.  They will only return true on the day the conditions are met.  If you want to scan for a crossover that occurred the previous day, use this:

Crossing up through 5 period average
AVGC3.1 < AVGC5.1 and AVGC3 > AVGC5

Crossing up down 5 period average
AVGC3.1 > AVGC5.1 and AVGC3 < AVGC5
Bruce_L
Posted : Tuesday, November 30, 2010 8:49:43 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
mccl,
Please try one of the following:

SMA3 xUp SMA5:

AVGC3 > AVGC5 AND AVGC3.1 <= AVGC5.1

SMA3 xDn SMA5:

AVGC3 < AVGC5 AND AVGC3.1 >= AVGC5.1

SMA3 crossing SMA5 (either direction):

SGN(AVGC3 - AVGC5) <> SGN(AVGC3.1 - AVGC5.1)

EMA3 xUp EMA5:

XAVGC3 > XAVGC5 AND XAVGC3.1 <= XAVGC5.1

EMA3 xDn EMA5:

XAVGC3 < XAVGC5 AND XAVGC3.1 >= XAVGC5.1

EMA3 crossing EMA5 (either direction):

SGN(XAVGC3 - XAVGC5) <> SGN(XAVGC3.1 - XAVGC5.1)

If the formulas do not appear to match your charts, please review the Things to check if your moving averages don't "seem right" or "seem to match" topic.

How to create a Personal Criteria Forumula (PCF)
Moving Average PCF Templates
PCF Formula Descriptions
Handy PCF example formulas to help you learn the syntax of PCFs!

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