Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 8/23/2012 Posts: 59
|
Hi, how coud I write the following PCF ?
Conditions:
1) EMA21 is below EMA55
2) Previous Bar crosses EMA21 and closes above it
3) Current Bar body is above EMA21 (Open, Low, High and Close all above EMA21)
4) Current Bar Open Price higher than Previous Bar Close
5) Current Bar Close is higher than Current Open
Thanks.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Please the following Condition Formula:
XAVGC21 < XAVGC55 AND (C1 > XAVGC21.1 AND (C2 < XAVGC21.2 OR L1 < XAVGC21.1)) AND L > XAVGC21 AND O > C1 AND C > O
PCF Formula Descriptions
Handy PCF example formulas to help you learn the syntax of PCFs!
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 8/23/2012 Posts: 59
|
Thanks.
Don't understand the condition of the two Bars ago ?
(C2 < XAVGC21.2 OR L1 < XAVGC21.1)
Shouldn't I be comparing only the current and the previous Bars ?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
That is for the "Previous Bar crosses EMA21 and closes above it" requirement.
It checks for both a tradional crossup where the previous close was before the moving average and the current close is above the moving average and for the possibility that the low is just below the moving average and the close is above the moving average. The entirety of the portion of the formula is:
(C1 > XAVGC21.1 AND (C2 < XAVGC21.2 OR L1 < XAVGC21.1))
If you have something else in mind, you can change it as desired.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 8/23/2012 Posts: 59
|
thanks Bruce.
|
|
Registered User Joined: 10/7/2004 Posts: 794
|
I am trying to write a PCF when current 5' barcloses over the previous 30' 20 dma and I am coming up with C5>AvgC20.30 and C5.1>AvgC20.30.1 but it doesn't seem correct. Comments TY in advance!
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
There isn't any built in syntax for mixing time frames in a single Personal Criteria Formula and there really isn't a way to do using the non-rolling time frames used in TC2000 version 12.3 (the rolling time frames in TC2000 version 7 sometimes allow manually constructing longer time frames from shorter time frames).
The C5 > AVGC20.30 in the first part of your formula is for the close of 5-bars ago being above the 20-Period Simple Moving Average of 30-bars ago.
The C5.1 > AVGC20.30.1 used in the second part of your formula is completely meaningless and not valid syntax.
You could get an approximation by creating a 5-minute Condition Formula where you estimate the 30-minute moving average by multiplying its period by 6, but it will not exactly match the charts:
C > AVGC120 AND C1 <= AVGC120.1
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 10/7/2004 Posts: 794
|
Thank you but where is the 20dma in this PCF?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The AVGC120 on a 5' chart is the approximation being used for the AVGC20 on a 30' minute chart.
20 * 6 = 120
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 10/7/2004 Posts: 794
|
What if I use sort function Close compared to 20sma, time frame 5', frequency 30'
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
It is not possible using the non-rolling bars in TC2000 version 12.3.
As mentioned in my original response, you can do this using the rolling time frames of TC2000 version 7 (although it would have to be done as a Custom PCF % True Indicator on a 5-minute chart and not a Personal Criteria Formula which can only use a Daily Time Frame in TC2000 version 7):
19 * C > C6 + C12 + C18 + C24 + C30 + C36 + C42 + C48 + C54 + C60 + C66 + C72 + C78 + C84 + C90 + C96 + C102 + C108 + C114 AND 19 * C1 > C7 + C13 + C19 + C25 + C31 + C37 + C43 + C49 + C55 + C61 + C67 + C73 + C79 + C85 + C91 + C97 + C103 + C109 + C115
Note that absolutely no values are shared between the 30' AVGC20 of the current 5' bar and the 30' AVGC20 of the prior 5' bar.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 10/7/2004 Posts: 794
|
Thank you for your assistance
|
|
Registered User Joined: 10/7/2004 Posts: 794
|
How can I write a pcf to determine how far price is from 20 ema
Thank you!
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The directional net difference (so + above and - below):
C - XAVGC20
The directional % difference:
100 * (C / XAVGC20 - 1)
The absolute difference (so + both when above and below):
ABS(C - XAVGC20)
The absolute % difference:
100 * ABS(C / XAVGC20 - 1)
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 10/7/2004 Posts: 794
|
Thank you!
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |