Download software Tutorial videos
Subscription & data-feed pricing Class schedule

New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
 Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

 s/r average Rate this Topic:
 Previous Topic · Next Topic Watch this topic · Print this topic ·
stockscience
 Posted : Monday, July 2, 2018 3:20:10 PM
Registered User
Joined: 6/26/2011
Posts: 128

Hi Bruce:

I would be interested in the average closing price of all previous bars (n=200) that contain the current price.

Bruce_L
 Posted : Monday, July 2, 2018 3:41:40 PM

Worden Trainer

Joined: 10/7/2004
Posts: 65,138

There really is no good way to write this.

`(IIF(L1 <= C AND C <= H1, C1, 0) + IIF(L2 <= C AND C <= H2, C2, 0) + IIF(L3 <= C AND C <= H3, C3, 0) + IIF(L4 <= C AND C <= H4, C4, 0) + IIF(L5 <= C AND C <= H5, C5, 0) + IIF(L6 <= C AND C <= H6, C6, 0) + IIF(L7 <= C AND C <= H7, C7, 0) + IIF(L8 <= C AND C <= H8, C8, 0) + IIF(L9 <= C AND C <= H9, C9, 0) + IIF(L10 <= C AND C <= H10, C10, 0) + IIF(L11 <= C AND C <= H11, C11, 0) + IIF(L12 <= C AND C <= H12, C12, 0) + IIF(L13 <= C AND C <= H13, C13, 0) + IIF(L14 <= C AND C <= H14, C14, 0) + IIF(L15 <= C AND C <= H15, C15, 0) + IIF(L16 <= C AND C <= H16, C16, 0) + IIF(L17 <= C AND C <= H17, C17, 0) + IIF(L18 <= C AND C <= H18, C18, 0) + IIF(L19 <= C AND C <= H19, C19, 0) + IIF(L20 <= C AND C <= H20, C20, 0) + IIF(L21 <= C AND C <= H21, C21, 0) + IIF(L22 <= C AND C <= H22, C22, 0) + IIF(L23 <= C AND C <= H23, C23, 0) + IIF(L24 <= C AND C <= H24, C24, 0) + IIF(L25 <= C AND C <= H25, C25, 0) + IIF(L26 <= C AND C <= H26, C26, 0) + IIF(L27 <= C AND C <= H27, C27, 0) + IIF(L28 <= C AND C <= H28, C28, 0) + IIF(L29 <= C AND C <= H29, C29, 0) + IIF(L30 <= C AND C <= H30, C30, 0) + IIF(L31 <= C AND C <= H31, C31, 0) + IIF(L32 <= C AND C <= H32, C32, 0) + IIF(L33 <= C AND C <= H33, C33, 0) + IIF(L34 <= C AND C <= H34, C34, 0) + IIF(L35 <= C AND C <= H35, C35, 0) + IIF(L36 <= C AND C <= H36, C36, 0) + IIF(L37 <= C AND C <= H37, C37, 0) + IIF(L38 <= C AND C <= H38, C38, 0) + IIF(L39 <= C AND C <= H39, C39, 0) + IIF(L40 <= C AND C <= H40, C40, 0) + IIF(L41 <= C AND C <= H41, C41, 0) + IIF(L42 <= C AND C <= H42, C42, 0) + IIF(L43 <= C AND C <= H43, C43, 0) + IIF(L44 <= C AND C <= H44, C44, 0) + IIF(L45 <= C AND C <= H45, C45, 0) + IIF(L46 <= C AND C <= H46, C46, 0) + IIF(L47 <= C AND C <= H47, C47, 0) + IIF(L48 <= C AND C <= H48, C48, 0) + IIF(L49 <= C AND C <= H49, C49, 0) + IIF(L50 <= C AND C <= H50, C50, 0) + IIF(L51 <= C AND C <= H51, C51, 0) + IIF(L52 <= C AND C <= H52, C52, 0) + IIF(L53 <= C AND C <= H53, C53, 0) + IIF(L54 <= C AND C <= H54, C54, 0) + IIF(L55 <= C AND C <= H55, C55, 0) + IIF(L56 <= C AND C <= H56, C56, 0) + IIF(L57 <= C AND C <= H57, C57, 0) + IIF(L58 <= C AND C <= H58, C58, 0) + IIF(L59 <= C AND C <= H59, C59, 0) + IIF(L60 <= C AND C <= H60, C60, 0) + IIF(L61 <= C AND C <= H61, C61, 0) + IIF(L62 <= C AND C <= H62, C62, 0) + IIF(L63 <= C AND C <= H63, C63, 0) + IIF(L64 <= C AND C <= H64, C64, 0) + IIF(L65 <= C AND C <= H65, C65, 0) + IIF(L66 <= C AND C <= H66, C66, 0) + IIF(L67 <= C AND C <= H67, C67, 0) + IIF(L68 <= C AND C <= H68, C68, 0) + IIF(L69 <= C AND C <= H69, C69, 0) + IIF(L70 <= C AND C <= H70, C70, 0) + IIF(L71 <= C AND C <= H71, C71, 0) + IIF(L72 <= C AND C <= H72, C72, 0) + IIF(L73 <= C AND C <= H73, C73, 0) + IIF(L74 <= C AND C <= H74, C74, 0) + IIF(L75 <= C AND C <= H75, C75, 0) + IIF(L76 <= C AND C <= H76, C76, 0) + IIF(L77 <= C AND C <= H77, C77, 0) + IIF(L78 <= C AND C <= H78, C78, 0) + IIF(L79 <= C AND C <= H79, C79, 0) + IIF(L80 <= C AND C <= H80, C80, 0) + IIF(L81 <= C AND C <= H81, C81, 0) + IIF(L82 <= C AND C <= H82, C82, 0) + IIF(L83 <= C AND C <= H83, C83, 0) + IIF(L84 <= C AND C <= H84, C84, 0) + IIF(L85 <= C AND C <= H85, C85, 0) + IIF(L86 <= C AND C <= H86, C86, 0) + IIF(L87 <= C AND C <= H87, C87, 0) + IIF(L88 <= C AND C <= H88, C88, 0) + IIF(L89 <= C AND C <= H89, C89, 0) + IIF(L90 <= C AND C <= H90, C90, 0) + IIF(L91 <= C AND C <= H91, C91, 0) + IIF(L92 <= C AND C <= H92, C92, 0) + IIF(L93 <= C AND C <= H93, C93, 0) + IIF(L94 <= C AND C <= H94, C94, 0) + IIF(L95 <= C AND C <= H95, C95, 0) + IIF(L96 <= C AND C <= H96, C96, 0) + IIF(L97 <= C AND C <= H97, C97, 0) + IIF(L98 <= C AND C <= H98, C98, 0) + IIF(L99 <= C AND C <= H99, C99, 0) + IIF(L100 <= C AND C <= H100, C100, 0) + IIF(L101 <= C AND C <= H101, C101, 0) + IIF(L102 <= C AND C <= H102, C102, 0) + IIF(L103 <= C AND C <= H103, C103, 0) + IIF(L104 <= C AND C <= H104, C104, 0) + IIF(L105 <= C AND C <= H105, C105, 0) + IIF(L106 <= C AND C <= H106, C106, 0) + IIF(L107 <= C AND C <= H107, C107, 0) + IIF(L108 <= C AND C <= H108, C108, 0) + IIF(L109 <= C AND C <= H109, C109, 0) + IIF(L110 <= C AND C <= H110, C110, 0) + IIF(L111 <= C AND C <= H111, C111, 0) + IIF(L112 <= C AND C <= H112, C112, 0) + IIF(L113 <= C AND C <= H113, C113, 0) + IIF(L114 <= C AND C <= H114, C114, 0) + IIF(L115 <= C AND C <= H115, C115, 0) + IIF(L116 <= C AND C <= H116, C116, 0) + IIF(L117 <= C AND C <= H117, C117, 0) + IIF(L118 <= C AND C <= H118, C118, 0) + IIF(L119 <= C AND C <= H119, C119, 0) + IIF(L120 <= C AND C <= H120, C120, 0) + IIF(L121 <= C AND C <= H121, C121, 0) + IIF(L122 <= C AND C <= H122, C122, 0) + IIF(L123 <= C AND C <= H123, C123, 0) + IIF(L124 <= C AND C <= H124, C124, 0) + IIF(L125 <= C AND C <= H125, C125, 0) + IIF(L126 <= C AND C <= H126, C126, 0) + IIF(L127 <= C AND C <= H127, C127, 0) + IIF(L128 <= C AND C <= H128, C128, 0) + IIF(L129 <= C AND C <= H129, C129, 0) + IIF(L130 <= C AND C <= H130, C130, 0) + IIF(L131 <= C AND C <= H131, C131, 0) + IIF(L132 <= C AND C <= H132, C132, 0) + IIF(L133 <= C AND C <= H133, C133, 0) + IIF(L134 <= C AND C <= H134, C134, 0) + IIF(L135 <= C AND C <= H135, C135, 0) + IIF(L136 <= C AND C <= H136, C136, 0) + IIF(L137 <= C AND C <= H137, C137, 0) + IIF(L138 <= C AND C <= H138, C138, 0) + IIF(L139 <= C AND C <= H139, C139, 0) + IIF(L140 <= C AND C <= H140, C140, 0) + IIF(L141 <= C AND C <= H141, C141, 0) + IIF(L142 <= C AND C <= H142, C142, 0) + IIF(L143 <= C AND C <= H143, C143, 0) + IIF(L144 <= C AND C <= H144, C144, 0) + IIF(L145 <= C AND C <= H145, C145, 0) + IIF(L146 <= C AND C <= H146, C146, 0) + IIF(L147 <= C AND C <= H147, C147, 0) + IIF(L148 <= C AND C <= H148, C148, 0) + IIF(L149 <= C AND C <= H149, C149, 0) + IIF(L150 <= C AND C <= H150, C150, 0) + IIF(L151 <= C AND C <= H151, C151, 0) + IIF(L152 <= C AND C <= H152, C152, 0) + IIF(L153 <= C AND C <= H153, C153, 0) + IIF(L154 <= C AND C <= H154, C154, 0) + IIF(L155 <= C AND C <= H155, C155, 0) + IIF(L156 <= C AND C <= H156, C156, 0) + IIF(L157 <= C AND C <= H157, C157, 0) + IIF(L158 <= C AND C <= H158, C158, 0) + IIF(L159 <= C AND C <= H159, C159, 0) + IIF(L160 <= C AND C <= H160, C160, 0) + IIF(L161 <= C AND C <= H161, C161, 0) + IIF(L162 <= C AND C <= H162, C162, 0) + IIF(L163 <= C AND C <= H163, C163, 0) + IIF(L164 <= C AND C <= H164, C164, 0) + IIF(L165 <= C AND C <= H165, C165, 0) + IIF(L166 <= C AND C <= H166, C166, 0) + IIF(L167 <= C AND C <= H167, C167, 0) + IIF(L168 <= C AND C <= H168, C168, 0) + IIF(L169 <= C AND C <= H169, C169, 0) + IIF(L170 <= C AND C <= H170, C170, 0) + IIF(L171 <= C AND C <= H171, C171, 0) + IIF(L172 <= C AND C <= H172, C172, 0) + IIF(L173 <= C AND C <= H173, C173, 0) + IIF(L174 <= C AND C <= H174, C174, 0) + IIF(L175 <= C AND C <= H175, C175, 0) + IIF(L176 <= C AND C <= H176, C176, 0) + IIF(L177 <= C AND C <= H177, C177, 0) + IIF(L178 <= C AND C <= H178, C178, 0) + IIF(L179 <= C AND C <= H179, C179, 0) + IIF(L180 <= C AND C <= H180, C180, 0) + IIF(L181 <= C AND C <= H181, C181, 0) + IIF(L182 <= C AND C <= H182, C182, 0) + IIF(L183 <= C AND C <= H183, C183, 0) + IIF(L184 <= C AND C <= H184, C184, 0) + IIF(L185 <= C AND C <= H185, C185, 0) + IIF(L186 <= C AND C <= H186, C186, 0) + IIF(L187 <= C AND C <= H187, C187, 0) + IIF(L188 <= C AND C <= H188, C188, 0) + IIF(L189 <= C AND C <= H189, C189, 0) + IIF(L190 <= C AND C <= H190, C190, 0) + IIF(L191 <= C AND C <= H191, C191, 0) + IIF(L192 <= C AND C <= H192, C192, 0) + IIF(L193 <= C AND C <= H193, C193, 0) + IIF(L194 <= C AND C <= H194, C194, 0) + IIF(L195 <= C AND C <= H195, C195, 0) + IIF(L196 <= C AND C <= H196, C196, 0) + IIF(L197 <= C AND C <= H197, C197, 0) + IIF(L198 <= C AND C <= H198, C198, 0) + IIF(L199 <= C AND C <= H199, C199, 0) + IIF(L200 <= C AND C <= H200, C200, 0)) / (IIF(L1 <= C AND C <= H1, 1, 0) + IIF(L2 <= C AND C <= H2, 1, 0) + IIF(L3 <= C AND C <= H3, 1, 0) + IIF(L4 <= C AND C <= H4, 1, 0) + IIF(L5 <= C AND C <= H5, 1, 0) + IIF(L6 <= C AND C <= H6, 1, 0) + IIF(L7 <= C AND C <= H7, 1, 0) + IIF(L8 <= C AND C <= H8, 1, 0) + IIF(L9 <= C AND C <= H9, 1, 0) + IIF(L10 <= C AND C <= H10, 1, 0) + IIF(L11 <= C AND C <= H11, 1, 0) + IIF(L12 <= C AND C <= H12, 1, 0) + IIF(L13 <= C AND C <= H13, 1, 0) + IIF(L14 <= C AND C <= H14, 1, 0) + IIF(L15 <= C AND C <= H15, 1, 0) + IIF(L16 <= C AND C <= H16, 1, 0) + IIF(L17 <= C AND C <= H17, 1, 0) + IIF(L18 <= C AND C <= H18, 1, 0) + IIF(L19 <= C AND C <= H19, 1, 0) + IIF(L20 <= C AND C <= H20, 1, 0) + IIF(L21 <= C AND C <= H21, 1, 0) + IIF(L22 <= C AND C <= H22, 1, 0) + IIF(L23 <= C AND C <= H23, 1, 0) + IIF(L24 <= C AND C <= H24, 1, 0) + IIF(L25 <= C AND C <= H25, 1, 0) + IIF(L26 <= C AND C <= H26, 1, 0) + IIF(L27 <= C AND C <= H27, 1, 0) + IIF(L28 <= C AND C <= H28, 1, 0) + IIF(L29 <= C AND C <= H29, 1, 0) + IIF(L30 <= C AND C <= H30, 1, 0) + IIF(L31 <= C AND C <= H31, 1, 0) + IIF(L32 <= C AND C <= H32, 1, 0) + IIF(L33 <= C AND C <= H33, 1, 0) + IIF(L34 <= C AND C <= H34, 1, 0) + IIF(L35 <= C AND C <= H35, 1, 0) + IIF(L36 <= C AND C <= H36, 1, 0) + IIF(L37 <= C AND C <= H37, 1, 0) + IIF(L38 <= C AND C <= H38, 1, 0) + IIF(L39 <= C AND C <= H39, 1, 0) + IIF(L40 <= C AND C <= H40, 1, 0) + IIF(L41 <= C AND C <= H41, 1, 0) + IIF(L42 <= C AND C <= H42, 1, 0) + IIF(L43 <= C AND C <= H43, 1, 0) + IIF(L44 <= C AND C <= H44, 1, 0) + IIF(L45 <= C AND C <= H45, 1, 0) + IIF(L46 <= C AND C <= H46, 1, 0) + IIF(L47 <= C AND C <= H47, 1, 0) + IIF(L48 <= C AND C <= H48, 1, 0) + IIF(L49 <= C AND C <= H49, 1, 0) + IIF(L50 <= C AND C <= H50, 1, 0) + IIF(L51 <= C AND C <= H51, 1, 0) + IIF(L52 <= C AND C <= H52, 1, 0) + IIF(L53 <= C AND C <= H53, 1, 0) + IIF(L54 <= C AND C <= H54, 1, 0) + IIF(L55 <= C AND C <= H55, 1, 0) + IIF(L56 <= C AND C <= H56, 1, 0) + IIF(L57 <= C AND C <= H57, 1, 0) + IIF(L58 <= C AND C <= H58, 1, 0) + IIF(L59 <= C AND C <= H59, 1, 0) + IIF(L60 <= C AND C <= H60, 1, 0) + IIF(L61 <= C AND C <= H61, 1, 0) + IIF(L62 <= C AND C <= H62, 1, 0) + IIF(L63 <= C AND C <= H63, 1, 0) + IIF(L64 <= C AND C <= H64, 1, 0) + IIF(L65 <= C AND C <= H65, 1, 0) + IIF(L66 <= C AND C <= H66, 1, 0) + IIF(L67 <= C AND C <= H67, 1, 0) + IIF(L68 <= C AND C <= H68, 1, 0) + IIF(L69 <= C AND C <= H69, 1, 0) + IIF(L70 <= C AND C <= H70, 1, 0) + IIF(L71 <= C AND C <= H71, 1, 0) + IIF(L72 <= C AND C <= H72, 1, 0) + IIF(L73 <= C AND C <= H73, 1, 0) + IIF(L74 <= C AND C <= H74, 1, 0) + IIF(L75 <= C AND C <= H75, 1, 0) + IIF(L76 <= C AND C <= H76, 1, 0) + IIF(L77 <= C AND C <= H77, 1, 0) + IIF(L78 <= C AND C <= H78, 1, 0) + IIF(L79 <= C AND C <= H79, 1, 0) + IIF(L80 <= C AND C <= H80, 1, 0) + IIF(L81 <= C AND C <= H81, 1, 0) + IIF(L82 <= C AND C <= H82, 1, 0) + IIF(L83 <= C AND C <= H83, 1, 0) + IIF(L84 <= C AND C <= H84, 1, 0) + IIF(L85 <= C AND C <= H85, 1, 0) + IIF(L86 <= C AND C <= H86, 1, 0) + IIF(L87 <= C AND C <= H87, 1, 0) + IIF(L88 <= C AND C <= H88, 1, 0) + IIF(L89 <= C AND C <= H89, 1, 0) + IIF(L90 <= C AND C <= H90, 1, 0) + IIF(L91 <= C AND C <= H91, 1, 0) + IIF(L92 <= C AND C <= H92, 1, 0) + IIF(L93 <= C AND C <= H93, 1, 0) + IIF(L94 <= C AND C <= H94, 1, 0) + IIF(L95 <= C AND C <= H95, 1, 0) + IIF(L96 <= C AND C <= H96, 1, 0) + IIF(L97 <= C AND C <= H97, 1, 0) + IIF(L98 <= C AND C <= H98, 1, 0) + IIF(L99 <= C AND C <= H99, 1, 0) + IIF(L100 <= C AND C <= H100, 1, 0) + IIF(L101 <= C AND C <= H101, 1, 0) + IIF(L102 <= C AND C <= H102, 1, 0) + IIF(L103 <= C AND C <= H103, 1, 0) + IIF(L104 <= C AND C <= H104, 1, 0) + IIF(L105 <= C AND C <= H105, 1, 0) + IIF(L106 <= C AND C <= H106, 1, 0) + IIF(L107 <= C AND C <= H107, 1, 0) + IIF(L108 <= C AND C <= H108, 1, 0) + IIF(L109 <= C AND C <= H109, 1, 0) + IIF(L110 <= C AND C <= H110, 1, 0) + IIF(L111 <= C AND C <= H111, 1, 0) + IIF(L112 <= C AND C <= H112, 1, 0) + IIF(L113 <= C AND C <= H113, 1, 0) + IIF(L114 <= C AND C <= H114, 1, 0) + IIF(L115 <= C AND C <= H115, 1, 0) + IIF(L116 <= C AND C <= H116, 1, 0) + IIF(L117 <= C AND C <= H117, 1, 0) + IIF(L118 <= C AND C <= H118, 1, 0) + IIF(L119 <= C AND C <= H119, 1, 0) + IIF(L120 <= C AND C <= H120, 1, 0) + IIF(L121 <= C AND C <= H121, 1, 0) + IIF(L122 <= C AND C <= H122, 1, 0) + IIF(L123 <= C AND C <= H123, 1, 0) + IIF(L124 <= C AND C <= H124, 1, 0) + IIF(L125 <= C AND C <= H125, 1, 0) + IIF(L126 <= C AND C <= H126, 1, 0) + IIF(L127 <= C AND C <= H127, 1, 0) + IIF(L128 <= C AND C <= H128, 1, 0) + IIF(L129 <= C AND C <= H129, 1, 0) + IIF(L130 <= C AND C <= H130, 1, 0) + IIF(L131 <= C AND C <= H131, 1, 0) + IIF(L132 <= C AND C <= H132, 1, 0) + IIF(L133 <= C AND C <= H133, 1, 0) + IIF(L134 <= C AND C <= H134, 1, 0) + IIF(L135 <= C AND C <= H135, 1, 0) + IIF(L136 <= C AND C <= H136, 1, 0) + IIF(L137 <= C AND C <= H137, 1, 0) + IIF(L138 <= C AND C <= H138, 1, 0) + IIF(L139 <= C AND C <= H139, 1, 0) + IIF(L140 <= C AND C <= H140, 1, 0) + IIF(L141 <= C AND C <= H141, 1, 0) + IIF(L142 <= C AND C <= H142, 1, 0) + IIF(L143 <= C AND C <= H143, 1, 0) + IIF(L144 <= C AND C <= H144, 1, 0) + IIF(L145 <= C AND C <= H145, 1, 0) + IIF(L146 <= C AND C <= H146, 1, 0) + IIF(L147 <= C AND C <= H147, 1, 0) + IIF(L148 <= C AND C <= H148, 1, 0) + IIF(L149 <= C AND C <= H149, 1, 0) + IIF(L150 <= C AND C <= H150, 1, 0) + IIF(L151 <= C AND C <= H151, 1, 0) + IIF(L152 <= C AND C <= H152, 1, 0) + IIF(L153 <= C AND C <= H153, 1, 0) + IIF(L154 <= C AND C <= H154, 1, 0) + IIF(L155 <= C AND C <= H155, 1, 0) + IIF(L156 <= C AND C <= H156, 1, 0) + IIF(L157 <= C AND C <= H157, 1, 0) + IIF(L158 <= C AND C <= H158, 1, 0) + IIF(L159 <= C AND C <= H159, 1, 0) + IIF(L160 <= C AND C <= H160, 1, 0) + IIF(L161 <= C AND C <= H161, 1, 0) + IIF(L162 <= C AND C <= H162, 1, 0) + IIF(L163 <= C AND C <= H163, 1, 0) + IIF(L164 <= C AND C <= H164, 1, 0) + IIF(L165 <= C AND C <= H165, 1, 0) + IIF(L166 <= C AND C <= H166, 1, 0) + IIF(L167 <= C AND C <= H167, 1, 0) + IIF(L168 <= C AND C <= H168, 1, 0) + IIF(L169 <= C AND C <= H169, 1, 0) + IIF(L170 <= C AND C <= H170, 1, 0) + IIF(L171 <= C AND C <= H171, 1, 0) + IIF(L172 <= C AND C <= H172, 1, 0) + IIF(L173 <= C AND C <= H173, 1, 0) + IIF(L174 <= C AND C <= H174, 1, 0) + IIF(L175 <= C AND C <= H175, 1, 0) + IIF(L176 <= C AND C <= H176, 1, 0) + IIF(L177 <= C AND C <= H177, 1, 0) + IIF(L178 <= C AND C <= H178, 1, 0) + IIF(L179 <= C AND C <= H179, 1, 0) + IIF(L180 <= C AND C <= H180, 1, 0) + IIF(L181 <= C AND C <= H181, 1, 0) + IIF(L182 <= C AND C <= H182, 1, 0) + IIF(L183 <= C AND C <= H183, 1, 0) + IIF(L184 <= C AND C <= H184, 1, 0) + IIF(L185 <= C AND C <= H185, 1, 0) + IIF(L186 <= C AND C <= H186, 1, 0) + IIF(L187 <= C AND C <= H187, 1, 0) + IIF(L188 <= C AND C <= H188, 1, 0) + IIF(L189 <= C AND C <= H189, 1, 0) + IIF(L190 <= C AND C <= H190, 1, 0) + IIF(L191 <= C AND C <= H191, 1, 0) + IIF(L192 <= C AND C <= H192, 1, 0) + IIF(L193 <= C AND C <= H193, 1, 0) + IIF(L194 <= C AND C <= H194, 1, 0) + IIF(L195 <= C AND C <= H195, 1, 0) + IIF(L196 <= C AND C <= H196, 1, 0) + IIF(L197 <= C AND C <= H197, 1, 0) + IIF(L198 <= C AND C <= H198, 1, 0) + IIF(L199 <= C AND C <= H199, 1, 0) + IIF(L200 <= C AND C <= H200, 1, 0))`

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
stockscience
 Posted : Monday, July 23, 2018 12:13:01 PM
