Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 3/5/2008 Posts: 3
|
I need a fomula that will help me filter stocks ATR for a 30 day period. Something like this; ATR 30 >= 5.
Thanks!
Johnny
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Welcome to the forums. A very good foundation for learning how to use TeleChart can be gained by reviewing the following:
If you are new to TeleChart READ THIS FIRST!
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 or ATR is the Moving Average of this value. It could be calculated using a Simple Moving Average:
30-Period Simple Moving Average of True Range:
(AVGH30 - AVGL30) / 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) + 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) + ABS(H21 - C22) + ABS(C22 - L21) + ABS(H22 - C23) + ABS(C23 - L22) + ABS(H23 - C24) + ABS(C24 - L23) + ABS(H24 - C25) + ABS(C25 - L24) + ABS(H25 - C26) + ABS(C26 - L25) + ABS(H26 - C27) + ABS(C27 - L26) + ABS(H27 - C28) + ABS(C28 - L27) + ABS(H28 - C29) + ABS(C29 - L28) + ABS(H29 - C30) + ABS(C30 - L29)) / 60
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:
30-Period Average True Range (Wilder's Smoothed):
XAVGH59 - XAVGL59 + .0333664285578861 * ((H < C1) * (H - C1) + (C1 < L) * (C1 - L) + 29 / 30 * ((H1 < C2) * (H1 - C2) + (C2 < L1) * (C2 - L1) + 29 / 30 * ((H2 < C3) * (H2 - C3) + (C3 < L2) * (C3 - L2) + 29 / 30 * ((H3 < C4) * (H3 - C4) + (C4 < L3) * (C4 - L3) + 29 / 30 * ((H4 < C5) * (H4 - C5) + (C5 < L4) * (C5 - L4) + 29 / 30 * ((H5 < C6) * (H5 - C6) + (C6 < L5) * (C6 - L5) + 29 / 30 * ((H6 < C7) * (H6 - C7) + (C7 < L6) * (C7 - L6) + 29 / 30 * ((H7 < C8) * (H7 - C8) + (C8 < L7) * (C8 - L7) + 29 / 30 * ((H8 < C9) * (H8 - C9) + (C9 < L8) * (C9 - L8) + 29 / 30 * ((H9 < C10) * (H9 - C10) + (C10 < L9) * (C10 - L9) + 29 / 30 * ((H10 < C11) * (H10 - C11) + (C11 < L10) * (C11 - L10) + 29 / 30 * ((H11 < C12) * (H11 - C12) + (C12 < L11) * (C12 - L11) + 29 / 30 * ((H12 < C13) * (H12 - C13) + (C13 < L12) * (C13 - L12) + 29 / 30 * ((H13 < C14) * (H13 - C14) + (C14 < L13) * (C14 - L13) + 29 / 30 * ((H14 < C15) * (H14 - C15) + (C15 < L14) * (C15 - L14) + 29 / 30 * ((H15 < C16) * (H15 - C16) + (C16 < L15) * (C16 - L15) + 29 / 30 * ((H16 < C17) * (H16 - C17) + (C17 < L16) * (C17 - L16) + 29 / 30 * ((H17 < C18) * (H17 - C18) + (C18 < L17) * (C18 - L17) + 29 / 30 * ((H18 < C19) * (H18 - C19) + (C19 < L18) * (C19 - L18) + 29 / 30 * ((H19 < C20) * (H19 - C20) + (C20 < L19) * (C20 - L19) + 29 / 30 * ((H20 < C21) * (H20 - C21) + (C21 < L20) * (C21 - L20) + 29 / 30 * ((H21 < C22) * (H21 - C22) + (C22 < L21) * (C22 - L21) + 29 / 30 * ((H22 < C23) * (H22 - C23) + (C23 < L22) * (C23 - L22) + 29 / 30 * ((H23 < C24) * (H23 - C24) + (C24 < L23) * (C24 - L23) + 29 / 30 * ((H24 < C25) * (H24 - C25) + (C25 < L24) * (C25 - L24) + 29 / 30 * ((H25 < C26) * (H25 - C26) + (C26 < L25) * (C26 - L25) + 29 / 30 * ((H26 < C27) * (H26 - C27) + (C27 < L26) * (C27 - L26) + 29 / 30 * ((H27 < C28) * (H27 - C28) + (C28 < L27) * (C28 - L27) + 29 / 30 * ((H28 < C29) * (H28 - C29) + (C29 < L28) * (C29 - L28) + 29 / 30 * ((H29 < C30) * (H29 - C30) + (C30 < L29) * (C30 - L29) + 29 / 30 * ((H30 < C31) * (H30 - C31) + (C31 < L30) * (C31 - L30) + 29 / 30 * ((H31 < C32) * (H31 - C32) + (C32 < L31) * (C32 - L31) + 29 / 30 * ((H32 < C33) * (H32 - C33) + (C33 < L32) * (C33 - L32) + 29 / 30 * ((H33 < C34) * (H33 - C34) + (C34 < L33) * (C34 - L33) + 29 / 30 * ((H34 < C35) * (H34 - C35) + (C35 < L34) * (C35 - L34) + 29 / 30 * ((H35 < C36) * (H35 - C36) + (C36 < L35) * (C36 - L35) + 29 / 30 * ((H36 < C37) * (H36 - C37) + (C37 < L36) * (C37 - L36) + 29 / 30 * ((H37 < C38) * (H37 - C38) + (C38 < L37) * (C38 - L37) + 29 / 30 * ((H38 < C39) * (H38 - C39) + (C39 < L38) * (C39 - L38) + 29 / 30 * ((H39 < C40) * (H39 - C40) + (C40 < L39) * (C40 - L39) + 29 / 30 * ((H40 < C41) * (H40 - C41) + (C41 < L40) * (C41 - L40) + 29 / 30 * ((H41 < C42) * (H41 - C42) + (C42 < L41) * (C42 - L41) + 29 / 30 * ((H42 < C43) * (H42 - C43) + (C43 < L42) * (C43 - L42) + 29 / 30 * ((H43 < C44) * (H43 - C44) + (C44 < L43) * (C44 - L43) + 29 / 30 * ((H44 < C45) * (H44 - C45) + (C45 < L44) * (C45 - L44) + 29 / 30 * ((H45 < C46) * (H45 - C46) + (C46 < L45) * (C46 - L45) + 29 / 30 * ((H46 < C47) * (H46 - C47) + (C47 < L46) * (C47 - L46) + 29 / 30 * ((H47 < C48) * (H47 - C48) + (C48 < L47) * (C48 - L47) + 29 / 30 * ((H48 < C49) * (H48 - C49) + (C49 < L48) * (C49 - L48) + 29 / 30 * ((H49 < C50) * (H49 - C50) + (C50 < L49) * (C50 - L49) + 29 / 30 * ((H50 < C51) * (H50 - C51) + (C51 < L50) * (C51 - L50) + 29 / 30 * ((H51 < C52) * (H51 - C52) + (C52 < L51) * (C52 - L51) + 29 / 30 * ((H52 < C53) * (H52 - C53) + (C53 < L52) * (C53 - L52) + 29 / 30 * ((H53 < C54) * (H53 - C54) + (C54 < L53) * (C54 - L53) + 29 / 30 * ((H54 < C55) * (H54 - C55) + (C55 < L54) * (C55 - L54) + 29 / 30 * ((H55 < C56) * (H55 - C56) + (C56 < L55) * (C56 - L55) + 29 / 30 * ((H56 < C57) * (H56 - C57) + (C57 < L56) * (C57 - L56) + 29 / 30 * ((H57 < C58) * (H57 - C58) + (C58 < L57) * (C58 - L57) + 29 / 30 * ((H58 < C59) * (H58 - C59) + (C59 < L58) * (C59 - L58) + 29 / 30 * ((H59 < C60) * (H59 - C60) + (C60 < L59) * (C60 - L59) + 29 / 30 * ((H60 < C61) * (H60 - C61) + (C61 < L60) * (C61 - L60) + 29 / 30 * ((H61 < C62) * (H61 - C62) + (C62 < L61) * (C62 - L61) + 29 / 30 * ((H62 < C63) * (H62 - C63) + (C63 < L62) * (C63 - L62) + 29 / 30 * ((H63 < C64) * (H63 - C64) + (C64 < L63) * (C64 - L63) + 29 / 30 * ((H64 < C65) * (H64 - C65) + (C65 < L64) * (C65 - L64) + 29 / 30 * ((H65 < C66) * (H65 - C66) + (C66 < L65) * (C66 - L65) + 29 / 30 * ((H66 < C67) * (H66 - C67) + (C67 < L66) * (C67 - L66) + 29 / 30 * ((H67 < C68) * (H67 - C68) + (C68 < L67) * (C68 - L67) + 29 / 30 * ((H68 < C69) * (H68 - C69) + (C69 < L68) * (C69 - L68) + 29 / 30 * ((H69 < C70) * (H69 - C70) + (C70 < L69) * (C70 - L69) + 29 / 30 * ((H70 < C71) * (H70 - C71) + (C71 < L70) * (C71 - L70) + 29 / 30 * ((H71 < C72) * (H71 - C72) + (C72 < L71) * (C72 - L71) + 29 / 30 * ((H72 < C73) * (H72 - C73) + (C73 < L72) * (C73 - L72) + 29 / 30 * ((H73 < C74) * (H73 - C74) + (C74 < L73) * (C74 - L73) + 29 / 30 * ((H74 < C75) * (H74 - C75) + (C75 < L74) * (C75 - L74) + 29 / 30 * ((H75 < C76) * (H75 - C76) + (C76 < L75) * (C76 - L75) + 29 / 30 * ((H76 < C77) * (H76 - C77) + (C77 < L76) * (C77 - L76) + 29 / 30 * ((H77 < C78) * (H77 - C78) + (C78 < L77) * (C78 - L77) + 29 / 30 * ((H78 < C79) * (H78 - C79) + (C79 < L78) * (C79 - L78) + 29 / 30 * ((H79 < C80) * (H79 - C80) + (C80 < L79) * (C80 - L79) + 29 / 30 * ((H80 < C81) * (H80 - C81) + (C81 < L80) * (C81 - L80) + 29 / 30 * ((H81 < C82) * (H81 - C82) + (C82 < L81) * (C82 - L81) + 29 / 30 * ((H82 < C83) * (H82 - C83) + (C83 < L82) * (C83 - L82) + 29 / 30 * ((H83 < C84) * (H83 - C84) + (C84 < L83) * (C84 - L83) + 29 / 30 * ((H84 < C85) * (H84 - C85) + (C85 < L84) * (C85 - L84) + 29 / 30 * ((H85 < C86) * (H85 - C86) + (C86 < L85) * (C86 - L85) + 29 / 30 * ((H86 < C87) * (H86 - C87) + (C87 < L86) * (C87 - L86) + 29 / 30 * ((H87 < C88) * (H87 - C88) + (C88 < L87) * (C88 - L87) + 29 / 30 * ((H88 < C89) * (H88 - C89) + (C89 < L88) * (C89 - L88) + 29 / 30 * ((H89 < C90) * (H89 - C90) + (C90 < L89) * (C90 - L89) + 29 / 30 * ((H90 < C91) * (H90 - C91) + (C91 < L90) * (C91 - L90) + 29 / 30 * ((H91 < C92) * (H91 - C92) + (C92 < L91) * (C92 - L91) + 29 / 30 * ((H92 < C93) * (H92 - C93) + (C93 < L92) * (C93 - L92) + 29 / 30 * ((H93 < C94) * (H93 - C94) + (C94 < L93) * (C94 - L93) + 29 / 30 * ((H94 < C95) * (H94 - C95) + (C95 < L94) * (C95 - L94) + 29 / 30 * ((H95 < C96) * (H95 - C96) + (C96 < L95) * (C96 - L95) + 29 / 30 * ((H96 < C97) * (H96 - C97) + (C97 < L96) * (C97 - L96) + 29 / 30 * ((H97 < C98) * (H97 - C98) + (C98 < L97) * (C98 - L97) + 29 / 30 * ((H98 < C99) * (H98 - C99) + (C99 < L98) * (C99 - L98) + 29 / 30 * ((H99 < C100) * (H99 - C100) + (C100 < L99) * (C100 - L99) + 29 / 30 * ((H100 < C101) * (H100 - C101) + (C101 < L100) * (C101 - L100) + 29 / 30 * ((H101 < C102) * (H101 - C102) + (C102 < L101) * (C102 - L101) + 29 / 30 * ((H102 < C103) * (H102 - C103) + (C103 < L102) * (C103 - L102) + 29 / 30 * ((H103 < C104) * (H103 - C104) + (C104 < L103) * (C104 - L103) + 29 / 30 * ((H104 < C105) * (H104 - C105) + (C105 < L104) * (C105 - L104) + 29 / 30 * ((H105 < C106) * (H105 - C106) + (C106 < L105) * (C106 - L105) + 29 / 30 * ((H106 < C107) * (H106 - C107) + (C107 < L106) * (C107 - L106) + 29 / 30 * ((H107 < C108) * (H107 - C108) + (C108 < L107) * (C108 - L107) + 29 / 30 * ((H108 < C109) * (H108 - C109) + (C109 < L108) * (C109 - L108) + 29 / 30 * ((H109 < C110) * (H109 - C110) + (C110 < L109) * (C110 - L109) + 29 / 30 * ((H110 < C111) * (H110 - C111) + (C111 < L110) * (C111 - L110) + 29 / 30 * ((H111 < C112) * (H111 - C112) + (C112 < L111) * (C112 - L111) + 29 / 30 * ((H112 < C113) * (H112 - C113) + (C113 < L112) * (C113 - L112) + 29 / 30 * ((H113 < C114) * (H113 - C114) + (C114 < L113) * (C114 - L113) + 29 / 30 * ((H114 < C115) * (H114 - C115) + (C115 < L114) * (C115 - L114) + 29 / 30 * ((H115 < C116) * (H115 - C116) + (C116 < L115) * (C116 - L115) + 29 / 30 * ((H116 < C117) * (H116 - C117) + (C117 < L116) * (C117 - L116) + 29 / 30 * ((H117 < C118) * (H117 - C118) + (C118 < L117) * (C118 - L117) + 29 / 30 * ((H118 < C119) * (H118 - C119) + (C119 < L118) * (C119 - L118) + 29 / 30 * ((H119 < C120) * (H119 - C120) + (C120 < L119) * (C120 - L119) + 29 / 30 * ((H120 < C121) * (H120 - C121) + (C121 < L120) * (C121 - L120) + 29 / 30 * ((H121 < C122) * (H121 - C122) + (C122 < L121) * (C122 - L121) + 29 / 30 * ((H122 < C123) * (H122 - C123) + (C123 < L122) * (C123 - L122) + 29 / 30 * ((H123 < C124) * (H123 - C124) + (C124 < L123) * (C124 - L123) + 29 / 30 * ((H124 < C125) * (H124 - C125) + (C125 < L124) * (C125 - L124) + 29 / 30 * ((H125 < C126) * (H125 - C126) + (C126 < L125) * (C126 - L125) + 29 / 30 * ((H126 < C127) * (H126 - C127) + (C127 < L126) * (C127 - L126) + 29 / 30 * ((H127 < C128) * (H127 - C128) + (C128 < L127) * (C128 - L127) + 29 / 30 * ((H128 < C129) * (H128 - C129) + (C129 < L128) * (C129 - L128) + 29 / 30 * ((H129 < C130) * (H129 - C130) + (C130 < L129) * (C130 - L129) + 29 / 30 * ((H130 < C131) * (H130 - C131) + (C131 < L130) * (C131 - L130) + 29 / 30 * ((H131 < C132) * (H131 - C132) + (C132 < L131) * (C132 - L131) + 29 / 30 * ((H132 < C133) * (H132 - C133) + (C133 < L132) * (C133 - L132) + 29 / 30 * ((H133 < C134) * (H133 - C134) + (C134 < L133) * (C134 - L133) + 29 / 30 * ((H134 < C135) * (H134 - C135) + (C135 < L134) * (C135 - L134) + 29 / 30 * ((H135 < C136) * (H135 - C136) + (C136 < L135) * (C136 - L135) + 29 / 30 * ((H136 < C137) * (H136 - C137) + (C137 < L136) * (C137 - L136) + 29 / 30 * ((H137 < C138) * (H137 - C138) + (C138 < L137) * (C138 - L137) + 29 / 30 * ((H138 < C139) * (H138 - C139) + (C139 < L138) * (C139 - L138) + 29 / 30 * ((H139 < C140) * (H139 - C140) + (C140 < L139) * (C140 - L139) + 29 / 30 * ((H140 < C141) * (H140 - C141) + (C141 < L140) * (C141 - L140) + 29 / 30 * ((H141 < C142) * (H141 - C142) + (C142 < L141) * (C142 - L141) + 29 / 30 * ((H142 < C143) * (H142 - C143) + (C143 < L142) * (C143 - L142) + 29 / 30 * ((H143 < C144) * (H143 - C144) + (C144 < L143) * (C144 - L143) + 29 / 30 * ((H144 < C145) * (H144 - C145) + (C145 < L144) * (C145 - L144) + 29 / 30 * ((H145 < C146) * (H145 - C146) + (C146 < L145) * (C146 - L145) + 29 / 30 * ((H146 < C147) * (H146 - C147) + (C147 < L146) * (C147 - L146) + 29 / 30 * ((H147 < C148) * (H147 - C148) + (C148 < L147) * (C148 - L147) + 29 / 30 * ((H148 < C149) * (H148 - C149) + (C149 < L148) * (C149 - L148) + 29 / 30 * ((H149 < C150) * (H149 - C150) + (C150 < L149) * (C150 - L149) + 29 / 30 * ((H150 < C151) * (H150 - C151) + (C151 < L150) * (C151 - L150) + 29 / 30 * ((H151 < C152) * (H151 - C152) + (C152 < L151) * (C152 - L151) + 29 / 30 * ((H152 < C153) * (H152 - C153) + (C153 < L152) * (C153 - L152) + 29 / 30 * ((H153 < C154) * (H153 - C154) + (C154 < L153) * (C154 - L153) + 29 / 30 * ((H154 < C155) * (H154 - C155) + (C155 < L154) * (C155 - L154) + 29 / 30 * ((H155 < C156) * (H155 - C156) + (C156 < L155) * (C156 - L155) + 29 / 30 * ((H156 < C157) * (H156 - C157) + (C157 < L156) * (C157 - L156) + 29 / 30 * ((H157 < C158) * (H157 - C158) + (C158 < L157) * (C158 - L157) + 29 / 30 * ((H158 < C159) * (H158 - C159) + (C159 < L158) * (C159 - L158) + 29 / 30 * ((H159 < C160) * (H159 - C160) + (C160 < L159) * (C160 - L159) + 29 / 30 * ((H160 < C161) * (H160 - C161) + (C161 < L160) * (C161 - L160) + 29 / 30 * ((H161 < C162) * (H161 - C162) + (C162 < L161) * (C162 - L161) + 29 / 30 * ((H162 < C163) * (H162 - C163) + (C163 < L162) * (C163 - L162) + 29 / 30 * ((H163 < C164) * (H163 - C164) + (C164 < L163) * (C164 - L163) + 29 / 30 * ((H164 < C165) * (H164 - C165) + (C165 < L164) * (C165 - L164) + 29 / 30 * ((H165 < C166) * (H165 - C166) + (C166 < L165) * (C166 - L165) + 29 / 30 * ((H166 < C167) * (H166 - C167) + (C167 < L166) * (C167 - L166) + 29 / 30 * ((H167 < C168) * (H167 - C168) + (C168 < L167) * (C168 - L167) + 29 / 30 * ((H168 < C169) * (H168 - C169) + (C169 < L168) * (C169 - L168) + 29 / 30 * ((H169 < C170) * (H169 - C170) + (C170 < L169) * (C170 - L169) + 29 / 30 * ((H170 < C171) * (H170 - C171) + (C171 < L170) * (C171 - L170) + 29 / 30 * ((H171 < C172) * (H171 - C172) + (C172 < L171) * (C172 - L171) + 29 / 30 * ((H172 < C173) * (H172 - C173) + (C173 < L172) * (C173 - L172) + 29 / 30 * ((H173 < C174) * (H173 - C174) + (C174 < L173) * (C174 - L173) + 29 / 30 * ((H174 < C175) * (H174 - C175) + (C175 < L174) * (C175 - L174) + 29 / 30 * ((H175 < C176) * (H175 - C176) + (C176 < L175) * (C176 - L175) + 29 / 30 * ((H176 < C177) * (H176 - C177) + (C177 < L176) * (C177 - L176) + 29 / 30 * ((H177 < C178) * (H177 - C178) + (C178 < L177) * (C178 - L177) + 29 / 30 * ((H178 < C179) * (H178 - C179) + (C179 < L178) * (C179 - L178) + 29 / 30 * ((H179 < C180) * (H179 - C180) + (C180 < L179) * (C180 - L179) + 29 / 30 * ((H180 < C181) * (H180 - C181) + (C181 < L180) * (C181 - L180) + 29 / 30 * ((H181 < C182) * (H181 - C182) + (C182 < L181) * (C182 - L181) + 29 / 30 * ((H182 < C183) * (H182 - C183) + (C183 < L182) * (C183 - L182) + 29 / 30 * ((H183 < C184) * (H183 - C184) + (C184 < L183) * (C184 - L183) + 29 / 30 * ((H184 < C185) * (H184 - C185) + (C185 < L184) * (C185 - L184) + 29 / 30 * ((H185 < C186) * (H185 - C186) + (C186 < L185) * (C186 - L185) + 29 / 30 * ((H186 < C187) * (H186 - C187) + (C187 < L186) * (C187 - L186) + 29 / 30 * ((H187 < C188) * (H187 - C188) + (C188 < L187) * (C188 - L187) + 29 / 30 * ((H188 < C189) * (H188 - C189) + (C189 < L188) * (C189 - L188) + 29 / 30 * ((H189 < C190) * (H189 - C190) + (C190 < L189) * (C190 - L189) + 29 / 30 * ((H190 < C191) * (H190 - C191) + (C191 < L190) * (C191 - L190) + 29 / 30 * ((H191 < C192) * (H191 - C192) + (C192 < L191) * (C192 - L191) + 29 / 30 * ((H192 < C193) * (H192 - C193) + (C193 < L192) * (C193 - L192) + 29 / 30 * ((H193 < C194) * (H193 - C194) + (C194 < L193) * (C194 - L193) + 29 / 30 * ((H194 < C195) * (H194 - C195) + (C195 < L194) * (C195 - L194) + 29 / 30 * ((H195 < C196) * (H195 - C196) + (C196 < L195) * (C196 - L195) + 29 / 30 * ((H196 < C197) * (H196 - C197) + (C197 < L196) * (C197 - L196) + 29 / 30 * ((H197 < C198) * (H197 - C198) + (C198 < L197) * (C198 - L197) + 29 / 30 * ((H198 < C199) * (H198 - C199) + (C199 < L198) * (C199 - L198) + 29 / 30 * ((H199 < C200) * (H199 - C200) + (C200 < L199) * (C200 - L199) + 29 / 30 * ((H200 < C201) * (H200 - C201) + (C201 < L200) * (C201 - L200) + 29 / 30 * ((H201 < C202) * (H201 - C202) + (C202 < L201) * (C202 - L201) + 29 / 30 * ((H202 < C203) * (H202 - C203) + (C203 < L202) * (C203 - L202) + 29 / 30 * ((H203 < C204) * (H203 - C204) + (C204 < L203) * (C204 - L203)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
Here's an Exponential version to round things out:
30-Period Exponential Moving Average of True Range:
XAVGH30 - XAVGL30 + .0645789155461771 * ((H < C1) * (H - C1) + (C1 < L) * (C1 - L) + 29 / 31 * ((H1 < C2) * (H1 - C2) + (C2 < L1) * (C2 - L1) + 29 / 31 * ((H2 < C3) * (H2 - C3) + (C3 < L2) * (C3 - L2) + 29 / 31 * ((H3 < C4) * (H3 - C4) + (C4 < L3) * (C4 - L3) + 29 / 31 * ((H4 < C5) * (H4 - C5) + (C5 < L4) * (C5 - L4) + 29 / 31 * ((H5 < C6) * (H5 - C6) + (C6 < L5) * (C6 - L5) + 29 / 31 * ((H6 < C7) * (H6 - C7) + (C7 < L6) * (C7 - L6) + 29 / 31 * ((H7 < C8) * (H7 - C8) + (C8 < L7) * (C8 - L7) + 29 / 31 * ((H8 < C9) * (H8 - C9) + (C9 < L8) * (C9 - L8) + 29 / 31 * ((H9 < C10) * (H9 - C10) + (C10 < L9) * (C10 - L9) + 29 / 31 * ((H10 < C11) * (H10 - C11) + (C11 < L10) * (C11 - L10) + 29 / 31 * ((H11 < C12) * (H11 - C12) + (C12 < L11) * (C12 - L11) + 29 / 31 * ((H12 < C13) * (H12 - C13) + (C13 < L12) * (C13 - L12) + 29 / 31 * ((H13 < C14) * (H13 - C14) + (C14 < L13) * (C14 - L13) + 29 / 31 * ((H14 < C15) * (H14 - C15) + (C15 < L14) * (C15 - L14) + 29 / 31 * ((H15 < C16) * (H15 - C16) + (C16 < L15) * (C16 - L15) + 29 / 31 * ((H16 < C17) * (H16 - C17) + (C17 < L16) * (C17 - L16) + 29 / 31 * ((H17 < C18) * (H17 - C18) + (C18 < L17) * (C18 - L17) + 29 / 31 * ((H18 < C19) * (H18 - C19) + (C19 < L18) * (C19 - L18) + 29 / 31 * ((H19 < C20) * (H19 - C20) + (C20 < L19) * (C20 - L19) + 29 / 31 * ((H20 < C21) * (H20 - C21) + (C21 < L20) * (C21 - L20) + 29 / 31 * ((H21 < C22) * (H21 - C22) + (C22 < L21) * (C22 - L21) + 29 / 31 * ((H22 < C23) * (H22 - C23) + (C23 < L22) * (C23 - L22) + 29 / 31 * ((H23 < C24) * (H23 - C24) + (C24 < L23) * (C24 - L23) + 29 / 31 * ((H24 < C25) * (H24 - C25) + (C25 < L24) * (C25 - L24) + 29 / 31 * ((H25 < C26) * (H25 - C26) + (C26 < L25) * (C26 - L25) + 29 / 31 * ((H26 < C27) * (H26 - C27) + (C27 < L26) * (C27 - L26) + 29 / 31 * ((H27 < C28) * (H27 - C28) + (C28 < L27) * (C28 - L27) + 29 / 31 * ((H28 < C29) * (H28 - C29) + (C29 < L28) * (C29 - L28) + 29 / 31 * ((H29 < C30) * (H29 - C30) + (C30 < L29) * (C30 - L29) + 29 / 31 * ((H30 < C31) * (H30 - C31) + (C31 < L30) * (C31 - L30) + 29 / 31 * ((H31 < C32) * (H31 - C32) + (C32 < L31) * (C32 - L31) + 29 / 31 * ((H32 < C33) * (H32 - C33) + (C33 < L32) * (C33 - L32) + 29 / 31 * ((H33 < C34) * (H33 - C34) + (C34 < L33) * (C34 - L33) + 29 / 31 * ((H34 < C35) * (H34 - C35) + (C35 < L34) * (C35 - L34) + 29 / 31 * ((H35 < C36) * (H35 - C36) + (C36 < L35) * (C36 - L35) + 29 / 31 * ((H36 < C37) * (H36 - C37) + (C37 < L36) * (C37 - L36) + 29 / 31 * ((H37 < C38) * (H37 - C38) + (C38 < L37) * (C38 - L37) + 29 / 31 * ((H38 < C39) * (H38 - C39) + (C39 < L38) * (C39 - L38) + 29 / 31 * ((H39 < C40) * (H39 - C40) + (C40 < L39) * (C40 - L39) + 29 / 31 * ((H40 < C41) * (H40 - C41) + (C41 < L40) * (C41 - L40) + 29 / 31 * ((H41 < C42) * (H41 - C42) + (C42 < L41) * (C42 - L41) + 29 / 31 * ((H42 < C43) * (H42 - C43) + (C43 < L42) * (C43 - L42) + 29 / 31 * ((H43 < C44) * (H43 - C44) + (C44 < L43) * (C44 - L43) + 29 / 31 * ((H44 < C45) * (H44 - C45) + (C45 < L44) * (C45 - L44) + 29 / 31 * ((H45 < C46) * (H45 - C46) + (C46 < L45) * (C46 - L45) + 29 / 31 * ((H46 < C47) * (H46 - C47) + (C47 < L46) * (C47 - L46) + 29 / 31 * ((H47 < C48) * (H47 - C48) + (C48 < L47) * (C48 - L47) + 29 / 31 * ((H48 < C49) * (H48 - C49) + (C49 < L48) * (C49 - L48) + 29 / 31 * ((H49 < C50) * (H49 - C50) + (C50 < L49) * (C50 - L49) + 29 / 31 * ((H50 < C51) * (H50 - C51) + (C51 < L50) * (C51 - L50) + 29 / 31 * ((H51 < C52) * (H51 - C52) + (C52 < L51) * (C52 - L51) + 29 / 31 * ((H52 < C53) * (H52 - C53) + (C53 < L52) * (C53 - L52) + 29 / 31 * ((H53 < C54) * (H53 - C54) + (C54 < L53) * (C54 - L53) + 29 / 31 * ((H54 < C55) * (H54 - C55) + (C55 < L54) * (C55 - L54) + 29 / 31 * ((H55 < C56) * (H55 - C56) + (C56 < L55) * (C56 - L55) + 29 / 31 * ((H56 < C57) * (H56 - C57) + (C57 < L56) * (C57 - L56) + 29 / 31 * ((H57 < C58) * (H57 - C58) + (C58 < L57) * (C58 - L57) + 29 / 31 * ((H58 < C59) * (H58 - C59) + (C59 < L58) * (C59 - L58) + 29 / 31 * ((H59 < C60) * (H59 - C60) + (C60 < L59) * (C60 - L59) + 29 / 31 * ((H60 < C61) * (H60 - C61) + (C61 < L60) * (C61 - L60) + 29 / 31 * ((H61 < C62) * (H61 - C62) + (C62 < L61) * (C62 - L61) + 29 / 31 * ((H62 < C63) * (H62 - C63) + (C63 < L62) * (C63 - L62) + 29 / 31 * ((H63 < C64) * (H63 - C64) + (C64 < L63) * (C64 - L63) + 29 / 31 * ((H64 < C65) * (H64 - C65) + (C65 < L64) * (C65 - L64) + 29 / 31 * ((H65 < C66) * (H65 - C66) + (C66 < L65) * (C66 - L65) + 29 / 31 * ((H66 < C67) * (H66 - C67) + (C67 < L66) * (C67 - L66) + 29 / 31 * ((H67 < C68) * (H67 - C68) + (C68 < L67) * (C68 - L67) + 29 / 31 * ((H68 < C69) * (H68 - C69) + (C69 < L68) * (C69 - L68) + 29 / 31 * ((H69 < C70) * (H69 - C70) + (C70 < L69) * (C70 - L69) + 29 / 31 * ((H70 < C71) * (H70 - C71) + (C71 < L70) * (C71 - L70) + 29 / 31 * ((H71 < C72) * (H71 - C72) + (C72 < L71) * (C72 - L71) + 29 / 31 * ((H72 < C73) * (H72 - C73) + (C73 < L72) * (C73 - L72) + 29 / 31 * ((H73 < C74) * (H73 - C74) + (C74 < L73) * (C74 - L73) + 29 / 31 * ((H74 < C75) * (H74 - C75) + (C75 < L74) * (C75 - L74) + 29 / 31 * ((H75 < C76) * (H75 - C76) + (C76 < L75) * (C76 - L75) + 29 / 31 * ((H76 < C77) * (H76 - C77) + (C77 < L76) * (C77 - L76) + 29 / 31 * ((H77 < C78) * (H77 - C78) + (C78 < L77) * (C78 - L77) + 29 / 31 * ((H78 < C79) * (H78 - C79) + (C79 < L78) * (C79 - L78) + 29 / 31 * ((H79 < C80) * (H79 - C80) + (C80 < L79) * (C80 - L79) + 29 / 31 * ((H80 < C81) * (H80 - C81) + (C81 < L80) * (C81 - L80) + 29 / 31 * ((H81 < C82) * (H81 - C82) + (C82 < L81) * (C82 - L81) + 29 / 31 * ((H82 < C83) * (H82 - C83) + (C83 < L82) * (C83 - L82) + 29 / 31 * ((H83 < C84) * (H83 - C84) + (C84 < L83) * (C84 - L83) + 29 / 31 * ((H84 < C85) * (H84 - C85) + (C85 < L84) * (C85 - L84) + 29 / 31 * ((H85 < C86) * (H85 - C86) + (C86 < L85) * (C86 - L85) + 29 / 31 * ((H86 < C87) * (H86 - C87) + (C87 < L86) * (C87 - L86) + 29 / 31 * ((H87 < C88) * (H87 - C88) + (C88 < L87) * (C88 - L87) + 29 / 31 * ((H88 < C89) * (H88 - C89) + (C89 < L88) * (C89 - L88) + 29 / 31 * ((H89 < C90) * (H89 - C90) + (C90 < L89) * (C90 - L89) + 29 / 31 * ((H90 < C91) * (H90 - C91) + (C91 < L90) * (C91 - L90) + 29 / 31 * ((H91 < C92) * (H91 - C92) + (C92 < L91) * (C92 - L91) + 29 / 31 * ((H92 < C93) * (H92 - C93) + (C93 < L92) * (C93 - L92) + 29 / 31 * ((H93 < C94) * (H93 - C94) + (C94 < L93) * (C94 - L93) + 29 / 31 * ((H94 < C95) * (H94 - C95) + (C95 < L94) * (C95 - L94) + 29 / 31 * ((H95 < C96) * (H95 - C96) + (C96 < L95) * (C96 - L95) + 29 / 31 * ((H96 < C97) * (H96 - C97) + (C97 < L96) * (C97 - L96) + 29 / 31 * ((H97 < C98) * (H97 - C98) + (C98 < L97) * (C98 - L97) + 29 / 31 * ((H98 < C99) * (H98 - C99) + (C99 < L98) * (C99 - L98) + 29 / 31 * ((H99 < C100) * (H99 - C100) + (C100 < L99) * (C100 - L99) + 29 / 31 * ((H100 < C101) * (H100 - C101) + (C101 < L100) * (C101 - L100) + 29 / 31 * ((H101 < C102) * (H101 - C102) + (C102 < L101) * (C102 - L101) + 29 / 31 * ((H102 < C103) * (H102 - C103) + (C103 < L102) * (C103 - L102) + 29 / 31 * ((H103 < C104) * (H103 - C104) + (C104 < L103) * (C104 - L103)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
Whichever you choose, you can just add the >= 5 onto the end. 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!
Cascades of Moving Averages
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 1/14/2011 Posts: 1
|
Hi Bruce,
I am trying to find stocks that on the previous day have moved 2x their 14 period ATR, would it look something like this?
(H - L)>=(AVGH30 - AVGL30) / 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)) / 28
And then I want today's range to be 50% of 14 period ATR. I'm not sure how to add the second condition. When I type and I get the formula error message.
Thanks in advance for any help,
Mike Morse
To view this video you must have Macromedia Flash Player and Microsoft Internet Explorer 5+
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Your formula would check for the range of the current bar to be greater than or equal to a mishmash of the 30-period and 14-period simple moving average of true range calculations.
Checking for the previous bar to have had an absolute net change of at least twice the current 14-period simple moving average of true range and the current bar have a range equal to at least 50% of the 14-period simple moving average of true range could be written as:
(2 * (H - L) + ABS(C - C1) / 2 - ABS(2 * (H - L) - (ABS(C - C1) / 2))) / 2 >= (AVGH14 - AVGL14) / 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) + 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)) / 28 AND H > L AND C <> C1
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 7/18/2011 Posts: 16
|
Hello Bruce, How do I calculate % of 2ATR (two times average true range using 20 week ATR) / closing price of a stock. I would like to create a PCF to scan charts or create and sort a watch list column using this percentage as the criterion. I am trying to find stocks which have the smallest ratio of 2ATR/ Closing price of a stock. Thanks.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Please try the following Indicator Formula with the time frame settings set to Weekly in TC2000 version 12.4:
200 * ((AVGH20 - AVGL20) / 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) + 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)) / 40) / C
You can change the time frame of an Indicator Formula when you create or edit it by adjusting the Time Frame drop-down menu in the Edit PCF window.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |