Registered User Joined: 3/13/2005 Posts: 19
|
Could you explain the logic for the gappers formula with the result being numeric: 0,1,2? formula: -1 * (L>H1) + -2* (H<L1) How is the <,> boolean used in the numeric formula resulting in "gap up" or "gap down"? I would like to find only gap ups.
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
If you put a boolean (true or false) expression inside of parentheses in a formula which will return a numeric value, true will return -1 and false will return 0. So:
-1 * (L > H1)
Returns 1 when there is a gap up and 0 otherwise while:
-2 * (H < L1)
Returns 2 when there is a gap down and 0 otherwise. Adding these results together creates a formula which returns 1 when there is a gap up, 2 when there is a gap down and 0 otherwise.
If you just want to identify gap ups using a Condition Formula, the formula would be much simpler:
L > H1
This checks for the low of the current bar being greater than the high of the previous bar.
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: 3/13/2005 Posts: 19
|
Thanks Bruce for prompt, clear reply and valuable links. Earl S.
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|