Registered User
Joined: 6/26/2011
Posts: 128

Hi Bruce:

I am interested in a PCF which counts the number of  previous bars  (up to 200) whose high is within  5 percent ATR20.0 of the current high.

Similarly for lows versus low...

Bruce_L
 Posted : Monday, July 23, 2018 1:11:28 PM

Worden Trainer

Joined: 10/7/2004
Posts: 65,138

I am going to assume "whose high is within 5 percent ATR20.0 of the current high" is missing an "of" between percent and ATR20.0.

`IIF(ABS(H - H1) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H2) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H3) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H4) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H5) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H6) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H7) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H8) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H9) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H10) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H11) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H12) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H13) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H14) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H15) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H16) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H17) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H18) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H19) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H20) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H21) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H22) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H23) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H24) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H25) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H26) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H27) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H28) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H29) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H30) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H31) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H32) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H33) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H34) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H35) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H36) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H37) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H38) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H39) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H40) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H41) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H42) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H43) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H44) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H45) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H46) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H47) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H48) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H49) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H50) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H51) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H52) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H53) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H54) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H55) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H56) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H57) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H58) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H59) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H60) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H61) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H62) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H63) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H64) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H65) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H66) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H67) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H68) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H69) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H70) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H71) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H72) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H73) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H74) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H75) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H76) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H77) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H78) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H79) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H80) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H81) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H82) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H83) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H84) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H85) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H86) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H87) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H88) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H89) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H90) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H91) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H92) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H93) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H94) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H95) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H96) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H97) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H98) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H99) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H100) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H101) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H102) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H103) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H104) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H105) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H106) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H107) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H108) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H109) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H110) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H111) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H112) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H113) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H114) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H115) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H116) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H117) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H118) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H119) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H120) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H121) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H122) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H123) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H124) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H125) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H126) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H127) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H128) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H129) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H130) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H131) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H132) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H133) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H134) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H135) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H136) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H137) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H138) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H139) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H140) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H141) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H142) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H143) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H144) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H145) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H146) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H147) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H148) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H149) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H150) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H151) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H152) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H153) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H154) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H155) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H156) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H157) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H158) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H159) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H160) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H161) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H162) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H163) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H164) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H165) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H166) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H167) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H168) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H169) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H170) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H171) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H172) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H173) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H174) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H175) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H176) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H177) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H178) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H179) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H180) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H181) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H182) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H183) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H184) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H185) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H186) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H187) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H188) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H189) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H190) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H191) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H192) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H193) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H194) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H195) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H196) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H197) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H198) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H199) <= ATR20 / 20, 1, 0) + IIF(ABS(H - H200) <= ATR20 / 20, 1, 0) `

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
stockscience
 Posted : Monday, July 23, 2018 1:57:04 PM
Registered User
Joined: 6/26/2011
Posts: 128

Thanks!

Bruce_L
 Posted : Monday, July 23, 2018 1:57:42 PM

Worden Trainer

Joined: 10/7/2004
Posts: 65,138

You're welcome.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Users browsing this topic
Guest-1

 Forum Jump Customer Training & Support - Ask a Trainer - TC2000 version 12/18 - Ask a Trainer - TC2000 version 7 - Ask a Trainer - StockFinder 5.0 - PCFs, EasyScan and Custom Indicators General Discussions - Stock and Market Talk - TC2000 version 12 or 18 - TC2000 version 7 - StockFinder 5.0 - RealCode for StockFinder 5.0 Tutorial Videos - TC2000 version 12 tutorial videos - TC2000 version 7 tutorial videos You cannot post new topics in this forum. You cannot reply to topics in this forum. You cannot delete your posts in this forum. You cannot edit your posts in this forum. You cannot create polls in this forum. You cannot vote in polls in this forum.