Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 3/20/2005 Posts: 46
|
i want a pcf to identify wide range bars--either bullish or bearish 'bodies' (open to close)--for the last 20 days.
i've tried several failed attempts, the last showing the first line only below (which was repeated with similar lines incremented by one day each for 20 lines):
((O - C > (O1 - C1) * 2) OR (C - O > (C1 - O1) * 2))
thanks,
jl
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
It looks like you are defining a Wide Range Bar as having a distance between the Open and Close being more than twice the distance between the Open and Close of the previous Bar. If so, I think you would want something more like the following:
(ABS(O - C) > ABS(O1 - C1) * 2 AND O1 <> C1)
Even so, over a period of 20-Bars, I would expect this to be True for most stocks most of the time.
(ABS(O - C) > ABS(O1 - C1) * 2 AND O1 <> C1) OR (ABS(O1 - C1) > ABS(O2 - C2) * 2 AND O2 <> C2) OR (ABS(O2 - C2) > ABS(O3 - C3) * 2 AND O3 <> C3) OR (ABS(O3 - C3) > ABS(O4 - C4) * 2 AND O4 <> C4) OR (ABS(O4 - C4) > ABS(O5 - C5) * 2 AND O5 <> C5) OR (ABS(O5 - C5) > ABS(O6 - C6) * 2 AND O6 <> C6) OR (ABS(O6 - C6) > ABS(O7 - C7) * 2 AND O7 <> C7) OR (ABS(O7 - C7) > ABS(O8 - C8) * 2 AND O8 <> C8) OR (ABS(O8 - C8) > ABS(O9 - C9) * 2 AND O9 <> C9) OR (ABS(O9 - C9) > ABS(O10 - C10) * 2 AND O10 <> C10) OR (ABS(O10 - C10) > ABS(O11 - C11) * 2 AND O11 <> C11) OR (ABS(O11 - C11) > ABS(O12 - C12) * 2 AND O12 <> C12) OR (ABS(O12 - C12) > ABS(O13 - C13) * 2 AND O13 <> C13) OR (ABS(O13 - C13) > ABS(O14 - C14) * 2 AND O14 <> C14) OR (ABS(O14 - C14) > ABS(O15 - C15) * 2 AND O15 <> C15) OR (ABS(O15 - C15) > ABS(O16 - C16) * 2 AND O16 <> C16) OR (ABS(O16 - C16) > ABS(O17 - C17) * 2 AND O17 <> C17) OR (ABS(O17 - C17) > ABS(O18 - C18) * 2 AND O18 <> C18) OR (ABS(O18 - C18) > ABS(O19 - C19) * 2 AND O19 <> C19) OR (ABS(O19 - C19) > ABS(O20 - C20) * 2 AND O20 <> C20)
Is that the definition you want to use or did you have something else in mind when you wrote the formula?
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
|
|
Registered User Joined: 3/20/2005 Posts: 46
|
bruce,
i guess i was less clear in print than i was in the grey cells. what i'm looking for is a wide-range bar that's bigger than any and all of the last 20 bars. looking at your code i realized that you were comparing each bar of the 20 with its previous bar.
i'm editing your code so that each first parenthetical unit will be the same (ABS(O-C) and each line will be:
ABS(O-C) > ABS(On-Cn)*2 AND On <>Cn ...AND... etc.
i'm going to try it but would like to know if my thinking is correct.
also, i'm afraid i don't understand the function of the 'On<>Cn' element. i'm guessing this means 'greater than OR lessor than' in order to address either a bullish or bearish bar. is this correct?
thanks,
jl
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The <> means not equal. It is designed to eliminate the possibility of a dojis. I probably wouldn't recommend it if you are comparing a single Bar to 19 or 20 other Bars as the probability would be quite low.
Your thinking is correct and results in the following if the Body of the most recent Bar just needs to be the widest of the most recent 20 Bars by a factor of 2 (more than twice as wide as the previous 19):
ABS(O - C) > ABS(O1 - C1) * 2 AND ABS(O - C) > ABS(O2 - C2) * 2 AND ABS(O - C) > ABS(O3 - C3) * 2 AND ABS(O - C) > ABS(O4 - C4) * 2 AND ABS(O - C) > ABS(O5 - C5) * 2 AND ABS(O - C) > ABS(O6 - C6) * 2 AND ABS(O - C) > ABS(O7 - C7) * 2 AND ABS(O - C) > ABS(O8 - C8) * 2 AND ABS(O - C) > ABS(O9 - C9) * 2 AND ABS(O - C) > ABS(O10 - C10) * 2 AND ABS(O - C) > ABS(O11 - C11) * 2 AND ABS(O - C) > ABS(O12 - C12) * 2 AND ABS(O - C) > ABS(O13 - C13) * 2 AND ABS(O - C) > ABS(O14 - C14) * 2 AND ABS(O - C) > ABS(O15 - C15) * 2 AND ABS(O - C) > ABS(O16 - C16) * 2 AND ABS(O - C) > ABS(O17 - C17) * 2 AND ABS(O - C) > ABS(O18 - C18) * 2 AND ABS(O - C) > ABS(O19 - C19) * 2
Or needs to add an additional term if it needs to be more than twice as wide as the previous 20 Bars:
ABS(O - C) > ABS(O1 - C1) * 2 AND ABS(O - C) > ABS(O2 - C2) * 2 AND ABS(O - C) > ABS(O3 - C3) * 2 AND ABS(O - C) > ABS(O4 - C4) * 2 AND ABS(O - C) > ABS(O5 - C5) * 2 AND ABS(O - C) > ABS(O6 - C6) * 2 AND ABS(O - C) > ABS(O7 - C7) * 2 AND ABS(O - C) > ABS(O8 - C8) * 2 AND ABS(O - C) > ABS(O9 - C9) * 2 AND ABS(O - C) > ABS(O10 - C10) * 2 AND ABS(O - C) > ABS(O11 - C11) * 2 AND ABS(O - C) > ABS(O12 - C12) * 2 AND ABS(O - C) > ABS(O13 - C13) * 2 AND ABS(O - C) > ABS(O14 - C14) * 2 AND ABS(O - C) > ABS(O15 - C15) * 2 AND ABS(O - C) > ABS(O16 - C16) * 2 AND ABS(O - C) > ABS(O17 - C17) * 2 AND ABS(O - C) > ABS(O18 - C18) * 2 AND ABS(O - C) > ABS(O19 - C19) * 2 AND ABS(O - C) > ABS(O20 - C20) * 2
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |