Registered User Joined: 12/31/2004 Posts: 7
|
hi there,
is there a way to write pcf to create scan using weekly data ? i.e. I want the open and close to refer to the open and close for the week instead of for the day. I can not use C5 because this said 5 days ago, not necessarily the week.
thanks in advance.
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
For the Open, multiply the days ago parameter by 5 and add 4 to get the weekly version.
O = O4
O1 = O9
O2 = O14
For the High, H is replaced by MAXH5 and if there is a days ago parameter in the daily version, multiply it by 5 and separate it from MAXH5 with a '.'.
H = MAXH5
H1 = MAXH5.5
H2 = MAXH5.10
The Low is treated very much like the High. L is replaced by MINL5 and if there is a days ago parameter in the daily version, multiply it by 5 and separate it from MINL5 with a '.'.
L = MINL5
L1 = MINL5.5
L2 = MINL5.10
The Close is probably the simplest. Just multiply the days ago parameter in the daily version by 5 to get the weekly version.
C = C
C1 = C5
C2 = C10
Volume is an interesting case. To get the actual Volume for a weekly bar (in Blocks of 100), you would need to multiply the Average Volume by 5. So V would be replaced by AVGV5 and if there is a days ago parameter in the daily version, multiply it by 5 and separate it from MINL5 with a '.' just like with the High and Low. But add *5 to the end of each weekly version whether or not there is a days ago parameter.
V = AVGV5*5
V1 = AVGV5.5*5
V2 = AVGV5.10*5
That said, if you are just comparing one Volume to another, there really isn't a reason to multiply it by 5 at all:
AVGV5*5 > AVGV5.5*5
Will return the same result as:
AVGV5 > AVGV5.5
Things can get a lot more complicated for weekly versions of some indicators. In same cases, it is not possible to write a weekly version (a weekly TSV for example).
Let's take a look at the Three Black Crow pattern from Boolean PCFs for Candlestick Patterns:
Three Black Crows
O1<O2 AND
O1>C2 AND
O<O1 AND
O>C1 AND
C1<L2 AND
C<L1 AND
C2<L2*1.05 AND
C1<L1*1.05 AND
C<L*1.05
So what do we end up with?
O0 < O14 AND O9 > C10 AND O4 < O9 AND O4 > C5 AND C5 < MINL5.10 AND C < MINL5.5 AND C10 < MINL5.10 * 1.05 AND C5 < MINL5.5 * 1.05 AND C < MINL5 * 1.05
You may wish to review the following:
How to create a Personal Criteria Forumula (PCF)
PCF Formula Descriptions
Handy PCF example formulas to help you learn the syntax of PCFs!
-Bruce Personal Criteria Formulas TC2000 Support Articles
|