Registered User Joined: 3/20/2005 Posts: 46
|
i'm trying to code the following scan to no avail:
a wide range bar (+2%) followed by a narrow range bar (-1%) irrespective of the direction (bullish or bearish) of either (i.e., a wide green bar followed by a narrow green OR red bar and vice versa). i thought this might be done using ABS values (preferred), but may require two separate scans depending on direction.
thanks.
jl
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Assuming the comparison to determine if the Bar is wide or narrow is just made to the previous Bar, a Wide Range Bar that is at least 2% larger followed by a narrow Range Bar that is at least 1% narrower could be written as:
H - L <= .99 * (H1 - L1) AND H1 - L1 >= 1.02 * (H2 - L2)
That said, your mention of the absolute value function makes me wonder if you mean a Wide Range Body and Narrow Range Body instead:
ABS(C - O) <= .99 * ABS(C1 - O1) AND ABS(C1 - O1) >= 1.02 * ABS(C2 - O2)
It is also possible of course that you mean something else entirely. 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
|