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