Gold Customer
Joined: 1/10/2011 Posts: 4
|
I'm trying to write some PCF scripts that allow me to determine when moving closing price averages crossed a number of weeks ago. I'm interested in learning how to do this both for daily moving averages and weekly moving averages. I think I've figured out the daily, but not the weekly.
For the daily cross, I think it's (for this example, the cross occurs sometime 2 weeks ago):
AVGC4.10 < AVGC10.10
AVGC4.5 > AVGC10.5
Then, determining that it stayed up above this week (or more precisely, today):
AVGC4 > AVGC10
How would I write this for the weekly price crossings occurring a week or two ago, instead of daily crossings?
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You would use a Weekly Time Frame instead of Daily Time Frame for the Condition Formula and use bars ago parameters which reflect 0, 1 and 2 weekly bars ago instead of 0, 5 and 10 daily bars ago:
AVGC4.2 < AVGC10.2 AND AVGC4.1 > AVGC10.1 AND AVGC4 > AVGC10
PCF Formula Descriptions
Handy PCF example formulas to help you learn the syntax of PCFs!
-Bruce Personal Criteria Formulas TC2000 Support Articles
|