Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 10/8/2005 Posts: 3
|
I'd like to use a 20-day Average True Range in one of my PCFs but have not been successful in building it.
Can you tell where I might find the formula for a 20-day Average True Range?
Many thanks
|
|
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. It could be calculated using a Simple Moving Average:
20-Period Simple Moving Average of True Range:
(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
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:
20-Period Average True Range (Wilder's Smoothed):
XAVGH39 - XAVGL39 + .0500492134680739 * ((H < C1) * (H - C1) + (C1 < L) * (C1 - L) + 38 / 40 * ((H1 < C2) * (H1 - C2) + (C2 < L1) * (C2 - L1) + 38 / 40 * ((H2 < C3) * (H2 - C3) + (C3 < L2) * (C3 - L2) + 38 / 40 * ((H3 < C4) * (H3 - C4) + (C4 < L3) * (C4 - L3) + 38 / 40 * ((H4 < C5) * (H4 - C5) + (C5 < L4) * (C5 - L4) + 38 / 40 * ((H5 < C6) * (H5 - C6) + (C6 < L5) * (C6 - L5) + 38 / 40 * ((H6 < C7) * (H6 - C7) + (C7 < L6) * (C7 - L6) + 38 / 40 * ((H7 < C8) * (H7 - C8) + (C8 < L7) * (C8 - L7) + 38 / 40 * ((H8 < C9) * (H8 - C9) + (C9 < L8) * (C9 - L8) + 38 / 40 * ((H9 < C10) * (H9 - C10) + (C10 < L9) * (C10 - L9) + 38 / 40 * ((H10 < C11) * (H10 - C11) + (C11 < L10) * (C11 - L10) + 38 / 40 * ((H11 < C12) * (H11 - C12) + (C12 < L11) * (C12 - L11) + 38 / 40 * ((H12 < C13) * (H12 - C13) + (C13 < L12) * (C13 - L12) + 38 / 40 * ((H13 < C14) * (H13 - C14) + (C14 < L13) * (C14 - L13) + 38 / 40 * ((H14 < C15) * (H14 - C15) + (C15 < L14) * (C15 - L14) + 38 / 40 * ((H15 < C16) * (H15 - C16) + (C16 < L15) * (C16 - L15) + 38 / 40 * ((H16 < C17) * (H16 - C17) + (C17 < L16) * (C17 - L16) + 38 / 40 * ((H17 < C18) * (H17 - C18) + (C18 < L17) * (C18 - L17) + 38 / 40 * ((H18 < C19) * (H18 - C19) + (C19 < L18) * (C19 - L18) + 38 / 40 * ((H19 < C20) * (H19 - C20) + (C20 < L19) * (C20 - L19) + 38 / 40 * ((H20 < C21) * (H20 - C21) + (C21 < L20) * (C21 - L20) + 38 / 40 * ((H21 < C22) * (H21 - C22) + (C22 < L21) * (C22 - L21) + 38 / 40 * ((H22 < C23) * (H22 - C23) + (C23 < L22) * (C23 - L22) + 38 / 40 * ((H23 < C24) * (H23 - C24) + (C24 < L23) * (C24 - L23) + 38 / 40 * ((H24 < C25) * (H24 - C25) + (C25 < L24) * (C25 - L24) + 38 / 40 * ((H25 < C26) * (H25 - C26) + (C26 < L25) * (C26 - L25) + 38 / 40 * ((H26 < C27) * (H26 - C27) + (C27 < L26) * (C27 - L26) + 38 / 40 * ((H27 < C28) * (H27 - C28) + (C28 < L27) * (C28 - L27) + 38 / 40 * ((H28 < C29) * (H28 - C29) + (C29 < L28) * (C29 - L28) + 38 / 40 * ((H29 < C30) * (H29 - C30) + (C30 < L29) * (C30 - L29) + 38 / 40 * ((H30 < C31) * (H30 - C31) + (C31 < L30) * (C31 - L30) + 38 / 40 * ((H31 < C32) * (H31 - C32) + (C32 < L31) * (C32 - L31) + 38 / 40 * ((H32 < C33) * (H32 - C33) + (C33 < L32) * (C33 - L32) + 38 / 40 * ((H33 < C34) * (H33 - C34) + (C34 < L33) * (C34 - L33) + 38 / 40 * ((H34 < C35) * (H34 - C35) + (C35 < L34) * (C35 - L34) + 38 / 40 * ((H35 < C36) * (H35 - C36) + (C36 < L35) * (C36 - L35) + 38 / 40 * ((H36 < C37) * (H36 - C37) + (C37 < L36) * (C37 - L36) + 38 / 40 * ((H37 < C38) * (H37 - C38) + (C38 < L37) * (C38 - L37) + 38 / 40 * ((H38 < C39) * (H38 - C39) + (C39 < L38) * (C39 - L38) + 38 / 40 * ((H39 < C40) * (H39 - C40) + (C40 < L39) * (C40 - L39) + 38 / 40 * ((H40 < C41) * (H40 - C41) + (C41 < L40) * (C41 - L40) + 38 / 40 * ((H41 < C42) * (H41 - C42) + (C42 < L41) * (C42 - L41) + 38 / 40 * ((H42 < C43) * (H42 - C43) + (C43 < L42) * (C43 - L42) + 38 / 40 * ((H43 < C44) * (H43 - C44) + (C44 < L43) * (C44 - L43) + 38 / 40 * ((H44 < C45) * (H44 - C45) + (C45 < L44) * (C45 - L44) + 38 / 40 * ((H45 < C46) * (H45 - C46) + (C46 < L45) * (C46 - L45) + 38 / 40 * ((H46 < C47) * (H46 - C47) + (C47 < L46) * (C47 - L46) + 38 / 40 * ((H47 < C48) * (H47 - C48) + (C48 < L47) * (C48 - L47) + 38 / 40 * ((H48 < C49) * (H48 - C49) + (C49 < L48) * (C49 - L48) + 38 / 40 * ((H49 < C50) * (H49 - C50) + (C50 < L49) * (C50 - L49) + 38 / 40 * ((H50 < C51) * (H50 - C51) + (C51 < L50) * (C51 - L50) + 38 / 40 * ((H51 < C52) * (H51 - C52) + (C52 < L51) * (C52 - L51) + 38 / 40 * ((H52 < C53) * (H52 - C53) + (C53 < L52) * (C53 - L52) + 38 / 40 * ((H53 < C54) * (H53 - C54) + (C54 < L53) * (C54 - L53) + 38 / 40 * ((H54 < C55) * (H54 - C55) + (C55 < L54) * (C55 - L54) + 38 / 40 * ((H55 < C56) * (H55 - C56) + (C56 < L55) * (C56 - L55) + 38 / 40 * ((H56 < C57) * (H56 - C57) + (C57 < L56) * (C57 - L56) + 38 / 40 * ((H57 < C58) * (H57 - C58) + (C58 < L57) * (C58 - L57) + 38 / 40 * ((H58 < C59) * (H58 - C59) + (C59 < L58) * (C59 - L58) + 38 / 40 * ((H59 < C60) * (H59 - C60) + (C60 < L59) * (C60 - L59) + 38 / 40 * ((H60 < C61) * (H60 - C61) + (C61 < L60) * (C61 - L60) + 38 / 40 * ((H61 < C62) * (H61 - C62) + (C62 < L61) * (C62 - L61) + 38 / 40 * ((H62 < C63) * (H62 - C63) + (C63 < L62) * (C63 - L62) + 38 / 40 * ((H63 < C64) * (H63 - C64) + (C64 < L63) * (C64 - L63) + 38 / 40 * ((H64 < C65) * (H64 - C65) + (C65 < L64) * (C65 - L64) + 38 / 40 * ((H65 < C66) * (H65 - C66) + (C66 < L65) * (C66 - L65) + 38 / 40 * ((H66 < C67) * (H66 - C67) + (C67 < L66) * (C67 - L66) + 38 / 40 * ((H67 < C68) * (H67 - C68) + (C68 < L67) * (C68 - L67) + 38 / 40 * ((H68 < C69) * (H68 - C69) + (C69 < L68) * (C69 - L68) + 38 / 40 * ((H69 < C70) * (H69 - C70) + (C70 < L69) * (C70 - L69) + 38 / 40 * ((H70 < C71) * (H70 - C71) + (C71 < L70) * (C71 - L70) + 38 / 40 * ((H71 < C72) * (H71 - C72) + (C72 < L71) * (C72 - L71) + 38 / 40 * ((H72 < C73) * (H72 - C73) + (C73 < L72) * (C73 - L72) + 38 / 40 * ((H73 < C74) * (H73 - C74) + (C74 < L73) * (C74 - L73) + 38 / 40 * ((H74 < C75) * (H74 - C75) + (C75 < L74) * (C75 - L74) + 38 / 40 * ((H75 < C76) * (H75 - C76) + (C76 < L75) * (C76 - L75) + 38 / 40 * ((H76 < C77) * (H76 - C77) + (C77 < L76) * (C77 - L76) + 38 / 40 * ((H77 < C78) * (H77 - C78) + (C78 < L77) * (C78 - L77) + 38 / 40 * ((H78 < C79) * (H78 - C79) + (C79 < L78) * (C79 - L78) + 38 / 40 * ((H79 < C80) * (H79 - C80) + (C80 < L79) * (C80 - L79) + 38 / 40 * ((H80 < C81) * (H80 - C81) + (C81 < L80) * (C81 - L80) + 38 / 40 * ((H81 < C82) * (H81 - C82) + (C82 < L81) * (C82 - L81) + 38 / 40 * ((H82 < C83) * (H82 - C83) + (C83 < L82) * (C83 - L82) + 38 / 40 * ((H83 < C84) * (H83 - C84) + (C84 < L83) * (C84 - L83) + 38 / 40 * ((H84 < C85) * (H84 - C85) + (C85 < L84) * (C85 - L84) + 38 / 40 * ((H85 < C86) * (H85 - C86) + (C86 < L85) * (C86 - L85) + 38 / 40 * ((H86 < C87) * (H86 - C87) + (C87 < L86) * (C87 - L86) + 38 / 40 * ((H87 < C88) * (H87 - C88) + (C88 < L87) * (C88 - L87) + 38 / 40 * ((H88 < C89) * (H88 - C89) + (C89 < L88) * (C89 - L88) + 38 / 40 * ((H89 < C90) * (H89 - C90) + (C90 < L89) * (C90 - L89) + 38 / 40 * ((H90 < C91) * (H90 - C91) + (C91 < L90) * (C91 - L90) + 38 / 40 * ((H91 < C92) * (H91 - C92) + (C92 < L91) * (C92 - L91) + 38 / 40 * ((H92 < C93) * (H92 - C93) + (C93 < L92) * (C93 - L92) + 38 / 40 * ((H93 < C94) * (H93 - C94) + (C94 < L93) * (C94 - L93) + 38 / 40 * ((H94 < C95) * (H94 - C95) + (C95 < L94) * (C95 - L94) + 38 / 40 * ((H95 < C96) * (H95 - C96) + (C96 < L95) * (C96 - L95) + 38 / 40 * ((H96 < C97) * (H96 - C97) + (C97 < L96) * (C97 - L96) + 38 / 40 * ((H97 < C98) * (H97 - C98) + (C98 < L97) * (C98 - L97) + 38 / 40 * ((H98 < C99) * (H98 - C99) + (C99 < L98) * (C99 - L98) + 38 / 40 * ((H99 < C100) * (H99 - C100) + (C100 < L99) * (C100 - L99) + 38 / 40 * ((H100 < C101) * (H100 - C101) + (C101 < L100) * (C101 - L100) + 38 / 40 * ((H101 < C102) * (H101 - C102) + (C102 < L101) * (C102 - L101) + 38 / 40 * ((H102 < C103) * (H102 - C103) + (C103 < L102) * (C103 - L102) + 38 / 40 * ((H103 < C104) * (H103 - C104) + (C104 < L103) * (C104 - L103) + 38 / 40 * ((H104 < C105) * (H104 - C105) + (C105 < L104) * (C105 - L104) + 38 / 40 * ((H105 < C106) * (H105 - C106) + (C106 < L105) * (C106 - L105) + 38 / 40 * ((H106 < C107) * (H106 - C107) + (C107 < L106) * (C107 - L106) + 38 / 40 * ((H107 < C108) * (H107 - C108) + (C108 < L107) * (C108 - L107) + 38 / 40 * ((H108 < C109) * (H108 - C109) + (C109 < L108) * (C109 - L108) + 38 / 40 * ((H109 < C110) * (H109 - C110) + (C110 < L109) * (C110 - L109) + 38 / 40 * ((H110 < C111) * (H110 - C111) + (C111 < L110) * (C111 - L110) + 38 / 40 * ((H111 < C112) * (H111 - C112) + (C112 < L111) * (C112 - L111) + 38 / 40 * ((H112 < C113) * (H112 - C113) + (C113 < L112) * (C113 - L112) + 38 / 40 * ((H113 < C114) * (H113 - C114) + (C114 < L113) * (C114 - L113) + 38 / 40 * ((H114 < C115) * (H114 - C115) + (C115 < L114) * (C115 - L114) + 38 / 40 * ((H115 < C116) * (H115 - C116) + (C116 < L115) * (C116 - L115) + 38 / 40 * ((H116 < C117) * (H116 - C117) + (C117 < L116) * (C117 - L116) + 38 / 40 * ((H117 < C118) * (H117 - C118) + (C118 < L117) * (C118 - L117) + 38 / 40 * ((H118 < C119) * (H118 - C119) + (C119 < L118) * (C119 - L118) + 38 / 40 * ((H119 < C120) * (H119 - C120) + (C120 < L119) * (C120 - L119) + 38 / 40 * ((H120 < C121) * (H120 - C121) + (C121 < L120) * (C121 - L120) + 38 / 40 * ((H121 < C122) * (H121 - C122) + (C122 < L121) * (C122 - L121) + 38 / 40 * ((H122 < C123) * (H122 - C123) + (C123 < L122) * (C123 - L122) + 38 / 40 * ((H123 < C124) * (H123 - C124) + (C124 < L123) * (C124 - L123) + 38 / 40 * ((H124 < C125) * (H124 - C125) + (C125 < L124) * (C125 - L124) + 38 / 40 * ((H125 < C126) * (H125 - C126) + (C126 < L125) * (C126 - L125) + 38 / 40 * ((H126 < C127) * (H126 - C127) + (C127 < L126) * (C127 - L126) + 38 / 40 * ((H127 < C128) * (H127 - C128) + (C128 < L127) * (C128 - L127) + 38 / 40 * ((H128 < C129) * (H128 - C129) + (C129 < L128) * (C129 - L128) + 38 / 40 * ((H129 < C130) * (H129 - C130) + (C130 < L129) * (C130 - L129) + 38 / 40 * ((H130 < C131) * (H130 - C131) + (C131 < L130) * (C131 - L130) + 38 / 40 * ((H131 < C132) * (H131 - C132) + (C132 < L131) * (C132 - L131) + 38 / 40 * ((H132 < C133) * (H132 - C133) + (C133 < L132) * (C133 - L132) + 38 / 40 * ((H133 < C134) * (H133 - C134) + (C134 < L133) * (C134 - L133) + 38 / 40 * ((H134 < C135) * (H134 - C135) + (C135 < L134) * (C135 - L134))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
Here's an Exponential version to round things out:
20-Period Exponential Moving Average of True Range:
XAVGH20 - XAVGL20 + .0953245136006837 * ((H < C1) * (H - C1) + (C1 < L) * (C1 - L) + 19 / 21 * ((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)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
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!
Average True Range (ATR) & Stop Losses
Trailing-Stop Applications in TC
Average True Range
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 3/13/2010 Posts: 2
|
Hi Bruce,I'm trying to create an indicator which is an inverted histogram of the difference between the 20-day ATR and its 20-day EMA.Although I have the formula for the 20-day ATR that you just created, I'm not sure how to subtract the 20-day EMA.I would appreciate if you can help me out with that.Best,Gonzalo
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
If the ATR is Simple (which is what TC2000 version 12 uses), then I think the difference between the 20-Period ATR and its 20-Period EMA would be (the scale cannot be inverted in TC2000):
Cascades of Moving Averages
19 * (XAVGH20 - XAVGL20 + .0953245136006837 * ((H < C1) * (H - C1) + (C1 < L) * (C1 - L) + 19 / 21 * ((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))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) - (XAVGH20.20 - XAVGL20.20 + .0953245136006837 * ((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) + 19 / 21 * ((H71 < C72) * (H71 - C72) + (C72 < L71) * (C72 - L71) + 19 / 21 * ((H72 < C73) * (H72 - C73) + (C73 < L72) * (C73 - L72) + 19 / 21 * ((H73 < C74) * (H73 - C74) + (C74 < L73) * (C74 - L73) + 19 / 21 * ((H74 < C75) * (H74 - C75) + (C75 < L74) * (C75 - L74) + 19 / 21 * ((H75 < C76) * (H75 - C76) + (C76 < L75) * (C76 - L75) + 19 / 21 * ((H76 < C77) * (H76 - C77) + (C77 < L76) * (C77 - L76) + 19 / 21 * ((H77 < C78) * (H77 - C78) + (C78 < L77) * (C78 - L77) + 19 / 21 * ((H78 < C79) * (H78 - C79) + (C79 < L78) * (C79 - L78) + 19 / 21 * ((H79 < C80) * (H79 - C80) + (C80 < L79) * (C80 - L79) + 19 / 21 * ((H80 < C81) * (H80 - C81) + (C81 < L80) * (C81 - L80) + 19 / 21 * ((H81 < C82) * (H81 - C82) + (C82 < L81) * (C82 - L81) + 19 / 21 * ((H82 < C83) * (H82 - C83) + (C83 < L82) * (C83 - L82) + 19 / 21 * ((H83 < C84) * (H83 - C84) + (C84 < L83) * (C84 - L83) + 19 / 21 * ((H84 < C85) * (H84 - C85) + (C85 < L84) * (C85 - L84) + 19 / 21 * ((H85 < C86) * (H85 - C86) + (C86 < L85) * (C86 - L85) + 19 / 21 * ((H86 < C87) * (H86 - C87) + (C87 < L86) * (C87 - L86) + 19 / 21 * ((H87 < C88) * (H87 - C88) + (C88 < L87) * (C88 - L87) + 19 / 21 * ((H88 < C89) * (H88 - C89) + (C89 < L88) * (C89 - L88) + 19 / 21 * ((H89 < C90) * (H89 - C90) + (C90 < L89) * (C90 - L89))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) / 40
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 3/13/2010 Posts: 2
|
Hi Bruce, thanks a lot for the formula. However, since what I'm looking for is an INVERTED HISTOGRAM, shouldn't be its (20-Period EMA) - (20-Period ATR)? Sorry for the confusion and, again, thanks a lot for your time. Gonzalo
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
An inverted histogram would generally be a display style where lower values are above higher values. This is not available in TC2000. Subtracting 20-Period ATR from its 20-Period EMA would give you the same visual style as an inverted histogram (and I'll provide the formula below), but this will be a result of the inverting the values and not inverting the scale.
19 * (XAVGH20.20 - XAVGL20.20 + .0953245136006837 * ((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) + 19 / 21 * ((H71 < C72) * (H71 - C72) + (C72 < L71) * (C72 - L71) + 19 / 21 * ((H72 < C73) * (H72 - C73) + (C73 < L72) * (C73 - L72) + 19 / 21 * ((H73 < C74) * (H73 - C74) + (C74 < L73) * (C74 - L73) + 19 / 21 * ((H74 < C75) * (H74 - C75) + (C75 < L74) * (C75 - L74) + 19 / 21 * ((H75 < C76) * (H75 - C76) + (C76 < L75) * (C76 - L75) + 19 / 21 * ((H76 < C77) * (H76 - C77) + (C77 < L76) * (C77 - L76) + 19 / 21 * ((H77 < C78) * (H77 - C78) + (C78 < L77) * (C78 - L77) + 19 / 21 * ((H78 < C79) * (H78 - C79) + (C79 < L78) * (C79 - L78) + 19 / 21 * ((H79 < C80) * (H79 - C80) + (C80 < L79) * (C80 - L79) + 19 / 21 * ((H80 < C81) * (H80 - C81) + (C81 < L80) * (C81 - L80) + 19 / 21 * ((H81 < C82) * (H81 - C82) + (C82 < L81) * (C82 - L81) + 19 / 21 * ((H82 < C83) * (H82 - C83) + (C83 < L82) * (C83 - L82) + 19 / 21 * ((H83 < C84) * (H83 - C84) + (C84 < L83) * (C84 - L83) + 19 / 21 * ((H84 < C85) * (H84 - C85) + (C85 < L84) * (C85 - L84) + 19 / 21 * ((H85 < C86) * (H85 - C86) + (C86 < L85) * (C86 - L85) + 19 / 21 * ((H86 < C87) * (H86 - C87) + (C87 < L86) * (C87 - L86) + 19 / 21 * ((H87 < C88) * (H87 - C88) + (C88 < L87) * (C88 - L87) + 19 / 21 * ((H88 < C89) * (H88 - C89) + (C89 < L88) * (C89 - L88) + 19 / 21 * ((H89 < C90) * (H89 - C90) + (C90 < L89) * (C90 - L89))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) - (XAVGH20 - XAVGL20 + .0953245136006837 * ((H < C1) * (H - C1) + (C1 < L) * (C1 - L) + 19 / 21 * ((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))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) - (XAVGH20.20 - XAVGL20.20 + .0953245136006837 * ((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) + 19 / 21 * ((H71 < C72) * (H71 - C72) + (C72 < L71) * (C72 - L71) + 19 / 21 * ((H72 < C73) * (H72 - C73) + (C73 < L72) * (C73 - L72) + 19 / 21 * ((H73 < C74) * (H73 - C74) + (C74 < L73) * (C74 - L73) + 19 / 21 * ((H74 < C75) * (H74 - C75) + (C75 < L74) * (C75 - L74) + 19 / 21 * ((H75 < C76) * (H75 - C76) + (C76 < L75) * (C76 - L75) + 19 / 21 * ((H76 < C77) * (H76 - C77) + (C77 < L76) * (C77 - L76) + 19 / 21 * ((H77 < C78) * (H77 - C78) + (C78 < L77) * (C78 - L77) + 19 / 21 * ((H78 < C79) * (H78 - C79) + (C79 < L78) * (C79 - L78) + 19 / 21 * ((H79 < C80) * (H79 - C80) + (C80 < L79) * (C80 - L79) + 19 / 21 * ((H80 < C81) * (H80 - C81) + (C81 < L80) * (C81 - L80) + 19 / 21 * ((H81 < C82) * (H81 - C82) + (C82 < L81) * (C82 - L81) + 19 / 21 * ((H82 < C83) * (H82 - C83) + (C83 < L82) * (C83 - L82) + 19 / 21 * ((H83 < C84) * (H83 - C84) + (C84 < L83) * (C84 - L83) + 19 / 21 * ((H84 < C85) * (H84 - C85) + (C85 < L84) * (C85 - L84) + 19 / 21 * ((H85 < C86) * (H85 - C86) + (C86 < L85) * (C86 - L85) + 19 / 21 * ((H86 < C87) * (H86 - C87) + (C87 < L86) * (C87 - L86) + 19 / 21 * ((H87 < C88) * (H87 - C88) + (C88 < L87) * (C88 - L87) + 19 / 21 * ((H88 < C89) * (H88 - C89) + (C89 < L88) * (C89 - L88) + 19 / 21 * ((H89 < C90) * (H89 - C90) + (C90 < L89) * (C90 - L89)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) / 40
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 11/16/2010 Posts: 1
|
Hi Bruce,
For yesterday's 20-day ATR, do I just need to increase all the numbers behind H/C/L by 1? Thanks!
QUOTE (Bruce_L) If the ATR is Simple (which is what TC2000 version 12 uses), then I think the difference between the 20-Period ATR and its 20-Period EMA would be (the scale cannot be inverted in TC2000):
Cascades of Moving Averages
19 * (XAVGH20 - XAVGL20 + .0953245136006837 * ((H < C1) * (H - C1) + (C1 < L) * (C1 - L) + 19 / 21 * ((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))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) - (XAVGH20.20 - XAVGL20.20 + .0953245136006837 * ((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) + 19 / 21 * ((H71 < C72) * (H71 - C72) + (C72 < L71) * (C72 - L71) + 19 / 21 * ((H72 < C73) * (H72 - C73) + (C73 < L72) * (C73 - L72) + 19 / 21 * ((H73 < C74) * (H73 - C74) + (C74 < L73) * (C74 - L73) + 19 / 21 * ((H74 < C75) * (H74 - C75) + (C75 < L74) * (C75 - L74) + 19 / 21 * ((H75 < C76) * (H75 - C76) + (C76 < L75) * (C76 - L75) + 19 / 21 * ((H76 < C77) * (H76 - C77) + (C77 < L76) * (C77 - L76) + 19 / 21 * ((H77 < C78) * (H77 - C78) + (C78 < L77) * (C78 - L77) + 19 / 21 * ((H78 < C79) * (H78 - C79) + (C79 < L78) * (C79 - L78) + 19 / 21 * ((H79 < C80) * (H79 - C80) + (C80 < L79) * (C80 - L79) + 19 / 21 * ((H80 < C81) * (H80 - C81) + (C81 < L80) * (C81 - L80) + 19 / 21 * ((H81 < C82) * (H81 - C82) + (C82 < L81) * (C82 - L81) + 19 / 21 * ((H82 < C83) * (H82 - C83) + (C83 < L82) * (C83 - L82) + 19 / 21 * ((H83 < C84) * (H83 - C84) + (C84 < L83) * (C84 - L83) + 19 / 21 * ((H84 < C85) * (H84 - C85) + (C85 < L84) * (C85 - L84) + 19 / 21 * ((H85 < C86) * (H85 - C86) + (C86 < L85) * (C86 - L85) + 19 / 21 * ((H86 < C87) * (H86 - C87) + (C87 < L86) * (C87 - L86) + 19 / 21 * ((H87 < C88) * (H87 - C88) + (C88 < L87) * (C88 - L87) + 19 / 21 * ((H88 < C89) * (H88 - C89) + (C89 < L88) * (C89 - L88) + 19 / 21 * ((H89 < C90) * (H89 - C90) + (C90 < L89) * (C90 - L89))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) / 40
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Yes, but note that the formula you quoted is not ATR, but the difference between ATR and its 20-Period EMA. For example, a 20-Period Simple Moving Average of True Range which would match the ATR in TC2000 version 12.3 would be a much shorter formula:
(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
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 5/27/2014 Posts: 1
|
how would i modify the formula to construct the 10 period ATR.
would it be
(AVGH10.1 - AVGL10.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))/20
|
|
Administration
Joined: 9/30/2004 Posts: 9,187
|
In version 17 you could use ATR10.
|
|
Registered User Joined: 1/28/2005 Posts: 6,049
|
Try this:
ATR10:
(AVGH10 - AVGL10 + (ABS(H - C1) + ABS(L - C1) + ABS(H1 - C2) + ABS(L1 - C2) + ABS(H2 - C3) + ABS(L2 - C3) + ABS(H3 - C4) + ABS(L3 - C4) + ABS(H4 - C5) + ABS(L4 - C5) + ABS(H5 - C6) + ABS(L5 - C6) + ABS(H6 - C7) + ABS(L6 - C7) + ABS(H7 - C8) + ABS(L7 - C8) + ABS(H8 - C9) + ABS(L8 - C9) + ABS(H9 - C10) + ABS(L9 - C10) ) / 10 ) / 2
Thanks
|
|
Guest-1 |