Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 1/1/2007 Posts: 49
|
How would I write a pcf for An average true range of 7 or above ?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
True Range is the largest of the High minus the Low, the High minus the previous Close or the previous Close minus the Low. A very useful way of calculating this value for the purpose of creating Personal Criteria Formulas is:
(H -L + ABS(H - C1) + ABS(C1 - L)) / 2
Average True Range is the Moving Average of this value and will have different formulas for different periods and Moving Average types. I'm going to use a Period of 7 because that is what was mentioned in the topic that seems to be prompting this request(The mechanics of bottom feeding ?). It could be calculated using a Simple Moving Average:
7-Period Simple Moving Average of True Range:
(AVGH7 - AVGL7) / 2 + (ABS(H - C1) + ABS(C1 - L) + ABS(H1 - C2) + ABS(C2 - L1) + ABS(H2 - C3) + ABS(C3 - L2) + ABS(H3 - C4) + ABS(C4 - L3) + ABS(H4 - C5) + ABS(C5 - L4) + ABS(H5 - C6) + ABS(C6 - L5) + ABS(H6 - C7) + ABS(C7 - L6)) / 14
It is usually calculated using Wilder's Smoothing however. Wilder's Smoothing is a variation of an Exponential Moving Average. You can double the Wilder Period and subtract one to get the Exponential Moving Average Period:
7-Period Average True Range (Wilder's Smoothed):
XAVGH13 - XAVGL13 + .142996048056393 * ((H < C1) * (H - C1) + (C1 < L) * (C1 - L) + 6 / 7 * ((H1 < C2) * (H1 - C2) + (C2 < L1) * (C2 - L1) + 6 / 7 * ((H2 < C3) * (H2 - C3) + (C3 < L2) * (C3 - L2) + 6 / 7 * ((H3 < C4) * (H3 - C4) + (C4 < L3) * (C4 - L3) + 6 / 7 * ((H4 < C5) * (H4 - C5) + (C5 < L4) * (C5 - L4) + 6 / 7 * ((H5 < C6) * (H5 - C6) + (C6 < L5) * (C6 - L5) + 6 / 7 * ((H6 < C7) * (H6 - C7) + (C7 < L6) * (C7 - L6) + 6 / 7 * ((H7 < C8) * (H7 - C8) + (C8 < L7) * (C8 - L7) + 6 / 7 * ((H8 < C9) * (H8 - C9) + (C9 < L8) * (C9 - L8) + 6 / 7 * ((H9 < C10) * (H9 - C10) + (C10 < L9) * (C10 - L9) + 6 / 7 * ((H10 < C11) * (H10 - C11) + (C11 < L10) * (C11 - L10) + 6 / 7 * ((H11 < C12) * (H11 - C12) + (C12 < L11) * (C12 - L11) + 6 / 7 * ((H12 < C13) * (H12 - C13) + (C13 < L12) * (C13 - L12) + 6 / 7 * ((H13 < C14) * (H13 - C14) + (C14 < L13) * (C14 - L13) + 6 / 7 * ((H14 < C15) * (H14 - C15) + (C15 < L14) * (C15 - L14) + 6 / 7 * ((H15 < C16) * (H15 - C16) + (C16 < L15) * (C16 - L15) + 6 / 7 * ((H16 < C17) * (H16 - C17) + (C17 < L16) * (C17 - L16) + 6 / 7 * ((H17 < C18) * (H17 - C18) + (C18 < L17) * (C18 - L17) + 6 / 7 * ((H18 < C19) * (H18 - C19) + (C19 < L18) * (C19 - L18) + 6 / 7 * ((H19 < C20) * (H19 - C20) + (C20 < L19) * (C20 - L19) + 6 / 7 * ((H20 < C21) * (H20 - C21) + (C21 < L20) * (C21 - L20) + 6 / 7 * ((H21 < C22) * (H21 - C22) + (C22 < L21) * (C22 - L21) + 6 / 7 * ((H22 < C23) * (H22 - C23) + (C23 < L22) * (C23 - L22) + 6 / 7 * ((H23 < C24) * (H23 - C24) + (C24 < L23) * (C24 - L23) + 6 / 7 * ((H24 < C25) * (H24 - C25) + (C25 < L24) * (C25 - L24) + 6 / 7 * ((H25 < C26) * (H25 - C26) + (C26 < L25) * (C26 - L25) + 6 / 7 * ((H26 < C27) * (H26 - C27) + (C27 < L26) * (C27 - L26) + 6 / 7 * ((H27 < C28) * (H27 - C28) + (C28 < L27) * (C28 - L27) + 6 / 7 * ((H28 < C29) * (H28 - C29) + (C29 < L28) * (C29 - L28) + 6 / 7 * ((H29 < C30) * (H29 - C30) + (C30 < L29) * (C30 - L29) + 6 / 7 * ((H30 < C31) * (H30 - C31) + (C31 < L30) * (C31 - L30) + 6 / 7 * ((H31 < C32) * (H31 - C32) + (C32 < L31) * (C32 - L31) + 6 / 7 * ((H32 < C33) * (H32 - C33) + (C33 < L32) * (C33 - L32) + 6 / 7 * ((H33 < C34) * (H33 - C34) + (C34 < L33) * (C34 - L33) + 6 / 7 * ((H34 < C35) * (H34 - C35) + (C35 < L34) * (C35 - L34) + 6 / 7 * ((H35 < C36) * (H35 - C36) + (C36 < L35) * (C36 - L35) + 6 / 7 * ((H36 < C37) * (H36 - C37) + (C37 < L36) * (C37 - L36) + 6 / 7 * ((H37 < C38) * (H37 - C38) + (C38 < L37) * (C38 - L37) + 6 / 7 * ((H38 < C39) * (H38 - C39) + (C39 < L38) * (C39 - L38) + 6 / 7 * ((H39 < C40) * (H39 - C40) + (C40 < L39) * (C40 - L39) + 6 / 7 * ((H40 < C41) * (H40 - C41) + (C41 < L40) * (C41 - L40) + 6 / 7 * ((H41 < C42) * (H41 - C42) + (C42 < L41) * (C42 - L41) + 6 / 7 * ((H42 < C43) * (H42 - C43) + (C43 < L42) * (C43 - L42) + 6 / 7 * ((H43 < C44) * (H43 - C44) + (C44 < L43) * (C44 - L43) + 6 / 7 * ((H44 < C45) * (H44 - C45) + (C45 < L44) * (C45 - L44))))))))))))))))))))))))))))))))))))))))))))))
Here's an Exponential version to round things out:
7-Period Exponential Moving Average of True Range:
XAVGH7 - XAVGL7 + .250188277551581 * ((H < C1) * (H - C1) + (C1 < L) * (C1 - L) + .75 * ((H1 < C2) * (H1 - C2) + (C2 < L1) * (C2 - L1) + .75 * ((H2 < C3) * (H2 - C3) + (C3 < L2) * (C3 - L2) + .75 * ((H3 < C4) * (H3 - C4) + (C4 < L3) * (C4 - L3) + .75 * ((H4 < C5) * (H4 - C5) + (C5 < L4) * (C5 - L4) + .75 * ((H5 < C6) * (H5 - C6) + (C6 < L5) * (C6 - L5) + .75 * ((H6 < C7) * (H6 - C7) + (C7 < L6) * (C7 - L6) + .75 * ((H7 < C8) * (H7 - C8) + (C8 < L7) * (C8 - L7) + .75 * ((H8 < C9) * (H8 - C9) + (C9 < L8) * (C9 - L8) + .75 * ((H9 < C10) * (H9 - C10) + (C10 < L9) * (C10 - L9) + .75 * ((H10 < C11) * (H10 - C11) + (C11 < L10) * (C11 - L10) + .75 * ((H11 < C12) * (H11 - C12) + (C12 < L11) * (C12 - L11) + .75 * ((H12 < C13) * (H12 - C13) + (C13 < L12) * (C13 - L12) + .75 * ((H13 < C14) * (H13 - C14) + (C14 < L13) * (C14 - L13) + .75 * ((H14 < C15) * (H14 - C15) + (C15 < L14) * (C15 - L14) + .75 * ((H15 < C16) * (H15 - C16) + (C16 < L15) * (C16 - L15) + .75 * ((H16 < C17) * (H16 - C17) + (C17 < L16) * (C17 - L16) + .75 * ((H17 < C18) * (H17 - C18) + (C18 < L17) * (C18 - L17) + .75 * ((H18 < C19) * (H18 - C19) + (C19 < L18) * (C19 - L18) + .75 * ((H19 < C20) * (H19 - C20) + (C20 < L19) * (C20 - L19) + .75 * ((H20 < C21) * (H20 - C21) + (C21 < L20) * (C21 - L20) + .75 * ((H21 < C22) * (H21 - C22) + (C22 < L21) * (C22 - L21) + .75 * ((H22 < C23) * (H22 - C23) + (C23 < L22) * (C23 - L22) + .75 * ((H23 < C24) * (H23 - C24) + (C24 < L23) * (C24 - L23) + .75 * ((H24 < C25) * (H24 - C25) + (C25 < L24) * (C25 - L24))))))))))))))))))))))))))
To find if any of these is above 7, just add a > 7 to the end. Based on my reading, this does not specifically appear to be what HaveNoCents is suggesting in the topic mentioned above however. You may wish to review the following:
How to create a Personal Criteria Forumula (PCF) Handy PCF example formulas to help you learn the syntax of PCFs!
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 12/13/2006 Posts: 14
|
Bruce: How would I add Volume to the PCF so that I would only get stocks that trade above 90,000 shares per day and less than 200,000? Thanks
|
|
Worden Trainer
Joined: 10/1/2004 Posts: 18,819
|
No need for a PCF
Just add Volume 90-day to your EasyScan and limit the VALUE range to 900 to 2000
- Craig Here to Help!
|
|
Registered User Joined: 12/13/2006 Posts: 14
|
I don't have an easy scan for ATR, can you help me with that?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
riptide681, To create an EasyScan based on Average True Range, create a Personal Criteria Formula for ATR and use it as an EasyScan Condition. You may wish to review the following:
Using EasyScan to find stocks that meet your own criteria
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 12/13/2006 Posts: 14
|
Thanks Bruce, I will review the instructions, and try it.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 12/13/2006 Posts: 14
|
Hi Bruce, watched the video, but now can you tell me where I can find out about making a personal criteria formula? Thanks
|
|
Worden Trainer
Joined: 10/1/2004 Posts: 18,819
|
Check out this video (linked by Bruce above)
How to create a Personal Criteria Forumula (PCF)
You should review all of these videos: If you are new to TeleChart READ THIS FIRST!
- Craig Here to Help!
|
|
Guest-1 |