Registered User Joined: 10/7/2004 Posts: 5
|
Two Questions: I would like to write two PCF's....
1/ When an 18 day moving average crosses a 40 day moving average; either up or down
2/ When there is a convergence, either direction, of a 4, 18 and 40 moving average... all lines meeting at the same point
Are either of these possible?
|

 Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
QUOTE (Watchman) When an 18 day moving average crosses a 40 day moving average; either up or down
Please try one of the following:
SMA18 xUp SMA40:
AVGC18 > AVGC40 AND AVGC18.1 <= AVGC40.1
SMA18 xDn SMA40:
AVGC18 < AVGC40 AND AVGC18.1 >= AVGC40.1
SMA18 crossing SMA40 (either direction):
SGN(AVGC18 - AVGC40) <> SGN(AVGC18.1 - AVGC40.1)
EMA18 xUp EMA40:
XAVGC18 > XAVGC40 AND XAVGC18.1 <= XAVGC40.1
EMA18 xDn EMA40:
XAVGC18 < XAVGC40 AND XAVGC18.1 >= XAVGC40.1
EMA18 crossing EMA40 (either direction):
SGN(XAVGC18 - XAVGC40) <> SGN(XAVGC18.1 - XAVGC40.1)
QUOTE (Watchman) When there is a convergence, either direction, of a 4, 18 and 40 moving average... all lines meeting at the same point
You could calculate the Percentage that the highest Moving Average is above the lowest Moving Average as:
Simple:
100 * ((AVGC4 + AVGC18 + ABS(AVGC4 - AVGC18) + 2 * (AVGC40) + ABS(AVGC4 + AVGC18 + ABS(AVGC4 - AVGC18) - 2 * (AVGC40))) / (AVGC4 + AVGC18 - ABS(AVGC4 - AVGC18) + 2 * (AVGC40) - ABS(AVGC4 + AVGC18 - ABS(AVGC4 - AVGC18) - 2 * (AVGC40))) - 1)
Exponential:
100 * ((XAVGC4 + XAVGC18 + ABS(XAVGC4 - XAVGC18) + 2 * (XAVGC40) + ABS(XAVGC4 + XAVGC18 + ABS(XAVGC4 - XAVGC18) - 2 * (XAVGC40))) / (XAVGC4 + XAVGC18 - ABS(XAVGC4 - XAVGC18) + 2 * (XAVGC40) - ABS(XAVGC4 + XAVGC18 - ABS(XAVGC4 - XAVGC18) - 2 * (XAVGC40))) - 1)
You could then check for this to be less than some arbitrary percentage (the following add < 1 to check for the range to be less than 1%):
Simple:
100 * ((AVGC4 + AVGC18 + ABS(AVGC4 - AVGC18) + 2 * (AVGC40) + ABS(AVGC4 + AVGC18 + ABS(AVGC4 - AVGC18) - 2 * (AVGC40))) / (AVGC4 + AVGC18 - ABS(AVGC4 - AVGC18) + 2 * (AVGC40) - ABS(AVGC4 + AVGC18 - ABS(AVGC4 - AVGC18) - 2 * (AVGC40))) - 1) < 1
Exponential:
100 * ((XAVGC4 + XAVGC18 + ABS(XAVGC4 - XAVGC18) + 2 * (XAVGC40) + ABS(XAVGC4 + XAVGC18 + ABS(XAVGC4 - XAVGC18) - 2 * (XAVGC40))) / (XAVGC4 + XAVGC18 - ABS(XAVGC4 - XAVGC18) + 2 * (XAVGC40) - ABS(XAVGC4 + XAVGC18 - ABS(XAVGC4 - XAVGC18) - 2 * (XAVGC40))) - 1) < 1
You may wish to review the following:
Moving Average PCF Templates
Things to check if your moving averages don't "seem right" or "seem to match"
How to create a Personal Criteria Forumula (PCF)
PCF Formula Descriptions
Min Max PCFs
Handy PCF example formulas to help you learn the syntax of PCFs!
-Bruce Personal Criteria Formulas TC2000 Support Articles
|