Registered User Joined: 11/14/2014 Posts: 5
|
Hi, how can I create a scan to look for a gap and close outside (either above or below) the keltner channels for the last trading period?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The following assumes that the gap requires the low to be above the previous high or the high to be below the previous low, that you are interested in 1 bar ago and the settings for the Keltner Channels are Period = 20, ATR Multiplier = 1.50 and Average Type = Exponential.
(L1 > H2 OR H1 < L2) AND ABS(C1 - (XAVGH20.1 + XAVGL20.1 + XAVGC20.1) / 3) > 1.5 * (XAVGH20.1 - XAVGL20.1 + .095324514 * ((H1 < C2) * (H1 - C2) + (C2 < L1) * (C2 - L1) + 19 / 21 * ((H2 < C3) * (H2 - C3) + (C3 < L2) * (C3 - L2) + 19 / 21 * ((H3 < C4) * (H3 - C4) + (C4 < L3) * (C4 - L3) + 19 / 21 * ((H4 < C5) * (H4 - C5) + (C5 < L4) * (C5 - L4) + 19 / 21 * ((H5 < C6) * (H5 - C6) + (C6 < L5) * (C6 - L5) + 19 / 21 * ((H6 < C7) * (H6 - C7) + (C7 < L6) * (C7 - L6) + 19 / 21 * ((H7 < C8) * (H7 - C8) + (C8 < L7) * (C8 - L7) + 19 / 21 * ((H8 < C9) * (H8 - C9) + (C9 < L8) * (C9 - L8) + 19 / 21 * ((H9 < C10) * (H9 - C10) + (C10 < L9) * (C10 - L9) + 19 / 21 * ((H10 < C11) * (H10 - C11) + (C11 < L10) * (C11 - L10) + 19 / 21 * ((H11 < C12) * (H11 - C12) + (C12 < L11) * (C12 - L11) + 19 / 21 * ((H12 < C13) * (H12 - C13) + (C13 < L12) * (C13 - L12) + 19 / 21 * ((H13 < C14) * (H13 - C14) + (C14 < L13) * (C14 - L13) + 19 / 21 * ((H14 < C15) * (H14 - C15) + (C15 < L14) * (C15 - L14) + 19 / 21 * ((H15 < C16) * (H15 - C16) + (C16 < L15) * (C16 - L15) + 19 / 21 * ((H16 < C17) * (H16 - C17) + (C17 < L16) * (C17 - L16) + 19 / 21 * ((H17 < C18) * (H17 - C18) + (C18 < L17) * (C18 - L17) + 19 / 21 * ((H18 < C19) * (H18 - C19) + (C19 < L18) * (C19 - L18) + 19 / 21 * ((H19 < C20) * (H19 - C20) + (C20 < L19) * (C20 - L19) + 19 / 21 * ((H20 < C21) * (H20 - C21) + (C21 < L20) * (C21 - L20) + 19 / 21 * ((H21 < C22) * (H21 - C22) + (C22 < L21) * (C22 - L21) + 19 / 21 * ((H22 < C23) * (H22 - C23) + (C23 < L22) * (C23 - L22) + 19 / 21 * ((H23 < C24) * (H23 - C24) + (C24 < L23) * (C24 - L23) + 19 / 21 * ((H24 < C25) * (H24 - C25) + (C25 < L24) * (C25 - L24) + 19 / 21 * ((H25 < C26) * (H25 - C26) + (C26 < L25) * (C26 - L25) + 19 / 21 * ((H26 < C27) * (H26 - C27) + (C27 < L26) * (C27 - L26) + 19 / 21 * ((H27 < C28) * (H27 - C28) + (C28 < L27) * (C28 - L27) + 19 / 21 * ((H28 < C29) * (H28 - C29) + (C29 < L28) * (C29 - L28) + 19 / 21 * ((H29 < C30) * (H29 - C30) + (C30 < L29) * (C30 - L29) + 19 / 21 * ((H30 < C31) * (H30 - C31) + (C31 < L30) * (C31 - L30) + 19 / 21 * ((H31 < C32) * (H31 - C32) + (C32 < L31) * (C32 - L31) + 19 / 21 * ((H32 < C33) * (H32 - C33) + (C33 < L32) * (C33 - L32) + 19 / 21 * ((H33 < C34) * (H33 - C34) + (C34 < L33) * (C34 - L33) + 19 / 21 * ((H34 < C35) * (H34 - C35) + (C35 < L34) * (C35 - L34) + 19 / 21 * ((H35 < C36) * (H35 - C36) + (C36 < L35) * (C36 - L35) + 19 / 21 * ((H36 < C37) * (H36 - C37) + (C37 < L36) * (C37 - L36) + 19 / 21 * ((H37 < C38) * (H37 - C38) + (C38 < L37) * (C38 - L37) + 19 / 21 * ((H38 < C39) * (H38 - C39) + (C39 < L38) * (C39 - L38) + 19 / 21 * ((H39 < C40) * (H39 - C40) + (C40 < L39) * (C40 - L39) + 19 / 21 * ((H40 < C41) * (H40 - C41) + (C41 < L40) * (C41 - L40) + 19 / 21 * ((H41 < C42) * (H41 - C42) + (C42 < L41) * (C42 - L41) + 19 / 21 * ((H42 < C43) * (H42 - C43) + (C43 < L42) * (C43 - L42) + 19 / 21 * ((H43 < C44) * (H43 - C44) + (C44 < L43) * (C44 - L43) + 19 / 21 * ((H44 < C45) * (H44 - C45) + (C45 < L44) * (C45 - L44) + 19 / 21 * ((H45 < C46) * (H45 - C46) + (C46 < L45) * (C46 - L45) + 19 / 21 * ((H46 < C47) * (H46 - C47) + (C47 < L46) * (C47 - L46) + 19 / 21 * ((H47 < C48) * (H47 - C48) + (C48 < L47) * (C48 - L47) + 19 / 21 * ((H48 < C49) * (H48 - C49) + (C49 < L48) * (C49 - L48) + 19 / 21 * ((H49 < C50) * (H49 - C50) + (C50 < L49) * (C50 - L49) + 19 / 21 * ((H50 < C51) * (H50 - C51) + (C51 < L50) * (C51 - L50) + 19 / 21 * ((H51 < C52) * (H51 - C52) + (C52 < L51) * (C52 - L51) + 19 / 21 * ((H52 < C53) * (H52 - C53) + (C53 < L52) * (C53 - L52) + 19 / 21 * ((H53 < C54) * (H53 - C54) + (C54 < L53) * (C54 - L53) + 19 / 21 * ((H54 < C55) * (H54 - C55) + (C55 < L54) * (C55 - L54) + 19 / 21 * ((H55 < C56) * (H55 - C56) + (C56 < L55) * (C56 - L55) + 19 / 21 * ((H56 < C57) * (H56 - C57) + (C57 < L56) * (C57 - L56) + 19 / 21 * ((H57 < C58) * (H57 - C58) + (C58 < L57) * (C58 - L57) + 19 / 21 * ((H58 < C59) * (H58 - C59) + (C59 < L58) * (C59 - L58) + 19 / 21 * ((H59 < C60) * (H59 - C60) + (C60 < L59) * (C60 - L59) + 19 / 21 * ((H60 < C61) * (H60 - C61) + (C61 < L60) * (C61 - L60) + 19 / 21 * ((H61 < C62) * (H61 - C62) + (C62 < L61) * (C62 - L61) + 19 / 21 * ((H62 < C63) * (H62 - C63) + (C63 < L62) * (C63 - L62) + 19 / 21 * ((H63 < C64) * (H63 - C64) + (C64 < L63) * (C64 - L63) + 19 / 21 * ((H64 < C65) * (H64 - C65) + (C65 < L64) * (C65 - L64) + 19 / 21 * ((H65 < C66) * (H65 - C66) + (C66 < L65) * (C66 - L65) + 19 / 21 * ((H66 < C67) * (H66 - C67) + (C67 < L66) * (C67 - L66) + 19 / 21 * ((H67 < C68) * (H67 - C68) + (C68 < L67) * (C68 - L67) + 19 / 21 * ((H68 < C69) * (H68 - C69) + (C69 < L68) * (C69 - L68) + 19 / 21 * ((H69 < C70) * (H69 - C70) + (C70 < L69) * (C70 - L69) + 19 / 21 * ((H70 < C71) * (H70 - C71) + (C71 < L70) * (C71 - L70))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
Note that if the last bar means the current bar instead of 1 bar ago and if we assume the close needs to be inside the Keltner Channels during the previous bar, this becomes a lot easier.
Create a Condition Formula the gap (we can change this if the gap definition is different).
L > H1 OR H < L1
And then add it to the same EasyScan as a condition created by clicking on the Keltner Channels and Create Scan Condition. You would want to choose Exiting Channel from the Price History vs Keltner Channels section of the Condition drop down menu in the Create Scan Condition window.
Create Conditions from Your Chart (5:25)
Building a Scan with Multiple Conditions (7:29)
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 11/14/2014 Posts: 5
|
Hi Bruce and Wow! Thanks for the quick response. I should have specified that the gap must open outside the channels (above or below), as well the close should be outside of the channels. How can I adjust your code to do that? Thanks again. You're help is always greatly appreciated.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Please try the following Condition Formula instead.
(L1 > H2 OR H1 < L2) AND (ABS(O1 - (XAVGH20.1 + XAVGL20.1 + XAVGC20.1) / 3) + ABS(C1 - (XAVGH20.1 + XAVGL20.1 + XAVGC20.1) / 3) - ABS(ABS(O1 - (XAVGH20.1 + XAVGL20.1 + XAVGC20.1) / 3) - ABS(C1 - (XAVGH20.1 + XAVGL20.1 + XAVGC20.1) / 3))) / 2 > 1.5 * (XAVGH20.1 - XAVGL20.1 + .095324514 * ((H1 < C2) * (H1 - C2) + (C2 < L1) * (C2 - L1) + 19 / 21 * ((H2 < C3) * (H2 - C3) + (C3 < L2) * (C3 - L2) + 19 / 21 * ((H3 < C4) * (H3 - C4) + (C4 < L3) * (C4 - L3) + 19 / 21 * ((H4 < C5) * (H4 - C5) + (C5 < L4) * (C5 - L4) + 19 / 21 * ((H5 < C6) * (H5 - C6) + (C6 < L5) * (C6 - L5) + 19 / 21 * ((H6 < C7) * (H6 - C7) + (C7 < L6) * (C7 - L6) + 19 / 21 * ((H7 < C8) * (H7 - C8) + (C8 < L7) * (C8 - L7) + 19 / 21 * ((H8 < C9) * (H8 - C9) + (C9 < L8) * (C9 - L8) + 19 / 21 * ((H9 < C10) * (H9 - C10) + (C10 < L9) * (C10 - L9) + 19 / 21 * ((H10 < C11) * (H10 - C11) + (C11 < L10) * (C11 - L10) + 19 / 21 * ((H11 < C12) * (H11 - C12) + (C12 < L11) * (C12 - L11) + 19 / 21 * ((H12 < C13) * (H12 - C13) + (C13 < L12) * (C13 - L12) + 19 / 21 * ((H13 < C14) * (H13 - C14) + (C14 < L13) * (C14 - L13) + 19 / 21 * ((H14 < C15) * (H14 - C15) + (C15 < L14) * (C15 - L14) + 19 / 21 * ((H15 < C16) * (H15 - C16) + (C16 < L15) * (C16 - L15) + 19 / 21 * ((H16 < C17) * (H16 - C17) + (C17 < L16) * (C17 - L16) + 19 / 21 * ((H17 < C18) * (H17 - C18) + (C18 < L17) * (C18 - L17) + 19 / 21 * ((H18 < C19) * (H18 - C19) + (C19 < L18) * (C19 - L18) + 19 / 21 * ((H19 < C20) * (H19 - C20) + (C20 < L19) * (C20 - L19) + 19 / 21 * ((H20 < C21) * (H20 - C21) + (C21 < L20) * (C21 - L20) + 19 / 21 * ((H21 < C22) * (H21 - C22) + (C22 < L21) * (C22 - L21) + 19 / 21 * ((H22 < C23) * (H22 - C23) + (C23 < L22) * (C23 - L22) + 19 / 21 * ((H23 < C24) * (H23 - C24) + (C24 < L23) * (C24 - L23) + 19 / 21 * ((H24 < C25) * (H24 - C25) + (C25 < L24) * (C25 - L24) + 19 / 21 * ((H25 < C26) * (H25 - C26) + (C26 < L25) * (C26 - L25) + 19 / 21 * ((H26 < C27) * (H26 - C27) + (C27 < L26) * (C27 - L26) + 19 / 21 * ((H27 < C28) * (H27 - C28) + (C28 < L27) * (C28 - L27) + 19 / 21 * ((H28 < C29) * (H28 - C29) + (C29 < L28) * (C29 - L28) + 19 / 21 * ((H29 < C30) * (H29 - C30) + (C30 < L29) * (C30 - L29) + 19 / 21 * ((H30 < C31) * (H30 - C31) + (C31 < L30) * (C31 - L30) + 19 / 21 * ((H31 < C32) * (H31 - C32) + (C32 < L31) * (C32 - L31) + 19 / 21 * ((H32 < C33) * (H32 - C33) + (C33 < L32) * (C33 - L32) + 19 / 21 * ((H33 < C34) * (H33 - C34) + (C34 < L33) * (C34 - L33) + 19 / 21 * ((H34 < C35) * (H34 - C35) + (C35 < L34) * (C35 - L34) + 19 / 21 * ((H35 < C36) * (H35 - C36) + (C36 < L35) * (C36 - L35) + 19 / 21 * ((H36 < C37) * (H36 - C37) + (C37 < L36) * (C37 - L36) + 19 / 21 * ((H37 < C38) * (H37 - C38) + (C38 < L37) * (C38 - L37) + 19 / 21 * ((H38 < C39) * (H38 - C39) + (C39 < L38) * (C39 - L38) + 19 / 21 * ((H39 < C40) * (H39 - C40) + (C40 < L39) * (C40 - L39) + 19 / 21 * ((H40 < C41) * (H40 - C41) + (C41 < L40) * (C41 - L40) + 19 / 21 * ((H41 < C42) * (H41 - C42) + (C42 < L41) * (C42 - L41) + 19 / 21 * ((H42 < C43) * (H42 - C43) + (C43 < L42) * (C43 - L42) + 19 / 21 * ((H43 < C44) * (H43 - C44) + (C44 < L43) * (C44 - L43) + 19 / 21 * ((H44 < C45) * (H44 - C45) + (C45 < L44) * (C45 - L44) + 19 / 21 * ((H45 < C46) * (H45 - C46) + (C46 < L45) * (C46 - L45) + 19 / 21 * ((H46 < C47) * (H46 - C47) + (C47 < L46) * (C47 - L46) + 19 / 21 * ((H47 < C48) * (H47 - C48) + (C48 < L47) * (C48 - L47) + 19 / 21 * ((H48 < C49) * (H48 - C49) + (C49 < L48) * (C49 - L48) + 19 / 21 * ((H49 < C50) * (H49 - C50) + (C50 < L49) * (C50 - L49) + 19 / 21 * ((H50 < C51) * (H50 - C51) + (C51 < L50) * (C51 - L50) + 19 / 21 * ((H51 < C52) * (H51 - C52) + (C52 < L51) * (C52 - L51) + 19 / 21 * ((H52 < C53) * (H52 - C53) + (C53 < L52) * (C53 - L52) + 19 / 21 * ((H53 < C54) * (H53 - C54) + (C54 < L53) * (C54 - L53) + 19 / 21 * ((H54 < C55) * (H54 - C55) + (C55 < L54) * (C55 - L54) + 19 / 21 * ((H55 < C56) * (H55 - C56) + (C56 < L55) * (C56 - L55) + 19 / 21 * ((H56 < C57) * (H56 - C57) + (C57 < L56) * (C57 - L56) + 19 / 21 * ((H57 < C58) * (H57 - C58) + (C58 < L57) * (C58 - L57) + 19 / 21 * ((H58 < C59) * (H58 - C59) + (C59 < L58) * (C59 - L58) + 19 / 21 * ((H59 < C60) * (H59 - C60) + (C60 < L59) * (C60 - L59) + 19 / 21 * ((H60 < C61) * (H60 - C61) + (C61 < L60) * (C61 - L60) + 19 / 21 * ((H61 < C62) * (H61 - C62) + (C62 < L61) * (C62 - L61) + 19 / 21 * ((H62 < C63) * (H62 - C63) + (C63 < L62) * (C63 - L62) + 19 / 21 * ((H63 < C64) * (H63 - C64) + (C64 < L63) * (C64 - L63) + 19 / 21 * ((H64 < C65) * (H64 - C65) + (C65 < L64) * (C65 - L64) + 19 / 21 * ((H65 < C66) * (H65 - C66) + (C66 < L65) * (C66 - L65) + 19 / 21 * ((H66 < C67) * (H66 - C67) + (C67 < L66) * (C67 - L66) + 19 / 21 * ((H67 < C68) * (H67 - C68) + (C68 < L67) * (C68 - L67) + 19 / 21 * ((H68 < C69) * (H68 - C69) + (C69 < L68) * (C69 - L68) + 19 / 21 * ((H69 < C70) * (H69 - C70) + (C70 < L69) * (C70 - L69) + 19 / 21 * ((H70 < C71) * (H70 - C71) + (C71 < L70) * (C71 - L70))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 8/23/2013 Posts: 245
|
Bruce, Using Keltner Channell set to 30 Period 1.50 Atr Multi
How to scan the following: C1 > Lower and C1 < Upper (in the channell), and (current Bar as follows) Open in the Channell and L <= Channell Bottom and C > Channell Bottom
And looking for the Reverse scan of this as well
Thanks
|
|
Registered User Joined: 8/23/2013 Posts: 245
|
Can this be done?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
A Condition Formula for the entire thing is too long and slow to be practical or post in the forums. What you could do is create a Condition Formula for price being inside the Keltner Channels during the previous bar.
ABS(C1 - (XAVGH30.1 + XAVGL30.1 + XAVGC30.1) / 3) < 1.5 * ((XAVGH30.1 - XAVGL30.1) / 2 + .032289458 * (ABS(H1 - C2) + ABS(L1 - C2) + 29 / 31 * (ABS(H2 - C3) + ABS(L2 - C3) + 29 / 31 * (ABS(H3 - C4) + ABS(L3 - C4) + 29 / 31 * (ABS(H4 - C5) + ABS(L4 - C5) + 29 / 31 * (ABS(H5 - C6) + ABS(L5 - C6) + 29 / 31 * (ABS(H6 - C7) + ABS(L6 - C7) + 29 / 31 * (ABS(H7 - C8) + ABS(L7 - C8) + 29 / 31 * (ABS(H8 - C9) + ABS(L8 - C9) + 29 / 31 * (ABS(H9 - C10) + ABS(L9 - C10) + 29 / 31 * (ABS(H10 - C11) + ABS(L10 - C11) + 29 / 31 * (ABS(H11 - C12) + ABS(L11 - C12) + 29 / 31 * (ABS(H12 - C13) + ABS(L12 - C13) + 29 / 31 * (ABS(H13 - C14) + ABS(L13 - C14) + 29 / 31 * (ABS(H14 - C15) + ABS(L14 - C15) + 29 / 31 * (ABS(H15 - C16) + ABS(L15 - C16) + 29 / 31 * (ABS(H16 - C17) + ABS(L16 - C17) + 29 / 31 * (ABS(H17 - C18) + ABS(L17 - C18) + 29 / 31 * (ABS(H18 - C19) + ABS(L18 - C19) + 29 / 31 * (ABS(H19 - C20) + ABS(L19 - C20) + 29 / 31 * (ABS(H20 - C21) + ABS(L20 - C21) + 29 / 31 * (ABS(H21 - C22) + ABS(L21 - C22) + 29 / 31 * (ABS(H22 - C23) + ABS(L22 - C23) + 29 / 31 * (ABS(H23 - C24) + ABS(L23 - C24) + 29 / 31 * (ABS(H24 - C25) + ABS(L24 - C25) + 29 / 31 * (ABS(H25 - C26) + ABS(L25 - C26) + 29 / 31 * (ABS(H26 - C27) + ABS(L26 - C27) + 29 / 31 * (ABS(H27 - C28) + ABS(L27 - C28) + 29 / 31 * (ABS(H28 - C29) + ABS(L28 - C29) + 29 / 31 * (ABS(H29 - C30) + ABS(L29 - C30) + 29 / 31 * (ABS(H30 - C31) + ABS(L30 - C31) + 29 / 31 * (ABS(H31 - C32) + ABS(L31 - C32) + 29 / 31 * (ABS(H32 - C33) + ABS(L32 - C33) + 29 / 31 * (ABS(H33 - C34) + ABS(L33 - C34) + 29 / 31 * (ABS(H34 - C35) + ABS(L34 - C35) + 29 / 31 * (ABS(H35 - C36) + ABS(L35 - C36) + 29 / 31 * (ABS(H36 - C37) + ABS(L36 - C37) + 29 / 31 * (ABS(H37 - C38) + ABS(L37 - C38) + 29 / 31 * (ABS(H38 - C39) + ABS(L38 - C39) + 29 / 31 * (ABS(H39 - C40) + ABS(L39 - C40) + 29 / 31 * (ABS(H40 - C41) + ABS(L40 - C41) + 29 / 31 * (ABS(H41 - C42) + ABS(L41 - C42) + 29 / 31 * (ABS(H42 - C43) + ABS(L42 - C43) + 29 / 31 * (ABS(H43 - C44) + ABS(L43 - C44) + 29 / 31 * (ABS(H44 - C45) + ABS(L44 - C45) + 29 / 31 * (ABS(H45 - C46) + ABS(L45 - C46) + 29 / 31 * (ABS(H46 - C47) + ABS(L46 - C47) + 29 / 31 * (ABS(H47 - C48) + ABS(L47 - C48) + 29 / 31 * (ABS(H48 - C49) + ABS(L48 - C49) + 29 / 31 * (ABS(H49 - C50) + ABS(L49 - C50) + 29 / 31 * (ABS(H50 - C51) + ABS(L50 - C51) + 29 / 31 * (ABS(H51 - C52) + ABS(L51 - C52) + 29 / 31 * (ABS(H52 - C53) + ABS(L52 - C53) + 29 / 31 * (ABS(H53 - C54) + ABS(L53 - C54) + 29 / 31 * (ABS(H54 - C55) + ABS(L54 - C55) + 29 / 31 * (ABS(H55 - C56) + ABS(L55 - C56) + 29 / 31 * (ABS(H56 - C57) + ABS(L56 - C57) + 29 / 31 * (ABS(H57 - C58) + ABS(L57 - C58) + 29 / 31 * (ABS(H58 - C59) + ABS(L58 - C59) + 29 / 31 * (ABS(H59 - C60) + ABS(L59 - C60) + 29 / 31 * (ABS(H60 - C61) + ABS(L60 - C61) + 29 / 31 * (ABS(H61 - C62) + ABS(L61 - C62) + 29 / 31 * (ABS(H62 - C63) + ABS(L62 - C63) + 29 / 31 * (ABS(H63 - C64) + ABS(L63 - C64) + 29 / 31 * (ABS(H64 - C65) + ABS(L64 - C65) + 29 / 31 * (ABS(H65 - C66) + ABS(L65 - C66) + 29 / 31 * (ABS(H66 - C67) + ABS(L66 - C67) + 29 / 31 * (ABS(H67 - C68) + ABS(L67 - C68) + 29 / 31 * (ABS(H68 - C69) + ABS(L68 - C69) + 29 / 31 * (ABS(H69 - C70) + ABS(L69 - C70) + 29 / 31 * (ABS(H70 - C71) + ABS(L70 - C71) + 29 / 31 * (ABS(H71 - C72) + ABS(L71 - C72) + 29 / 31 * (ABS(H72 - C73) + ABS(L72 - C73) + 29 / 31 * (ABS(H73 - C74) + ABS(L73 - C74) + 29 / 31 * (ABS(H74 - C75) + ABS(L74 - C75) + 29 / 31 * (ABS(H75 - C76) + ABS(L75 - C76) + 29 / 31 * (ABS(H76 - C77) + ABS(L76 - C77) + 29 / 31 * (ABS(H77 - C78) + ABS(L77 - C78) + 29 / 31 * (ABS(H78 - C79) + ABS(L78 - C79) + 29 / 31 * (ABS(H79 - C80) + ABS(L79 - C80) + 29 / 31 * (ABS(H80 - C81) + ABS(L80 - C81) + 29 / 31 * (ABS(H81 - C82) + ABS(L81 - C82) + 29 / 31 * (ABS(H82 - C83) + ABS(L82 - C83) + 29 / 31 * (ABS(H83 - C84) + ABS(L83 - C84) + 29 / 31 * (ABS(H84 - C85) + ABS(L84 - C85) + 29 / 31 * (ABS(H85 - C86) + ABS(L85 - C86) + 29 / 31 * (ABS(H86 - C87) + ABS(L86 - C87) + 29 / 31 * (ABS(H87 - C88) + ABS(L87 - C88) + 29 / 31 * (ABS(H88 - C89) + ABS(L88 - C89) + 29 / 31 * (ABS(H89 - C90) + ABS(L89 - C90) + 29 / 31 * (ABS(H90 - C91) + ABS(L90 - C91) + 29 / 31 * (ABS(H91 - C92) + ABS(L91 - C92) + 29 / 31 * (ABS(H92 - C93) + ABS(L92 - C93) + 29 / 31 * (ABS(H93 - C94) + ABS(L93 - C94) + 29 / 31 * (ABS(H94 - C95) + ABS(L94 - C95) + 29 / 31 * (ABS(H95 - C96) + ABS(L95 - C96) + 29 / 31 * (ABS(H96 - C97) + ABS(L96 - C97) + 29 / 31 * (ABS(H97 - C98) + ABS(L97 - C98) + 29 / 31 * (ABS(H98 - C99) + ABS(L98 - C99) + 29 / 31 * (ABS(H99 - C100) + ABS(L99 - C100) + 29 / 31 * (ABS(H100 - C101) + ABS(L100 - C101) + 29 / 31 * (ABS(H101 - C102) + ABS(L101 - C102) + 29 / 31 * (ABS(H102 - C103) + ABS(L102 - C103) + 29 / 31 * (ABS(H103 - C104) + ABS(L103 - C104) + 29 / 31 * (ABS(H104 - C105) + ABS(L104 - C105))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
To create the conditions for the current bar, you would add two 1 period moving averages to price and set the Average of setting to Open for one and Low for the other. You could then click on the Keltner Channels and select Create Scan Condition to create the rest of the conditions so you could add them to an EasyScan.
Create Conditions from Your Chart (5:25)
Building a Scan with Multiple Conditions (7:29)
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 8/23/2013 Posts: 245
|
Bruce sorry i missed your reply here. IS THE FORMULA above the formula i had requested
"Bruce, Using Keltner Channell set to 30 Period 1.50 Atr Multi " and the formula is for C1 true or false inside the keltner channell? Correct
Thanks
|
|
Registered User Joined: 8/23/2013 Posts: 245
|
Looks like i can use another 1 period moving average off set 1 bar and would that not be C1, and add to scan INSIDE keltner channell?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The formula should return true when the previous bar closed inside the Keltner Channel.
You can't just add a 1 period moving average with an offset of 1 to price and then check for it to be inside the Keltner Channel as it would be comparing the close of the previous bar to the current Keltner Channel instead of the Keltner Channel from 1 bar ago.
You can't really use the offset technique to make a Keltner Channel from 1 bar ago either. Doing this with price and then adding the Keltner Channels to the moving average would not include the highs and lows in the Keltner calculations (because it would just be a moving average of the close). TC2000 will also not let you add moving average to the Keltner Channels (which could then be offset by 1).
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 8/23/2013 Posts: 245
|
IS THE FORMULA 30 PERIOD?
Thanks
|
|
Registered User Joined: 8/23/2013 Posts: 245
|
I SEE YOU changed it thanks
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Sorry, I had changed the formula in the post but got called away to do something else before I could actually test it and make a new post about the change to the original formula.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 8/23/2013 Posts: 245
|
Bruce is there a easy way to scan for a 1 period SMA on a 15m chart that for the day has never been below the Top Channell of Keltner 30 period 1.5 ATR Multipler
|
|
Registered User Joined: 8/23/2013 Posts: 245
|
I FIGURED OUT WHAT I WANTED
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
I am happy to read you were able to figure it out on your own.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 8/23/2013 Posts: 245
|
QUOTE (Bruce_L)
A Condition Formula for the entire thing is too long and slow to be practical or post in the forums. What you could do is create a Condition Formula for price being inside the Keltner Channels during the previous bar.
ABS(C1 - (XAVGH30.1 + XAVGL30.1 + XAVGC30.1) / 3) < 1.5 * ((XAVGH30.1 - XAVGL30.1) / 2 + .032289458 * (ABS(H1 - C2) + ABS(L1 - C2) + 29 / 31 * (ABS(H2 - C3) + ABS(L2 - C3) + 29 / 31 * (ABS(H3 - C4) + ABS(L3 - C4) + 29 / 31 * (ABS(H4 - C5) + ABS(L4 - C5) + 29 / 31 * (ABS(H5 - C6) + ABS(L5 - C6) + 29 / 31 * (ABS(H6 - C7) + ABS(L6 - C7) + 29 / 31 * (ABS(H7 - C8) + ABS(L7 - C8) + 29 / 31 * (ABS(H8 - C9) + ABS(L8 - C9) + 29 / 31 * (ABS(H9 - C10) + ABS(L9 - C10) + 29 / 31 * (ABS(H10 - C11) + ABS(L10 - C11) + 29 / 31 * (ABS(H11 - C12) + ABS(L11 - C12) + 29 / 31 * (ABS(H12 - C13) + ABS(L12 - C13) + 29 / 31 * (ABS(H13 - C14) + ABS(L13 - C14) + 29 / 31 * (ABS(H14 - C15) + ABS(L14 - C15) + 29 / 31 * (ABS(H15 - C16) + ABS(L15 - C16) + 29 / 31 * (ABS(H16 - C17) + ABS(L16 - C17) + 29 / 31 * (ABS(H17 - C18) + ABS(L17 - C18) + 29 / 31 * (ABS(H18 - C19) + ABS(L18 - C19) + 29 / 31 * (ABS(H19 - C20) + ABS(L19 - C20) + 29 / 31 * (ABS(H20 - C21) + ABS(L20 - C21) + 29 / 31 * (ABS(H21 - C22) + ABS(L21 - C22) + 29 / 31 * (ABS(H22 - C23) + ABS(L22 - C23) + 29 / 31 * (ABS(H23 - C24) + ABS(L23 - C24) + 29 / 31 * (ABS(H24 - C25) + ABS(L24 - C25) + 29 / 31 * (ABS(H25 - C26) + ABS(L25 - C26) + 29 / 31 * (ABS(H26 - C27) + ABS(L26 - C27) + 29 / 31 * (ABS(H27 - C28) + ABS(L27 - C28) + 29 / 31 * (ABS(H28 - C29) + ABS(L28 - C29) + 29 / 31 * (ABS(H29 - C30) + ABS(L29 - C30) + 29 / 31 * (ABS(H30 - C31) + ABS(L30 - C31) + 29 / 31 * (ABS(H31 - C32) + ABS(L31 - C32) + 29 / 31 * (ABS(H32 - C33) + ABS(L32 - C33) + 29 / 31 * (ABS(H33 - C34) + ABS(L33 - C34) + 29 / 31 * (ABS(H34 - C35) + ABS(L34 - C35) + 29 / 31 * (ABS(H35 - C36) + ABS(L35 - C36) + 29 / 31 * (ABS(H36 - C37) + ABS(L36 - C37) + 29 / 31 * (ABS(H37 - C38) + ABS(L37 - C38) + 29 / 31 * (ABS(H38 - C39) + ABS(L38 - C39) + 29 / 31 * (ABS(H39 - C40) + ABS(L39 - C40) + 29 / 31 * (ABS(H40 - C41) + ABS(L40 - C41) + 29 / 31 * (ABS(H41 - C42) + ABS(L41 - C42) + 29 / 31 * (ABS(H42 - C43) + ABS(L42 - C43) + 29 / 31 * (ABS(H43 - C44) + ABS(L43 - C44) + 29 / 31 * (ABS(H44 - C45) + ABS(L44 - C45) + 29 / 31 * (ABS(H45 - C46) + ABS(L45 - C46) + 29 / 31 * (ABS(H46 - C47) + ABS(L46 - C47) + 29 / 31 * (ABS(H47 - C48) + ABS(L47 - C48) + 29 / 31 * (ABS(H48 - C49) + ABS(L48 - C49) + 29 / 31 * (ABS(H49 - C50) + ABS(L49 - C50) + 29 / 31 * (ABS(H50 - C51) + ABS(L50 - C51) + 29 / 31 * (ABS(H51 - C52) + ABS(L51 - C52) + 29 / 31 * (ABS(H52 - C53) + ABS(L52 - C53) + 29 / 31 * (ABS(H53 - C54) + ABS(L53 - C54) + 29 / 31 * (ABS(H54 - C55) + ABS(L54 - C55) + 29 / 31 * (ABS(H55 - C56) + ABS(L55 - C56) + 29 / 31 * (ABS(H56 - C57) + ABS(L56 - C57) + 29 / 31 * (ABS(H57 - C58) + ABS(L57 - C58) + 29 / 31 * (ABS(H58 - C59) + ABS(L58 - C59) + 29 / 31 * (ABS(H59 - C60) + ABS(L59 - C60) + 29 / 31 * (ABS(H60 - C61) + ABS(L60 - C61) + 29 / 31 * (ABS(H61 - C62) + ABS(L61 - C62) + 29 / 31 * (ABS(H62 - C63) + ABS(L62 - C63) + 29 / 31 * (ABS(H63 - C64) + ABS(L63 - C64) + 29 / 31 * (ABS(H64 - C65) + ABS(L64 - C65) + 29 / 31 * (ABS(H65 - C66) + ABS(L65 - C66) + 29 / 31 * (ABS(H66 - C67) + ABS(L66 - C67) + 29 / 31 * (ABS(H67 - C68) + ABS(L67 - C68) + 29 / 31 * (ABS(H68 - C69) + ABS(L68 - C69) + 29 / 31 * (ABS(H69 - C70) + ABS(L69 - C70) + 29 / 31 * (ABS(H70 - C71) + ABS(L70 - C71) + 29 / 31 * (ABS(H71 - C72) + ABS(L71 - C72) + 29 / 31 * (ABS(H72 - C73) + ABS(L72 - C73) + 29 / 31 * (ABS(H73 - C74) + ABS(L73 - C74) + 29 / 31 * (ABS(H74 - C75) + ABS(L74 - C75) + 29 / 31 * (ABS(H75 - C76) + ABS(L75 - C76) + 29 / 31 * (ABS(H76 - C77) + ABS(L76 - C77) + 29 / 31 * (ABS(H77 - C78) + ABS(L77 - C78) + 29 / 31 * (ABS(H78 - C79) + ABS(L78 - C79) + 29 / 31 * (ABS(H79 - C80) + ABS(L79 - C80) + 29 / 31 * (ABS(H80 - C81) + ABS(L80 - C81) + 29 / 31 * (ABS(H81 - C82) + ABS(L81 - C82) + 29 / 31 * (ABS(H82 - C83) + ABS(L82 - C83) + 29 / 31 * (ABS(H83 - C84) + ABS(L83 - C84) + 29 / 31 * (ABS(H84 - C85) + ABS(L84 - C85) + 29 / 31 * (ABS(H85 - C86) + ABS(L85 - C86) + 29 / 31 * (ABS(H86 - C87) + ABS(L86 - C87) + 29 / 31 * (ABS(H87 - C88) + ABS(L87 - C88) + 29 / 31 * (ABS(H88 - C89) + ABS(L88 - C89) + 29 / 31 * (ABS(H89 - C90) + ABS(L89 - C90) + 29 / 31 * (ABS(H90 - C91) + ABS(L90 - C91) + 29 / 31 * (ABS(H91 - C92) + ABS(L91 - C92) + 29 / 31 * (ABS(H92 - C93) + ABS(L92 - C93) + 29 / 31 * (ABS(H93 - C94) + ABS(L93 - C94) + 29 / 31 * (ABS(H94 - C95) + ABS(L94 - C95) + 29 / 31 * (ABS(H95 - C96) + ABS(L95 - C96) + 29 / 31 * (ABS(H96 - C97) + ABS(L96 - C97) + 29 / 31 * (ABS(H97 - C98) + ABS(L97 - C98) + 29 / 31 * (ABS(H98 - C99) + ABS(L98 - C99) + 29 / 31 * (ABS(H99 - C100) + ABS(L99 - C100) + 29 / 31 * (ABS(H100 - C101) + ABS(L100 - C101) + 29 / 31 * (ABS(H101 - C102) + ABS(L101 - C102) + 29 / 31 * (ABS(H102 - C103) + ABS(L102 - C103) + 29 / 31 * (ABS(H103 - C104) + ABS(L103 - C104) + 29 / 31 * (ABS(H104 - C105) + ABS(L104 - C105))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
To create the conditions for the current bar, you would add two 1 period moving averages to price and set the Average of setting to Open for one and Low for the other. You could then click on the Keltner Channels and select Create Scan Condition to create the rest of the conditions so you could add them to an EasyScan.
Create Conditions from Your Chart (5:25)
Building a Scan with Multiple Conditions (7:29)
Bruce your idea for this is working out well using this formula for INSIDE THE KELNER CHANNELL
Can you produce on for the same Period of 30 with a 3.0 ATR Multipler with the same setup for INSIDE as above
Thanks again for all you do
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
If I'm understand the question correctly (which is not guaranteeed), you should just be able to change the < 1.5 * to a > 3 * instead.
ABS(C1 - (XAVGH30.1 + XAVGL30.1 + XAVGC30.1) / 3) > 3 * ((XAVGH30.1 - XAVGL30.1) / 2 + .032289458 * (ABS(H1 - C2) + ABS(L1 - C2) + 29 / 31 * (ABS(H2 - C3) + ABS(L2 - C3) + 29 / 31 * (ABS(H3 - C4) + ABS(L3 - C4) + 29 / 31 * (ABS(H4 - C5) + ABS(L4 - C5) + 29 / 31 * (ABS(H5 - C6) + ABS(L5 - C6) + 29 / 31 * (ABS(H6 - C7) + ABS(L6 - C7) + 29 / 31 * (ABS(H7 - C8) + ABS(L7 - C8) + 29 / 31 * (ABS(H8 - C9) + ABS(L8 - C9) + 29 / 31 * (ABS(H9 - C10) + ABS(L9 - C10) + 29 / 31 * (ABS(H10 - C11) + ABS(L10 - C11) + 29 / 31 * (ABS(H11 - C12) + ABS(L11 - C12) + 29 / 31 * (ABS(H12 - C13) + ABS(L12 - C13) + 29 / 31 * (ABS(H13 - C14) + ABS(L13 - C14) + 29 / 31 * (ABS(H14 - C15) + ABS(L14 - C15) + 29 / 31 * (ABS(H15 - C16) + ABS(L15 - C16) + 29 / 31 * (ABS(H16 - C17) + ABS(L16 - C17) + 29 / 31 * (ABS(H17 - C18) + ABS(L17 - C18) + 29 / 31 * (ABS(H18 - C19) + ABS(L18 - C19) + 29 / 31 * (ABS(H19 - C20) + ABS(L19 - C20) + 29 / 31 * (ABS(H20 - C21) + ABS(L20 - C21) + 29 / 31 * (ABS(H21 - C22) + ABS(L21 - C22) + 29 / 31 * (ABS(H22 - C23) + ABS(L22 - C23) + 29 / 31 * (ABS(H23 - C24) + ABS(L23 - C24) + 29 / 31 * (ABS(H24 - C25) + ABS(L24 - C25) + 29 / 31 * (ABS(H25 - C26) + ABS(L25 - C26) + 29 / 31 * (ABS(H26 - C27) + ABS(L26 - C27) + 29 / 31 * (ABS(H27 - C28) + ABS(L27 - C28) + 29 / 31 * (ABS(H28 - C29) + ABS(L28 - C29) + 29 / 31 * (ABS(H29 - C30) + ABS(L29 - C30) + 29 / 31 * (ABS(H30 - C31) + ABS(L30 - C31) + 29 / 31 * (ABS(H31 - C32) + ABS(L31 - C32) + 29 / 31 * (ABS(H32 - C33) + ABS(L32 - C33) + 29 / 31 * (ABS(H33 - C34) + ABS(L33 - C34) + 29 / 31 * (ABS(H34 - C35) + ABS(L34 - C35) + 29 / 31 * (ABS(H35 - C36) + ABS(L35 - C36) + 29 / 31 * (ABS(H36 - C37) + ABS(L36 - C37) + 29 / 31 * (ABS(H37 - C38) + ABS(L37 - C38) + 29 / 31 * (ABS(H38 - C39) + ABS(L38 - C39) + 29 / 31 * (ABS(H39 - C40) + ABS(L39 - C40) + 29 / 31 * (ABS(H40 - C41) + ABS(L40 - C41) + 29 / 31 * (ABS(H41 - C42) + ABS(L41 - C42) + 29 / 31 * (ABS(H42 - C43) + ABS(L42 - C43) + 29 / 31 * (ABS(H43 - C44) + ABS(L43 - C44) + 29 / 31 * (ABS(H44 - C45) + ABS(L44 - C45) + 29 / 31 * (ABS(H45 - C46) + ABS(L45 - C46) + 29 / 31 * (ABS(H46 - C47) + ABS(L46 - C47) + 29 / 31 * (ABS(H47 - C48) + ABS(L47 - C48) + 29 / 31 * (ABS(H48 - C49) + ABS(L48 - C49) + 29 / 31 * (ABS(H49 - C50) + ABS(L49 - C50) + 29 / 31 * (ABS(H50 - C51) + ABS(L50 - C51) + 29 / 31 * (ABS(H51 - C52) + ABS(L51 - C52) + 29 / 31 * (ABS(H52 - C53) + ABS(L52 - C53) + 29 / 31 * (ABS(H53 - C54) + ABS(L53 - C54) + 29 / 31 * (ABS(H54 - C55) + ABS(L54 - C55) + 29 / 31 * (ABS(H55 - C56) + ABS(L55 - C56) + 29 / 31 * (ABS(H56 - C57) + ABS(L56 - C57) + 29 / 31 * (ABS(H57 - C58) + ABS(L57 - C58) + 29 / 31 * (ABS(H58 - C59) + ABS(L58 - C59) + 29 / 31 * (ABS(H59 - C60) + ABS(L59 - C60) + 29 / 31 * (ABS(H60 - C61) + ABS(L60 - C61) + 29 / 31 * (ABS(H61 - C62) + ABS(L61 - C62) + 29 / 31 * (ABS(H62 - C63) + ABS(L62 - C63) + 29 / 31 * (ABS(H63 - C64) + ABS(L63 - C64) + 29 / 31 * (ABS(H64 - C65) + ABS(L64 - C65) + 29 / 31 * (ABS(H65 - C66) + ABS(L65 - C66) + 29 / 31 * (ABS(H66 - C67) + ABS(L66 - C67) + 29 / 31 * (ABS(H67 - C68) + ABS(L67 - C68) + 29 / 31 * (ABS(H68 - C69) + ABS(L68 - C69) + 29 / 31 * (ABS(H69 - C70) + ABS(L69 - C70) + 29 / 31 * (ABS(H70 - C71) + ABS(L70 - C71) + 29 / 31 * (ABS(H71 - C72) + ABS(L71 - C72) + 29 / 31 * (ABS(H72 - C73) + ABS(L72 - C73) + 29 / 31 * (ABS(H73 - C74) + ABS(L73 - C74) + 29 / 31 * (ABS(H74 - C75) + ABS(L74 - C75) + 29 / 31 * (ABS(H75 - C76) + ABS(L75 - C76) + 29 / 31 * (ABS(H76 - C77) + ABS(L76 - C77) + 29 / 31 * (ABS(H77 - C78) + ABS(L77 - C78) + 29 / 31 * (ABS(H78 - C79) + ABS(L78 - C79) + 29 / 31 * (ABS(H79 - C80) + ABS(L79 - C80) + 29 / 31 * (ABS(H80 - C81) + ABS(L80 - C81) + 29 / 31 * (ABS(H81 - C82) + ABS(L81 - C82) + 29 / 31 * (ABS(H82 - C83) + ABS(L82 - C83) + 29 / 31 * (ABS(H83 - C84) + ABS(L83 - C84) + 29 / 31 * (ABS(H84 - C85) + ABS(L84 - C85) + 29 / 31 * (ABS(H85 - C86) + ABS(L85 - C86) + 29 / 31 * (ABS(H86 - C87) + ABS(L86 - C87) + 29 / 31 * (ABS(H87 - C88) + ABS(L87 - C88) + 29 / 31 * (ABS(H88 - C89) + ABS(L88 - C89) + 29 / 31 * (ABS(H89 - C90) + ABS(L89 - C90) + 29 / 31 * (ABS(H90 - C91) + ABS(L90 - C91) + 29 / 31 * (ABS(H91 - C92) + ABS(L91 - C92) + 29 / 31 * (ABS(H92 - C93) + ABS(L92 - C93) + 29 / 31 * (ABS(H93 - C94) + ABS(L93 - C94) + 29 / 31 * (ABS(H94 - C95) + ABS(L94 - C95) + 29 / 31 * (ABS(H95 - C96) + ABS(L95 - C96) + 29 / 31 * (ABS(H96 - C97) + ABS(L96 - C97) + 29 / 31 * (ABS(H97 - C98) + ABS(L97 - C98) + 29 / 31 * (ABS(H98 - C99) + ABS(L98 - C99) + 29 / 31 * (ABS(H99 - C100) + ABS(L99 - C100) + 29 / 31 * (ABS(H100 - C101) + ABS(L100 - C101) + 29 / 31 * (ABS(H101 - C102) + ABS(L101 - C102) + 29 / 31 * (ABS(H102 - C103) + ABS(L102 - C103) + 29 / 31 * (ABS(H103 - C104) + ABS(L103 - C104) + 29 / 31 * (ABS(H104 - C105) + ABS(L104 - C105))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 8/23/2013 Posts: 245
|
thanks it thanks
|
|
Registered User Joined: 8/23/2013 Posts: 245
|
Another Thing i dont quite get
- THIS SHOULD BE THE TOP KELTNER CHANNEL FOR 30 PERIOD 1.5 ATR
(((XAVGH30 + XAVGL30 + XAVGC30) / 3) + (1.5 * (XAVGH30 - XAVGL30)))
But i am always about .8 to .12 off of being equal with the plot on the chart
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Keltner Channels are calculated using Average True Range which include the previous close in the price range instead of just plain range which only includes the open through the close in the price range.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 8/23/2013 Posts: 245
|
(((XAVGH30 + XAVGL30 + XAVGC30) / 3) + (1.5 * (XAVGH30 - XAVGL30))) so should this become the below(((XAVGH30 + XAVGL30 + XAVGC30) / 3) + (1.5 * (XAVGH30.1 - XAVGL30.1)))
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
No, it doesn't just use yesterday's average range.
It includes the previous close in the range.
So the instead of the range for the day being the high minus the low, it is the higher of the high or previous close minus the lower of the low or previous close.
So most days for most stocks the range is just going to be H - L because the close of the previous range is going to fall within the range of the current day.
On some days however there is going to be gap that doesn't get filled. The low will be higher than the previous close or the high will be lower than the previous close.
So if the previous close is above the current high, then the true range of the bar is C1 - L instead of H - L and if the previous close is below the current low then the true range of the bar is H - C1 instead of H - L.
The true range of a single bar can be written as follows.
ABS(C1 > H) * (C1 - H) + H - L + ABS(L > C1) * (L - C1)
Or as follows.
(H - L + ABS(H - C1) + ABS(C1 - L)) / 2
In either case, the inclusion of the previous close means the approximation of just taking the average high minus the average low will only return the correct value if there aren't any unfilled gaps in the bars being used to calculate the average.
Please provide a description and PCF for calculating an ATR value to be used as a stop loss value
This is the entire reason that the formulas given above are so long.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 4/30/2015 Posts: 197
|
Bruce I see Single Bar True Range as
(H -L + ABS(H - C1) + ABS(C1 - L)) / 2
What is the formula for 20 Period ATR and the formula for 20 Period ATR Offset 1 Bar
Thanks
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The 20 period average true range of 1 bar ago can be written as follows.
(AVGH20.1 - AVGL20.1) / 2 + (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) + ABS(H7 - C8) + ABS(C8 - L7) + ABS(H8 - C9) + ABS(C9 - L8) + ABS(H9 - C10) + ABS(C10 - L9) + ABS(H10 - C11) + ABS(C11 - L10) + ABS(H11 - C12) + ABS(C12 - L11) + ABS(H12 - C13) + ABS(C13 - L12) + ABS(H13 - C14) + ABS(C14 - L13) + ABS(H14 - C15) + ABS(C15 - L14) + ABS(H15 - C16) + ABS(C16 - L15) + ABS(H16 - C17) + ABS(C17 - L16) + ABS(H17 - C18) + ABS(C18 - L17) + ABS(H18 - C19) + ABS(C19 - L18) + ABS(H19 - C20) + ABS(C20 - L19) + ABS(H20 - C21) + ABS(C21 - L20)) / 40
20-Day Average True Range
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |