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 |

days counter for indicator Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
mdbecker5
Posted : Monday, June 3, 2013 1:42:23 PM
Registered User
Joined: 12/6/2011
Posts: 13

Need a formula for a day counter for a indicator shown on a columne . Example: how many days has ibm been above the 50sma daily.

 

Bruce_L
Posted : Monday, June 3, 2013 1:57:35 PM


Worden Trainer

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

The Days Since Last Peak (or other day-counting needs) topic demonstrates a technique for doing this using the Personal Criteria Formula Language, but the Indicator Formulas produced can be quite long and cover a limited number of days.

An Indicator Formula which which counts how many bars price has been above its own 50-period simple moving average that maxes out at 227 bars could be written as (note that checking for fewer possible bars in a row could dramatically improve the performance of the WatchList Column and allow you to calculate the formula for symbols with less data): 

ABS(C > AVGC50) * (ABS(C1 <= AVGC50.1) + ABS(C1 > AVGC50.1) * (ABS(C2 <= AVGC50.2) * 2 + ABS(C2 > AVGC50.2) * (ABS(C3 <= AVGC50.3) * 3 + ABS(C3 > AVGC50.3) * (ABS(C4 <= AVGC50.4) * 4 + ABS(C4 > AVGC50.4) * (ABS(C5 <= AVGC50.5) * 5 + ABS(C5 > AVGC50.5) * (ABS(C6 <= AVGC50.6) * 6 + ABS(C6 > AVGC50.6) * (ABS(C7 <= AVGC50.7) * 7 + ABS(C7 > AVGC50.7) * (ABS(C8 <= AVGC50.8) * 8 + ABS(C8 > AVGC50.8) * (ABS(C9 <= AVGC50.9) * 9 + ABS(C9 > AVGC50.9) * (ABS(C10 <= AVGC50.10) * 10 + ABS(C10 > AVGC50.10) * (ABS(C11 <= AVGC50.11) * 11 + ABS(C11 > AVGC50.11) * (ABS(C12 <= AVGC50.12) * 12 + ABS(C12 > AVGC50.12) * (ABS(C13 <= AVGC50.13) * 13 + ABS(C13 > AVGC50.13) * (ABS(C14 <= AVGC50.14) * 14 + ABS(C14 > AVGC50.14) * (ABS(C15 <= AVGC50.15) * 15 + ABS(C15 > AVGC50.15) * (ABS(C16 <= AVGC50.16) * 16 + ABS(C16 > AVGC50.16) * (ABS(C17 <= AVGC50.17) * 17 + ABS(C17 > AVGC50.17) * (ABS(C18 <= AVGC50.18) * 18 + ABS(C18 > AVGC50.18) * (ABS(C19 <= AVGC50.19) * 19 + ABS(C19 > AVGC50.19) * (ABS(C20 <= AVGC50.20) * 20 + ABS(C20 > AVGC50.20) * (ABS(C21 <= AVGC50.21) * 21 + ABS(C21 > AVGC50.21) * (ABS(C22 <= AVGC50.22) * 22 + ABS(C22 > AVGC50.22) * (ABS(C23 <= AVGC50.23) * 23 + ABS(C23 > AVGC50.23) * (ABS(C24 <= AVGC50.24) * 24 + ABS(C24 > AVGC50.24) * (ABS(C25 <= AVGC50.25) * 25 + ABS(C25 > AVGC50.25) * (ABS(C26 <= AVGC50.26) * 26 + ABS(C26 > AVGC50.26) * (ABS(C27 <= AVGC50.27) * 27 + ABS(C27 > AVGC50.27) * (ABS(C28 <= AVGC50.28) * 28 + ABS(C28 > AVGC50.28) * (ABS(C29 <= AVGC50.29) * 29 + ABS(C29 > AVGC50.29) * (ABS(C30 <= AVGC50.30) * 30 + ABS(C30 > AVGC50.30) * (ABS(C31 <= AVGC50.31) * 31 + ABS(C31 > AVGC50.31) * (ABS(C32 <= AVGC50.32) * 32 + ABS(C32 > AVGC50.32) * (ABS(C33 <= AVGC50.33) * 33 + ABS(C33 > AVGC50.33) * (ABS(C34 <= AVGC50.34) * 34 + ABS(C34 > AVGC50.34) * (ABS(C35 <= AVGC50.35) * 35 + ABS(C35 > AVGC50.35) * (ABS(C36 <= AVGC50.36) * 36 + ABS(C36 > AVGC50.36) * (ABS(C37 <= AVGC50.37) * 37 + ABS(C37 > AVGC50.37) * (ABS(C38 <= AVGC50.38) * 38 + ABS(C38 > AVGC50.38) * (ABS(C39 <= AVGC50.39) * 39 + ABS(C39 > AVGC50.39) * (ABS(C40 <= AVGC50.40) * 40 + ABS(C40 > AVGC50.40) * (ABS(C41 <= AVGC50.41) * 41 + ABS(C41 > AVGC50.41) * (ABS(C42 <= AVGC50.42) * 42 + ABS(C42 > AVGC50.42) * (ABS(C43 <= AVGC50.43) * 43 + ABS(C43 > AVGC50.43) * (ABS(C44 <= AVGC50.44) * 44 + ABS(C44 > AVGC50.44) * (ABS(C45 <= AVGC50.45) * 45 + ABS(C45 > AVGC50.45) * (ABS(C46 <= AVGC50.46) * 46 + ABS(C46 > AVGC50.46) * (ABS(C47 <= AVGC50.47) * 47 + ABS(C47 > AVGC50.47) * (ABS(C48 <= AVGC50.48) * 48 + ABS(C48 > AVGC50.48) * (ABS(C49 <= AVGC50.49) * 49 + ABS(C49 > AVGC50.49) * (ABS(C50 <= AVGC50.50) * 50 + ABS(C50 > AVGC50.50) * (ABS(C51 <= AVGC50.51) * 51 + ABS(C51 > AVGC50.51) * (ABS(C52 <= AVGC50.52) * 52 + ABS(C52 > AVGC50.52) * (ABS(C53 <= AVGC50.53) * 53 + ABS(C53 > AVGC50.53) * (ABS(C54 <= AVGC50.54) * 54 + ABS(C54 > AVGC50.54) * (ABS(C55 <= AVGC50.55) * 55 + ABS(C55 > AVGC50.55) * (ABS(C56 <= AVGC50.56) * 56 + ABS(C56 > AVGC50.56) * (ABS(C57 <= AVGC50.57) * 57 + ABS(C57 > AVGC50.57) * (ABS(C58 <= AVGC50.58) * 58 + ABS(C58 > AVGC50.58) * (ABS(C59 <= AVGC50.59) * 59 + ABS(C59 > AVGC50.59) * (ABS(C60 <= AVGC50.60) * 60 + ABS(C60 > AVGC50.60) * (ABS(C61 <= AVGC50.61) * 61 + ABS(C61 > AVGC50.61) * (ABS(C62 <= AVGC50.62) * 62 + ABS(C62 > AVGC50.62) * (ABS(C63 <= AVGC50.63) * 63 + ABS(C63 > AVGC50.63) * (ABS(C64 <= AVGC50.64) * 64 + ABS(C64 > AVGC50.64) * (ABS(C65 <= AVGC50.65) * 65 + ABS(C65 > AVGC50.65) * (ABS(C66 <= AVGC50.66) * 66 + ABS(C66 > AVGC50.66) * (ABS(C67 <= AVGC50.67) * 67 + ABS(C67 > AVGC50.67) * (ABS(C68 <= AVGC50.68) * 68 + ABS(C68 > AVGC50.68) * (ABS(C69 <= AVGC50.69) * 69 + ABS(C69 > AVGC50.69) * (ABS(C70 <= AVGC50.70) * 70 + ABS(C70 > AVGC50.70) * (ABS(C71 <= AVGC50.71) * 71 + ABS(C71 > AVGC50.71) * (ABS(C72 <= AVGC50.72) * 72 + ABS(C72 > AVGC50.72) * (ABS(C73 <= AVGC50.73) * 73 + ABS(C73 > AVGC50.73) * (ABS(C74 <= AVGC50.74) * 74 + ABS(C74 > AVGC50.74) * (ABS(C75 <= AVGC50.75) * 75 + ABS(C75 > AVGC50.75) * (ABS(C76 <= AVGC50.76) * 76 + ABS(C76 > AVGC50.76) * (ABS(C77 <= AVGC50.77) * 77 + ABS(C77 > AVGC50.77) * (ABS(C78 <= AVGC50.78) * 78 + ABS(C78 > AVGC50.78) * (ABS(C79 <= AVGC50.79) * 79 + ABS(C79 > AVGC50.79) * (ABS(C80 <= AVGC50.80) * 80 + ABS(C80 > AVGC50.80) * (ABS(C81 <= AVGC50.81) * 81 + ABS(C81 > AVGC50.81) * (ABS(C82 <= AVGC50.82) * 82 + ABS(C82 > AVGC50.82) * (ABS(C83 <= AVGC50.83) * 83 + ABS(C83 > AVGC50.83) * (ABS(C84 <= AVGC50.84) * 84 + ABS(C84 > AVGC50.84) * (ABS(C85 <= AVGC50.85) * 85 + ABS(C85 > AVGC50.85) * (ABS(C86 <= AVGC50.86) * 86 + ABS(C86 > AVGC50.86) * (ABS(C87 <= AVGC50.87) * 87 + ABS(C87 > AVGC50.87) * (ABS(C88 <= AVGC50.88) * 88 + ABS(C88 > AVGC50.88) * (ABS(C89 <= AVGC50.89) * 89 + ABS(C89 > AVGC50.89) * (ABS(C90 <= AVGC50.90) * 90 + ABS(C90 > AVGC50.90) * (ABS(C91 <= AVGC50.91) * 91 + ABS(C91 > AVGC50.91) * (ABS(C92 <= AVGC50.92) * 92 + ABS(C92 > AVGC50.92) * (ABS(C93 <= AVGC50.93) * 93 + ABS(C93 > AVGC50.93) * (ABS(C94 <= AVGC50.94) * 94 + ABS(C94 > AVGC50.94) * (ABS(C95 <= AVGC50.95) * 95 + ABS(C95 > AVGC50.95) * (ABS(C96 <= AVGC50.96) * 96 + ABS(C96 > AVGC50.96) * (ABS(C97 <= AVGC50.97) * 97 + ABS(C97 > AVGC50.97) * (ABS(C98 <= AVGC50.98) * 98 + ABS(C98 > AVGC50.98) * (ABS(C99 <= AVGC50.99) * 99 + ABS(C99 > AVGC50.99) * (ABS(C100 <= AVGC50.100) * 100 + ABS(C100 > AVGC50.100) * (ABS(C101 <= AVGC50.101) * 101 + ABS(C101 > AVGC50.101) * (ABS(C102 <= AVGC50.102) * 102 + ABS(C102 > AVGC50.102) * (ABS(C103 <= AVGC50.103) * 103 + ABS(C103 > AVGC50.103) * (ABS(C104 <= AVGC50.104) * 104 + ABS(C104 > AVGC50.104) * (ABS(C105 <= AVGC50.105) * 105 + ABS(C105 > AVGC50.105) * (ABS(C106 <= AVGC50.106) * 106 + ABS(C106 > AVGC50.106) * (ABS(C107 <= AVGC50.107) * 107 + ABS(C107 > AVGC50.107) * (ABS(C108 <= AVGC50.108) * 108 + ABS(C108 > AVGC50.108) * (ABS(C109 <= AVGC50.109) * 109 + ABS(C109 > AVGC50.109) * (ABS(C110 <= AVGC50.110) * 110 + ABS(C110 > AVGC50.110) * (ABS(C111 <= AVGC50.111) * 111 + ABS(C111 > AVGC50.111) * (ABS(C112 <= AVGC50.112) * 112 + ABS(C112 > AVGC50.112) * (ABS(C113 <= AVGC50.113) * 113 + ABS(C113 > AVGC50.113) * (ABS(C114 <= AVGC50.114) * 114 + ABS(C114 > AVGC50.114) * (ABS(C115 <= AVGC50.115) * 115 + ABS(C115 > AVGC50.115) * (ABS(C116 <= AVGC50.116) * 116 + ABS(C116 > AVGC50.116) * (ABS(C117 <= AVGC50.117) * 117 + ABS(C117 > AVGC50.117) * (ABS(C118 <= AVGC50.118) * 118 + ABS(C118 > AVGC50.118) * (ABS(C119 <= AVGC50.119) * 119 + ABS(C119 > AVGC50.119) * (ABS(C120 <= AVGC50.120) * 120 + ABS(C120 > AVGC50.120) * (ABS(C121 <= AVGC50.121) * 121 + ABS(C121 > AVGC50.121) * (ABS(C122 <= AVGC50.122) * 122 + ABS(C122 > AVGC50.122) * (ABS(C123 <= AVGC50.123) * 123 + ABS(C123 > AVGC50.123) * (ABS(C124 <= AVGC50.124) * 124 + ABS(C124 > AVGC50.124) * (ABS(C125 <= AVGC50.125) * 125 + ABS(C125 > AVGC50.125) * (ABS(C126 <= AVGC50.126) * 126 + ABS(C126 > AVGC50.126) * (ABS(C127 <= AVGC50.127) * 127 + ABS(C127 > AVGC50.127) * (ABS(C128 <= AVGC50.128) * 128 + ABS(C128 > AVGC50.128) * (ABS(C129 <= AVGC50.129) * 129 + ABS(C129 > AVGC50.129) * (ABS(C130 <= AVGC50.130) * 130 + ABS(C130 > AVGC50.130) * (ABS(C131 <= AVGC50.131) * 131 + ABS(C131 > AVGC50.131) * (ABS(C132 <= AVGC50.132) * 132 + ABS(C132 > AVGC50.132) * (ABS(C133 <= AVGC50.133) * 133 + ABS(C133 > AVGC50.133) * (ABS(C134 <= AVGC50.134) * 134 + ABS(C134 > AVGC50.134) * (ABS(C135 <= AVGC50.135) * 135 + ABS(C135 > AVGC50.135) * (ABS(C136 <= AVGC50.136) * 136 + ABS(C136 > AVGC50.136) * (ABS(C137 <= AVGC50.137) * 137 + ABS(C137 > AVGC50.137) * (ABS(C138 <= AVGC50.138) * 138 + ABS(C138 > AVGC50.138) * (ABS(C139 <= AVGC50.139) * 139 + ABS(C139 > AVGC50.139) * (ABS(C140 <= AVGC50.140) * 140 + ABS(C140 > AVGC50.140) * (ABS(C141 <= AVGC50.141) * 141 + ABS(C141 > AVGC50.141) * (ABS(C142 <= AVGC50.142) * 142 + ABS(C142 > AVGC50.142) * (ABS(C143 <= AVGC50.143) * 143 + ABS(C143 > AVGC50.143) * (ABS(C144 <= AVGC50.144) * 144 + ABS(C144 > AVGC50.144) * (ABS(C145 <= AVGC50.145) * 145 + ABS(C145 > AVGC50.145) * (ABS(C146 <= AVGC50.146) * 146 + ABS(C146 > AVGC50.146) * (ABS(C147 <= AVGC50.147) * 147 + ABS(C147 > AVGC50.147) * (ABS(C148 <= AVGC50.148) * 148 + ABS(C148 > AVGC50.148) * (ABS(C149 <= AVGC50.149) * 149 + ABS(C149 > AVGC50.149) * (ABS(C150 <= AVGC50.150) * 150 + ABS(C150 > AVGC50.150) * (ABS(C151 <= AVGC50.151) * 151 + ABS(C151 > AVGC50.151) * (ABS(C152 <= AVGC50.152) * 152 + ABS(C152 > AVGC50.152) * (ABS(C153 <= AVGC50.153) * 153 + ABS(C153 > AVGC50.153) * (ABS(C154 <= AVGC50.154) * 154 + ABS(C154 > AVGC50.154) * (ABS(C155 <= AVGC50.155) * 155 + ABS(C155 > AVGC50.155) * (ABS(C156 <= AVGC50.156) * 156 + ABS(C156 > AVGC50.156) * (ABS(C157 <= AVGC50.157) * 157 + ABS(C157 > AVGC50.157) * (ABS(C158 <= AVGC50.158) * 158 + ABS(C158 > AVGC50.158) * (ABS(C159 <= AVGC50.159) * 159 + ABS(C159 > AVGC50.159) * (ABS(C160 <= AVGC50.160) * 160 + ABS(C160 > AVGC50.160) * (ABS(C161 <= AVGC50.161) * 161 + ABS(C161 > AVGC50.161) * (ABS(C162 <= AVGC50.162) * 162 + ABS(C162 > AVGC50.162) * (ABS(C163 <= AVGC50.163) * 163 + ABS(C163 > AVGC50.163) * (ABS(C164 <= AVGC50.164) * 164 + ABS(C164 > AVGC50.164) * (ABS(C165 <= AVGC50.165) * 165 + ABS(C165 > AVGC50.165) * (ABS(C166 <= AVGC50.166) * 166 + ABS(C166 > AVGC50.166) * (ABS(C167 <= AVGC50.167) * 167 + ABS(C167 > AVGC50.167) * (ABS(C168 <= AVGC50.168) * 168 + ABS(C168 > AVGC50.168) * (ABS(C169 <= AVGC50.169) * 169 + ABS(C169 > AVGC50.169) * (ABS(C170 <= AVGC50.170) * 170 + ABS(C170 > AVGC50.170) * (ABS(C171 <= AVGC50.171) * 171 + ABS(C171 > AVGC50.171) * (ABS(C172 <= AVGC50.172) * 172 + ABS(C172 > AVGC50.172) * (ABS(C173 <= AVGC50.173) * 173 + ABS(C173 > AVGC50.173) * (ABS(C174 <= AVGC50.174) * 174 + ABS(C174 > AVGC50.174) * (ABS(C175 <= AVGC50.175) * 175 + ABS(C175 > AVGC50.175) * (ABS(C176 <= AVGC50.176) * 176 + ABS(C176 > AVGC50.176) * (ABS(C177 <= AVGC50.177) * 177 + ABS(C177 > AVGC50.177) * (ABS(C178 <= AVGC50.178) * 178 + ABS(C178 > AVGC50.178) * (ABS(C179 <= AVGC50.179) * 179 + ABS(C179 > AVGC50.179) * (ABS(C180 <= AVGC50.180) * 180 + ABS(C180 > AVGC50.180) * (ABS(C181 <= AVGC50.181) * 181 + ABS(C181 > AVGC50.181) * (ABS(C182 <= AVGC50.182) * 182 + ABS(C182 > AVGC50.182) * (ABS(C183 <= AVGC50.183) * 183 + ABS(C183 > AVGC50.183) * (ABS(C184 <= AVGC50.184) * 184 + ABS(C184 > AVGC50.184) * (ABS(C185 <= AVGC50.185) * 185 + ABS(C185 > AVGC50.185) * (ABS(C186 <= AVGC50.186) * 186 + ABS(C186 > AVGC50.186) * (ABS(C187 <= AVGC50.187) * 187 + ABS(C187 > AVGC50.187) * (ABS(C188 <= AVGC50.188) * 188 + ABS(C188 > AVGC50.188) * (ABS(C189 <= AVGC50.189) * 189 + ABS(C189 > AVGC50.189) * (ABS(C190 <= AVGC50.190) * 190 + ABS(C190 > AVGC50.190) * (ABS(C191 <= AVGC50.191) * 191 + ABS(C191 > AVGC50.191) * (ABS(C192 <= AVGC50.192) * 192 + ABS(C192 > AVGC50.192) * (ABS(C193 <= AVGC50.193) * 193 + ABS(C193 > AVGC50.193) * (ABS(C194 <= AVGC50.194) * 194 + ABS(C194 > AVGC50.194) * (ABS(C195 <= AVGC50.195) * 195 + ABS(C195 > AVGC50.195) * (ABS(C196 <= AVGC50.196) * 196 + ABS(C196 > AVGC50.196) * (ABS(C197 <= AVGC50.197) * 197 + ABS(C197 > AVGC50.197) * (ABS(C198 <= AVGC50.198) * 198 + ABS(C198 > AVGC50.198) * (ABS(C199 <= AVGC50.199) * 199 + ABS(C199 > AVGC50.199) * (ABS(C200 <= AVGC50.200) * 200 + ABS(C200 > AVGC50.200) * (ABS(C201 <= AVGC50.201) * 201 + ABS(C201 > AVGC50.201) * (ABS(C202 <= AVGC50.202) * 202 + ABS(C202 > AVGC50.202) * (ABS(C203 <= AVGC50.203) * 203 + ABS(C203 > AVGC50.203) * (ABS(C204 <= AVGC50.204) * 204 + ABS(C204 > AVGC50.204) * (ABS(C205 <= AVGC50.205) * 205 + ABS(C205 > AVGC50.205) * (ABS(C206 <= AVGC50.206) * 206 + ABS(C206 > AVGC50.206) * (ABS(C207 <= AVGC50.207) * 207 + ABS(C207 > AVGC50.207) * (ABS(C208 <= AVGC50.208) * 208 + ABS(C208 > AVGC50.208) * (ABS(C209 <= AVGC50.209) * 209 + ABS(C209 > AVGC50.209) * (ABS(C210 <= AVGC50.210) * 210 + ABS(C210 > AVGC50.210) * (ABS(C211 <= AVGC50.211) * 211 + ABS(C211 > AVGC50.211) * (ABS(C212 <= AVGC50.212) * 212 + ABS(C212 > AVGC50.212) * (ABS(C213 <= AVGC50.213) * 213 + ABS(C213 > AVGC50.213) * (ABS(C214 <= AVGC50.214) * 214 + ABS(C214 > AVGC50.214) * (ABS(C215 <= AVGC50.215) * 215 + ABS(C215 > AVGC50.215) * (ABS(C216 <= AVGC50.216) * 216 + ABS(C216 > AVGC50.216) * (ABS(C217 <= AVGC50.217) * 217 + ABS(C217 > AVGC50.217) * (ABS(C218 <= AVGC50.218) * 218 + ABS(C218 > AVGC50.218) * (ABS(C219 <= AVGC50.219) * 219 + ABS(C219 > AVGC50.219) * (ABS(C220 <= AVGC50.220) * 220 + ABS(C220 > AVGC50.220) * (ABS(C221 <= AVGC50.221) * 221 + ABS(C221 > AVGC50.221) * (ABS(C222 <= AVGC50.222) * 222 + ABS(C222 > AVGC50.222) * (ABS(C223 <= AVGC50.223) * 223 + ABS(C223 > AVGC50.223) * (ABS(C224 <= AVGC50.224) * 224 + ABS(C224 > AVGC50.224) * (ABS(C225 <= AVGC50.225) * 225 + ABS(C225 > AVGC50.225) * (ABS(C226 <= AVGC50.226) * 226 + ABS(C226 > AVGC50.226) * 227))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))

Adding & Editing WatchList Columns



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
mdbecker5
Posted : Monday, June 3, 2013 2:35:42 PM
Registered User
Joined: 12/6/2011
Posts: 13

How about under 50 need a maxof days 60, and the same above over 200 too much

Bruce_L
Posted : Monday, June 3, 2013 2:48:38 PM


Worden Trainer

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

The number of bars above 50 shortened to a maximum of 60 bars could be written as:

ABS(C > AVGC50) * (ABS(C1 <= AVGC50.1) + ABS(C1 > AVGC50.1) * (ABS(C2 <= AVGC50.2) * 2 + ABS(C2 > AVGC50.2) * (ABS(C3 <= AVGC50.3) * 3 + ABS(C3 > AVGC50.3) * (ABS(C4 <= AVGC50.4) * 4 + ABS(C4 > AVGC50.4) * (ABS(C5 <= AVGC50.5) * 5 + ABS(C5 > AVGC50.5) * (ABS(C6 <= AVGC50.6) * 6 + ABS(C6 > AVGC50.6) * (ABS(C7 <= AVGC50.7) * 7 + ABS(C7 > AVGC50.7) * (ABS(C8 <= AVGC50.8) * 8 + ABS(C8 > AVGC50.8) * (ABS(C9 <= AVGC50.9) * 9 + ABS(C9 > AVGC50.9) * (ABS(C10 <= AVGC50.10) * 10 + ABS(C10 > AVGC50.10) * (ABS(C11 <= AVGC50.11) * 11 + ABS(C11 > AVGC50.11) * (ABS(C12 <= AVGC50.12) * 12 + ABS(C12 > AVGC50.12) * (ABS(C13 <= AVGC50.13) * 13 + ABS(C13 > AVGC50.13) * (ABS(C14 <= AVGC50.14) * 14 + ABS(C14 > AVGC50.14) * (ABS(C15 <= AVGC50.15) * 15 + ABS(C15 > AVGC50.15) * (ABS(C16 <= AVGC50.16) * 16 + ABS(C16 > AVGC50.16) * (ABS(C17 <= AVGC50.17) * 17 + ABS(C17 > AVGC50.17) * (ABS(C18 <= AVGC50.18) * 18 + ABS(C18 > AVGC50.18) * (ABS(C19 <= AVGC50.19) * 19 + ABS(C19 > AVGC50.19) * (ABS(C20 <= AVGC50.20) * 20 + ABS(C20 > AVGC50.20) * (ABS(C21 <= AVGC50.21) * 21 + ABS(C21 > AVGC50.21) * (ABS(C22 <= AVGC50.22) * 22 + ABS(C22 > AVGC50.22) * (ABS(C23 <= AVGC50.23) * 23 + ABS(C23 > AVGC50.23) * (ABS(C24 <= AVGC50.24) * 24 + ABS(C24 > AVGC50.24) * (ABS(C25 <= AVGC50.25) * 25 + ABS(C25 > AVGC50.25) * (ABS(C26 <= AVGC50.26) * 26 + ABS(C26 > AVGC50.26) * (ABS(C27 <= AVGC50.27) * 27 + ABS(C27 > AVGC50.27) * (ABS(C28 <= AVGC50.28) * 28 + ABS(C28 > AVGC50.28) * (ABS(C29 <= AVGC50.29) * 29 + ABS(C29 > AVGC50.29) * (ABS(C30 <= AVGC50.30) * 30 + ABS(C30 > AVGC50.30) * (ABS(C31 <= AVGC50.31) * 31 + ABS(C31 > AVGC50.31) * (ABS(C32 <= AVGC50.32) * 32 + ABS(C32 > AVGC50.32) * (ABS(C33 <= AVGC50.33) * 33 + ABS(C33 > AVGC50.33) * (ABS(C34 <= AVGC50.34) * 34 + ABS(C34 > AVGC50.34) * (ABS(C35 <= AVGC50.35) * 35 + ABS(C35 > AVGC50.35) * (ABS(C36 <= AVGC50.36) * 36 + ABS(C36 > AVGC50.36) * (ABS(C37 <= AVGC50.37) * 37 + ABS(C37 > AVGC50.37) * (ABS(C38 <= AVGC50.38) * 38 + ABS(C38 > AVGC50.38) * (ABS(C39 <= AVGC50.39) * 39 + ABS(C39 > AVGC50.39) * (ABS(C40 <= AVGC50.40) * 40 + ABS(C40 > AVGC50.40) * (ABS(C41 <= AVGC50.41) * 41 + ABS(C41 > AVGC50.41) * (ABS(C42 <= AVGC50.42) * 42 + ABS(C42 > AVGC50.42) * (ABS(C43 <= AVGC50.43) * 43 + ABS(C43 > AVGC50.43) * (ABS(C44 <= AVGC50.44) * 44 + ABS(C44 > AVGC50.44) * (ABS(C45 <= AVGC50.45) * 45 + ABS(C45 > AVGC50.45) * (ABS(C46 <= AVGC50.46) * 46 + ABS(C46 > AVGC50.46) * (ABS(C47 <= AVGC50.47) * 47 + ABS(C47 > AVGC50.47) * (ABS(C48 <= AVGC50.48) * 48 + ABS(C48 > AVGC50.48) * (ABS(C49 <= AVGC50.49) * 49 + ABS(C49 > AVGC50.49) * (ABS(C50 <= AVGC50.50) * 50 + ABS(C50 > AVGC50.50) * (ABS(C51 <= AVGC50.51) * 51 + ABS(C51 > AVGC50.51) * (ABS(C52 <= AVGC50.52) * 52 + ABS(C52 > AVGC50.52) * (ABS(C53 <= AVGC50.53) * 53 + ABS(C53 > AVGC50.53) * (ABS(C54 <= AVGC50.54) * 54 + ABS(C54 > AVGC50.54) * (ABS(C55 <= AVGC50.55) * 55 + ABS(C55 > AVGC50.55) * (ABS(C56 <= AVGC50.56) * 56 + ABS(C56 > AVGC50.56) * (ABS(C57 <= AVGC50.57) * 57 + ABS(C57 > AVGC50.57) * (ABS(C58 <= AVGC50.58) * 58 + ABS(C58 > AVGC50.58) * (ABS(C59 <= AVGC50.59) * 59 + ABS(C59 > AVGC50.59) * 60)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))

The number of bars below SMA50 with a maximum value of 60 reverses all of the > and < signs in the formula:

ABS(C < AVGC50) * (ABS(C1 >= AVGC50.1) + ABS(C1 < AVGC50.1) * (ABS(C2 >= AVGC50.2) * 2 + ABS(C2 < AVGC50.2) * (ABS(C3 >= AVGC50.3) * 3 + ABS(C3 < AVGC50.3) * (ABS(C4 >= AVGC50.4) * 4 + ABS(C4 < AVGC50.4) * (ABS(C5 >= AVGC50.5) * 5 + ABS(C5 < AVGC50.5) * (ABS(C6 >= AVGC50.6) * 6 + ABS(C6 < AVGC50.6) * (ABS(C7 >= AVGC50.7) * 7 + ABS(C7 < AVGC50.7) * (ABS(C8 >= AVGC50.8) * 8 + ABS(C8 < AVGC50.8) * (ABS(C9 >= AVGC50.9) * 9 + ABS(C9 < AVGC50.9) * (ABS(C10 >= AVGC50.10) * 10 + ABS(C10 < AVGC50.10) * (ABS(C11 >= AVGC50.11) * 11 + ABS(C11 < AVGC50.11) * (ABS(C12 >= AVGC50.12) * 12 + ABS(C12 < AVGC50.12) * (ABS(C13 >= AVGC50.13) * 13 + ABS(C13 < AVGC50.13) * (ABS(C14 >= AVGC50.14) * 14 + ABS(C14 < AVGC50.14) * (ABS(C15 >= AVGC50.15) * 15 + ABS(C15 < AVGC50.15) * (ABS(C16 >= AVGC50.16) * 16 + ABS(C16 < AVGC50.16) * (ABS(C17 >= AVGC50.17) * 17 + ABS(C17 < AVGC50.17) * (ABS(C18 >= AVGC50.18) * 18 + ABS(C18 < AVGC50.18) * (ABS(C19 >= AVGC50.19) * 19 + ABS(C19 < AVGC50.19) * (ABS(C20 >= AVGC50.20) * 20 + ABS(C20 < AVGC50.20) * (ABS(C21 >= AVGC50.21) * 21 + ABS(C21 < AVGC50.21) * (ABS(C22 >= AVGC50.22) * 22 + ABS(C22 < AVGC50.22) * (ABS(C23 >= AVGC50.23) * 23 + ABS(C23 < AVGC50.23) * (ABS(C24 >= AVGC50.24) * 24 + ABS(C24 < AVGC50.24) * (ABS(C25 >= AVGC50.25) * 25 + ABS(C25 < AVGC50.25) * (ABS(C26 >= AVGC50.26) * 26 + ABS(C26 < AVGC50.26) * (ABS(C27 >= AVGC50.27) * 27 + ABS(C27 < AVGC50.27) * (ABS(C28 >= AVGC50.28) * 28 + ABS(C28 < AVGC50.28) * (ABS(C29 >= AVGC50.29) * 29 + ABS(C29 < AVGC50.29) * (ABS(C30 >= AVGC50.30) * 30 + ABS(C30 < AVGC50.30) * (ABS(C31 >= AVGC50.31) * 31 + ABS(C31 < AVGC50.31) * (ABS(C32 >= AVGC50.32) * 32 + ABS(C32 < AVGC50.32) * (ABS(C33 >= AVGC50.33) * 33 + ABS(C33 < AVGC50.33) * (ABS(C34 >= AVGC50.34) * 34 + ABS(C34 < AVGC50.34) * (ABS(C35 >= AVGC50.35) * 35 + ABS(C35 < AVGC50.35) * (ABS(C36 >= AVGC50.36) * 36 + ABS(C36 < AVGC50.36) * (ABS(C37 >= AVGC50.37) * 37 + ABS(C37 < AVGC50.37) * (ABS(C38 >= AVGC50.38) * 38 + ABS(C38 < AVGC50.38) * (ABS(C39 >= AVGC50.39) * 39 + ABS(C39 < AVGC50.39) * (ABS(C40 >= AVGC50.40) * 40 + ABS(C40 < AVGC50.40) * (ABS(C41 >= AVGC50.41) * 41 + ABS(C41 < AVGC50.41) * (ABS(C42 >= AVGC50.42) * 42 + ABS(C42 < AVGC50.42) * (ABS(C43 >= AVGC50.43) * 43 + ABS(C43 < AVGC50.43) * (ABS(C44 >= AVGC50.44) * 44 + ABS(C44 < AVGC50.44) * (ABS(C45 >= AVGC50.45) * 45 + ABS(C45 < AVGC50.45) * (ABS(C46 >= AVGC50.46) * 46 + ABS(C46 < AVGC50.46) * (ABS(C47 >= AVGC50.47) * 47 + ABS(C47 < AVGC50.47) * (ABS(C48 >= AVGC50.48) * 48 + ABS(C48 < AVGC50.48) * (ABS(C49 >= AVGC50.49) * 49 + ABS(C49 < AVGC50.49) * (ABS(C50 >= AVGC50.50) * 50 + ABS(C50 < AVGC50.50) * (ABS(C51 >= AVGC50.51) * 51 + ABS(C51 < AVGC50.51) * (ABS(C52 >= AVGC50.52) * 52 + ABS(C52 < AVGC50.52) * (ABS(C53 >= AVGC50.53) * 53 + ABS(C53 < AVGC50.53) * (ABS(C54 >= AVGC50.54) * 54 + ABS(C54 < AVGC50.54) * (ABS(C55 >= AVGC50.55) * 55 + ABS(C55 < AVGC50.55) * (ABS(C56 >= AVGC50.56) * 56 + ABS(C56 < AVGC50.56) * (ABS(C57 >= AVGC50.57) * 57 + ABS(C57 < AVGC50.57) * (ABS(C58 >= AVGC50.58) * 58 + ABS(C58 < AVGC50.58) * (ABS(C59 >= AVGC50.59) * 59 + ABS(C59 < AVGC50.59) * 60)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))

The number of bars above SMA200 with a maximum value of 60 can be written as:

ABS(C > AVGC200) * (ABS(C1 <= AVGC200.1) + ABS(C1 > AVGC200.1) * (ABS(C2 <= AVGC200.2) * 2 + ABS(C2 > AVGC200.2) * (ABS(C3 <= AVGC200.3) * 3 + ABS(C3 > AVGC200.3) * (ABS(C4 <= AVGC200.4) * 4 + ABS(C4 > AVGC200.4) * (ABS(C5 <= AVGC200.5) * 5 + ABS(C5 > AVGC200.5) * (ABS(C6 <= AVGC200.6) * 6 + ABS(C6 > AVGC200.6) * (ABS(C7 <= AVGC200.7) * 7 + ABS(C7 > AVGC200.7) * (ABS(C8 <= AVGC200.8) * 8 + ABS(C8 > AVGC200.8) * (ABS(C9 <= AVGC200.9) * 9 + ABS(C9 > AVGC200.9) * (ABS(C10 <= AVGC200.10) * 10 + ABS(C10 > AVGC200.10) * (ABS(C11 <= AVGC200.11) * 11 + ABS(C11 > AVGC200.11) * (ABS(C12 <= AVGC200.12) * 12 + ABS(C12 > AVGC200.12) * (ABS(C13 <= AVGC200.13) * 13 + ABS(C13 > AVGC200.13) * (ABS(C14 <= AVGC200.14) * 14 + ABS(C14 > AVGC200.14) * (ABS(C15 <= AVGC200.15) * 15 + ABS(C15 > AVGC200.15) * (ABS(C16 <= AVGC200.16) * 16 + ABS(C16 > AVGC200.16) * (ABS(C17 <= AVGC200.17) * 17 + ABS(C17 > AVGC200.17) * (ABS(C18 <= AVGC200.18) * 18 + ABS(C18 > AVGC200.18) * (ABS(C19 <= AVGC200.19) * 19 + ABS(C19 > AVGC200.19) * (ABS(C20 <= AVGC200.20) * 20 + ABS(C20 > AVGC200.20) * (ABS(C21 <= AVGC200.21) * 21 + ABS(C21 > AVGC200.21) * (ABS(C22 <= AVGC200.22) * 22 + ABS(C22 > AVGC200.22) * (ABS(C23 <= AVGC200.23) * 23 + ABS(C23 > AVGC200.23) * (ABS(C24 <= AVGC200.24) * 24 + ABS(C24 > AVGC200.24) * (ABS(C25 <= AVGC200.25) * 25 + ABS(C25 > AVGC200.25) * (ABS(C26 <= AVGC200.26) * 26 + ABS(C26 > AVGC200.26) * (ABS(C27 <= AVGC200.27) * 27 + ABS(C27 > AVGC200.27) * (ABS(C28 <= AVGC200.28) * 28 + ABS(C28 > AVGC200.28) * (ABS(C29 <= AVGC200.29) * 29 + ABS(C29 > AVGC200.29) * (ABS(C30 <= AVGC200.30) * 30 + ABS(C30 > AVGC200.30) * (ABS(C31 <= AVGC200.31) * 31 + ABS(C31 > AVGC200.31) * (ABS(C32 <= AVGC200.32) * 32 + ABS(C32 > AVGC200.32) * (ABS(C33 <= AVGC200.33) * 33 + ABS(C33 > AVGC200.33) * (ABS(C34 <= AVGC200.34) * 34 + ABS(C34 > AVGC200.34) * (ABS(C35 <= AVGC200.35) * 35 + ABS(C35 > AVGC200.35) * (ABS(C36 <= AVGC200.36) * 36 + ABS(C36 > AVGC200.36) * (ABS(C37 <= AVGC200.37) * 37 + ABS(C37 > AVGC200.37) * (ABS(C38 <= AVGC200.38) * 38 + ABS(C38 > AVGC200.38) * (ABS(C39 <= AVGC200.39) * 39 + ABS(C39 > AVGC200.39) * (ABS(C40 <= AVGC200.40) * 40 + ABS(C40 > AVGC200.40) * (ABS(C41 <= AVGC200.41) * 41 + ABS(C41 > AVGC200.41) * (ABS(C42 <= AVGC200.42) * 42 + ABS(C42 > AVGC200.42) * (ABS(C43 <= AVGC200.43) * 43 + ABS(C43 > AVGC200.43) * (ABS(C44 <= AVGC200.44) * 44 + ABS(C44 > AVGC200.44) * (ABS(C45 <= AVGC200.45) * 45 + ABS(C45 > AVGC200.45) * (ABS(C46 <= AVGC200.46) * 46 + ABS(C46 > AVGC200.46) * (ABS(C47 <= AVGC200.47) * 47 + ABS(C47 > AVGC200.47) * (ABS(C48 <= AVGC200.48) * 48 + ABS(C48 > AVGC200.48) * (ABS(C49 <= AVGC200.49) * 49 + ABS(C49 > AVGC200.49) * (ABS(C50 <= AVGC200.50) * 50 + ABS(C50 > AVGC200.50) * (ABS(C51 <= AVGC200.51) * 51 + ABS(C51 > AVGC200.51) * (ABS(C52 <= AVGC200.52) * 52 + ABS(C52 > AVGC200.52) * (ABS(C53 <= AVGC200.53) * 53 + ABS(C53 > AVGC200.53) * (ABS(C54 <= AVGC200.54) * 54 + ABS(C54 > AVGC200.54) * (ABS(C55 <= AVGC200.55) * 55 + ABS(C55 > AVGC200.55) * (ABS(C56 <= AVGC200.56) * 56 + ABS(C56 > AVGC200.56) * (ABS(C57 <= AVGC200.57) * 57 + ABS(C57 > AVGC200.57) * (ABS(C58 <= AVGC200.58) * 58 + ABS(C58 > AVGC200.58) * (ABS(C59 <= AVGC200.59) * 59 + ABS(C59 > AVGC200.59) * 60)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))

The number of bars below SMA200 with a maximum value of 60 reverses all of the > and < signs in the formula:

ABS(C < AVGC200) * (ABS(C1 >= AVGC200.1) + ABS(C1 < AVGC200.1) * (ABS(C2 >= AVGC200.2) * 2 + ABS(C2 < AVGC200.2) * (ABS(C3 >= AVGC200.3) * 3 + ABS(C3 < AVGC200.3) * (ABS(C4 >= AVGC200.4) * 4 + ABS(C4 < AVGC200.4) * (ABS(C5 >= AVGC200.5) * 5 + ABS(C5 < AVGC200.5) * (ABS(C6 >= AVGC200.6) * 6 + ABS(C6 < AVGC200.6) * (ABS(C7 >= AVGC200.7) * 7 + ABS(C7 < AVGC200.7) * (ABS(C8 >= AVGC200.8) * 8 + ABS(C8 < AVGC200.8) * (ABS(C9 >= AVGC200.9) * 9 + ABS(C9 < AVGC200.9) * (ABS(C10 >= AVGC200.10) * 10 + ABS(C10 < AVGC200.10) * (ABS(C11 >= AVGC200.11) * 11 + ABS(C11 < AVGC200.11) * (ABS(C12 >= AVGC200.12) * 12 + ABS(C12 < AVGC200.12) * (ABS(C13 >= AVGC200.13) * 13 + ABS(C13 < AVGC200.13) * (ABS(C14 >= AVGC200.14) * 14 + ABS(C14 < AVGC200.14) * (ABS(C15 >= AVGC200.15) * 15 + ABS(C15 < AVGC200.15) * (ABS(C16 >= AVGC200.16) * 16 + ABS(C16 < AVGC200.16) * (ABS(C17 >= AVGC200.17) * 17 + ABS(C17 < AVGC200.17) * (ABS(C18 >= AVGC200.18) * 18 + ABS(C18 < AVGC200.18) * (ABS(C19 >= AVGC200.19) * 19 + ABS(C19 < AVGC200.19) * (ABS(C20 >= AVGC200.20) * 20 + ABS(C20 < AVGC200.20) * (ABS(C21 >= AVGC200.21) * 21 + ABS(C21 < AVGC200.21) * (ABS(C22 >= AVGC200.22) * 22 + ABS(C22 < AVGC200.22) * (ABS(C23 >= AVGC200.23) * 23 + ABS(C23 < AVGC200.23) * (ABS(C24 >= AVGC200.24) * 24 + ABS(C24 < AVGC200.24) * (ABS(C25 >= AVGC200.25) * 25 + ABS(C25 < AVGC200.25) * (ABS(C26 >= AVGC200.26) * 26 + ABS(C26 < AVGC200.26) * (ABS(C27 >= AVGC200.27) * 27 + ABS(C27 < AVGC200.27) * (ABS(C28 >= AVGC200.28) * 28 + ABS(C28 < AVGC200.28) * (ABS(C29 >= AVGC200.29) * 29 + ABS(C29 < AVGC200.29) * (ABS(C30 >= AVGC200.30) * 30 + ABS(C30 < AVGC200.30) * (ABS(C31 >= AVGC200.31) * 31 + ABS(C31 < AVGC200.31) * (ABS(C32 >= AVGC200.32) * 32 + ABS(C32 < AVGC200.32) * (ABS(C33 >= AVGC200.33) * 33 + ABS(C33 < AVGC200.33) * (ABS(C34 >= AVGC200.34) * 34 + ABS(C34 < AVGC200.34) * (ABS(C35 >= AVGC200.35) * 35 + ABS(C35 < AVGC200.35) * (ABS(C36 >= AVGC200.36) * 36 + ABS(C36 < AVGC200.36) * (ABS(C37 >= AVGC200.37) * 37 + ABS(C37 < AVGC200.37) * (ABS(C38 >= AVGC200.38) * 38 + ABS(C38 < AVGC200.38) * (ABS(C39 >= AVGC200.39) * 39 + ABS(C39 < AVGC200.39) * (ABS(C40 >= AVGC200.40) * 40 + ABS(C40 < AVGC200.40) * (ABS(C41 >= AVGC200.41) * 41 + ABS(C41 < AVGC200.41) * (ABS(C42 >= AVGC200.42) * 42 + ABS(C42 < AVGC200.42) * (ABS(C43 >= AVGC200.43) * 43 + ABS(C43 < AVGC200.43) * (ABS(C44 >= AVGC200.44) * 44 + ABS(C44 < AVGC200.44) * (ABS(C45 >= AVGC200.45) * 45 + ABS(C45 < AVGC200.45) * (ABS(C46 >= AVGC200.46) * 46 + ABS(C46 < AVGC200.46) * (ABS(C47 >= AVGC200.47) * 47 + ABS(C47 < AVGC200.47) * (ABS(C48 >= AVGC200.48) * 48 + ABS(C48 < AVGC200.48) * (ABS(C49 >= AVGC200.49) * 49 + ABS(C49 < AVGC200.49) * (ABS(C50 >= AVGC200.50) * 50 + ABS(C50 < AVGC200.50) * (ABS(C51 >= AVGC200.51) * 51 + ABS(C51 < AVGC200.51) * (ABS(C52 >= AVGC200.52) * 52 + ABS(C52 < AVGC200.52) * (ABS(C53 >= AVGC200.53) * 53 + ABS(C53 < AVGC200.53) * (ABS(C54 >= AVGC200.54) * 54 + ABS(C54 < AVGC200.54) * (ABS(C55 >= AVGC200.55) * 55 + ABS(C55 < AVGC200.55) * (ABS(C56 >= AVGC200.56) * 56 + ABS(C56 < AVGC200.56) * (ABS(C57 >= AVGC200.57) * 57 + ABS(C57 < AVGC200.57) * (ABS(C58 >= AVGC200.58) * 58 + ABS(C58 < AVGC200.58) * (ABS(C59 >= AVGC200.59) * 59 + ABS(C59 < AVGC200.59) * 60)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
mdbecker5
Posted : Friday, June 7, 2013 9:24:39 AM
Registered User
Joined: 12/6/2011
Posts: 13

I need exp mov. avg 50 above and below  for 60day  just adding (exp) instead of (simple)

Bruce_L
Posted : Friday, June 7, 2013 9:38:01 AM


Worden Trainer

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

You could do this relatively easily on your own by putting the the formula into a text editor (such as the Notepad application built into Windows) and using Replace All to replace all instances of AVGC50 with XAVGC50. The same basic technique of using Replace All in a text editor would allow you to change the period of the moving average as well.

The number of bars above XAVGC50 shortened to a maximum of 60 bars could be written as:

ABS(C > XAVGC50) * (ABS(C1 <= XAVGC50.1) + ABS(C1 > XAVGC50.1) * (ABS(C2 <= XAVGC50.2) * 2 + ABS(C2 > XAVGC50.2) * (ABS(C3 <= XAVGC50.3) * 3 + ABS(C3 > XAVGC50.3) * (ABS(C4 <= XAVGC50.4) * 4 + ABS(C4 > XAVGC50.4) * (ABS(C5 <= XAVGC50.5) * 5 + ABS(C5 > XAVGC50.5) * (ABS(C6 <= XAVGC50.6) * 6 + ABS(C6 > XAVGC50.6) * (ABS(C7 <= XAVGC50.7) * 7 + ABS(C7 > XAVGC50.7) * (ABS(C8 <= XAVGC50.8) * 8 + ABS(C8 > XAVGC50.8) * (ABS(C9 <= XAVGC50.9) * 9 + ABS(C9 > XAVGC50.9) * (ABS(C10 <= XAVGC50.10) * 10 + ABS(C10 > XAVGC50.10) * (ABS(C11 <= XAVGC50.11) * 11 + ABS(C11 > XAVGC50.11) * (ABS(C12 <= XAVGC50.12) * 12 + ABS(C12 > XAVGC50.12) * (ABS(C13 <= XAVGC50.13) * 13 + ABS(C13 > XAVGC50.13) * (ABS(C14 <= XAVGC50.14) * 14 + ABS(C14 > XAVGC50.14) * (ABS(C15 <= XAVGC50.15) * 15 + ABS(C15 > XAVGC50.15) * (ABS(C16 <= XAVGC50.16) * 16 + ABS(C16 > XAVGC50.16) * (ABS(C17 <= XAVGC50.17) * 17 + ABS(C17 > XAVGC50.17) * (ABS(C18 <= XAVGC50.18) * 18 + ABS(C18 > XAVGC50.18) * (ABS(C19 <= XAVGC50.19) * 19 + ABS(C19 > XAVGC50.19) * (ABS(C20 <= XAVGC50.20) * 20 + ABS(C20 > XAVGC50.20) * (ABS(C21 <= XAVGC50.21) * 21 + ABS(C21 > XAVGC50.21) * (ABS(C22 <= XAVGC50.22) * 22 + ABS(C22 > XAVGC50.22) * (ABS(C23 <= XAVGC50.23) * 23 + ABS(C23 > XAVGC50.23) * (ABS(C24 <= XAVGC50.24) * 24 + ABS(C24 > XAVGC50.24) * (ABS(C25 <= XAVGC50.25) * 25 + ABS(C25 > XAVGC50.25) * (ABS(C26 <= XAVGC50.26) * 26 + ABS(C26 > XAVGC50.26) * (ABS(C27 <= XAVGC50.27) * 27 + ABS(C27 > XAVGC50.27) * (ABS(C28 <= XAVGC50.28) * 28 + ABS(C28 > XAVGC50.28) * (ABS(C29 <= XAVGC50.29) * 29 + ABS(C29 > XAVGC50.29) * (ABS(C30 <= XAVGC50.30) * 30 + ABS(C30 > XAVGC50.30) * (ABS(C31 <= XAVGC50.31) * 31 + ABS(C31 > XAVGC50.31) * (ABS(C32 <= XAVGC50.32) * 32 + ABS(C32 > XAVGC50.32) * (ABS(C33 <= XAVGC50.33) * 33 + ABS(C33 > XAVGC50.33) * (ABS(C34 <= XAVGC50.34) * 34 + ABS(C34 > XAVGC50.34) * (ABS(C35 <= XAVGC50.35) * 35 + ABS(C35 > XAVGC50.35) * (ABS(C36 <= XAVGC50.36) * 36 + ABS(C36 > XAVGC50.36) * (ABS(C37 <= XAVGC50.37) * 37 + ABS(C37 > XAVGC50.37) * (ABS(C38 <= XAVGC50.38) * 38 + ABS(C38 > XAVGC50.38) * (ABS(C39 <= XAVGC50.39) * 39 + ABS(C39 > XAVGC50.39) * (ABS(C40 <= XAVGC50.40) * 40 + ABS(C40 > XAVGC50.40) * (ABS(C41 <= XAVGC50.41) * 41 + ABS(C41 > XAVGC50.41) * (ABS(C42 <= XAVGC50.42) * 42 + ABS(C42 > XAVGC50.42) * (ABS(C43 <= XAVGC50.43) * 43 + ABS(C43 > XAVGC50.43) * (ABS(C44 <= XAVGC50.44) * 44 + ABS(C44 > XAVGC50.44) * (ABS(C45 <= XAVGC50.45) * 45 + ABS(C45 > XAVGC50.45) * (ABS(C46 <= XAVGC50.46) * 46 + ABS(C46 > XAVGC50.46) * (ABS(C47 <= XAVGC50.47) * 47 + ABS(C47 > XAVGC50.47) * (ABS(C48 <= XAVGC50.48) * 48 + ABS(C48 > XAVGC50.48) * (ABS(C49 <= XAVGC50.49) * 49 + ABS(C49 > XAVGC50.49) * (ABS(C50 <= XAVGC50.50) * 50 + ABS(C50 > XAVGC50.50) * (ABS(C51 <= XAVGC50.51) * 51 + ABS(C51 > XAVGC50.51) * (ABS(C52 <= XAVGC50.52) * 52 + ABS(C52 > XAVGC50.52) * (ABS(C53 <= XAVGC50.53) * 53 + ABS(C53 > XAVGC50.53) * (ABS(C54 <= XAVGC50.54) * 54 + ABS(C54 > XAVGC50.54) * (ABS(C55 <= XAVGC50.55) * 55 + ABS(C55 > XAVGC50.55) * (ABS(C56 <= XAVGC50.56) * 56 + ABS(C56 > XAVGC50.56) * (ABS(C57 <= XAVGC50.57) * 57 + ABS(C57 > XAVGC50.57) * (ABS(C58 <= XAVGC50.58) * 58 + ABS(C58 > XAVGC50.58) * (ABS(C59 <= XAVGC50.59) * 59 + ABS(C59 > XAVGC50.59) * 60)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))

The number of bars below XAVGC50 with a maximum value of 60 reverses all of the > and < signs in the formula:

ABS(C < XAVGC50) * (ABS(C1 >= XAVGC50.1) + ABS(C1 < XAVGC50.1) * (ABS(C2 >= XAVGC50.2) * 2 + ABS(C2 < XAVGC50.2) * (ABS(C3 >= XAVGC50.3) * 3 + ABS(C3 < XAVGC50.3) * (ABS(C4 >= XAVGC50.4) * 4 + ABS(C4 < XAVGC50.4) * (ABS(C5 >= XAVGC50.5) * 5 + ABS(C5 < XAVGC50.5) * (ABS(C6 >= XAVGC50.6) * 6 + ABS(C6 < XAVGC50.6) * (ABS(C7 >= XAVGC50.7) * 7 + ABS(C7 < XAVGC50.7) * (ABS(C8 >= XAVGC50.8) * 8 + ABS(C8 < XAVGC50.8) * (ABS(C9 >= XAVGC50.9) * 9 + ABS(C9 < XAVGC50.9) * (ABS(C10 >= XAVGC50.10) * 10 + ABS(C10 < XAVGC50.10) * (ABS(C11 >= XAVGC50.11) * 11 + ABS(C11 < XAVGC50.11) * (ABS(C12 >= XAVGC50.12) * 12 + ABS(C12 < XAVGC50.12) * (ABS(C13 >= XAVGC50.13) * 13 + ABS(C13 < XAVGC50.13) * (ABS(C14 >= XAVGC50.14) * 14 + ABS(C14 < XAVGC50.14) * (ABS(C15 >= XAVGC50.15) * 15 + ABS(C15 < XAVGC50.15) * (ABS(C16 >= XAVGC50.16) * 16 + ABS(C16 < XAVGC50.16) * (ABS(C17 >= XAVGC50.17) * 17 + ABS(C17 < XAVGC50.17) * (ABS(C18 >= XAVGC50.18) * 18 + ABS(C18 < XAVGC50.18) * (ABS(C19 >= XAVGC50.19) * 19 + ABS(C19 < XAVGC50.19) * (ABS(C20 >= XAVGC50.20) * 20 + ABS(C20 < XAVGC50.20) * (ABS(C21 >= XAVGC50.21) * 21 + ABS(C21 < XAVGC50.21) * (ABS(C22 >= XAVGC50.22) * 22 + ABS(C22 < XAVGC50.22) * (ABS(C23 >= XAVGC50.23) * 23 + ABS(C23 < XAVGC50.23) * (ABS(C24 >= XAVGC50.24) * 24 + ABS(C24 < XAVGC50.24) * (ABS(C25 >= XAVGC50.25) * 25 + ABS(C25 < XAVGC50.25) * (ABS(C26 >= XAVGC50.26) * 26 + ABS(C26 < XAVGC50.26) * (ABS(C27 >= XAVGC50.27) * 27 + ABS(C27 < XAVGC50.27) * (ABS(C28 >= XAVGC50.28) * 28 + ABS(C28 < XAVGC50.28) * (ABS(C29 >= XAVGC50.29) * 29 + ABS(C29 < XAVGC50.29) * (ABS(C30 >= XAVGC50.30) * 30 + ABS(C30 < XAVGC50.30) * (ABS(C31 >= XAVGC50.31) * 31 + ABS(C31 < XAVGC50.31) * (ABS(C32 >= XAVGC50.32) * 32 + ABS(C32 < XAVGC50.32) * (ABS(C33 >= XAVGC50.33) * 33 + ABS(C33 < XAVGC50.33) * (ABS(C34 >= XAVGC50.34) * 34 + ABS(C34 < XAVGC50.34) * (ABS(C35 >= XAVGC50.35) * 35 + ABS(C35 < XAVGC50.35) * (ABS(C36 >= XAVGC50.36) * 36 + ABS(C36 < XAVGC50.36) * (ABS(C37 >= XAVGC50.37) * 37 + ABS(C37 < XAVGC50.37) * (ABS(C38 >= XAVGC50.38) * 38 + ABS(C38 < XAVGC50.38) * (ABS(C39 >= XAVGC50.39) * 39 + ABS(C39 < XAVGC50.39) * (ABS(C40 >= XAVGC50.40) * 40 + ABS(C40 < XAVGC50.40) * (ABS(C41 >= XAVGC50.41) * 41 + ABS(C41 < XAVGC50.41) * (ABS(C42 >= XAVGC50.42) * 42 + ABS(C42 < XAVGC50.42) * (ABS(C43 >= XAVGC50.43) * 43 + ABS(C43 < XAVGC50.43) * (ABS(C44 >= XAVGC50.44) * 44 + ABS(C44 < XAVGC50.44) * (ABS(C45 >= XAVGC50.45) * 45 + ABS(C45 < XAVGC50.45) * (ABS(C46 >= XAVGC50.46) * 46 + ABS(C46 < XAVGC50.46) * (ABS(C47 >= XAVGC50.47) * 47 + ABS(C47 < XAVGC50.47) * (ABS(C48 >= XAVGC50.48) * 48 + ABS(C48 < XAVGC50.48) * (ABS(C49 >= XAVGC50.49) * 49 + ABS(C49 < XAVGC50.49) * (ABS(C50 >= XAVGC50.50) * 50 + ABS(C50 < XAVGC50.50) * (ABS(C51 >= XAVGC50.51) * 51 + ABS(C51 < XAVGC50.51) * (ABS(C52 >= XAVGC50.52) * 52 + ABS(C52 < XAVGC50.52) * (ABS(C53 >= XAVGC50.53) * 53 + ABS(C53 < XAVGC50.53) * (ABS(C54 >= XAVGC50.54) * 54 + ABS(C54 < XAVGC50.54) * (ABS(C55 >= XAVGC50.55) * 55 + ABS(C55 < XAVGC50.55) * (ABS(C56 >= XAVGC50.56) * 56 + ABS(C56 < XAVGC50.56) * (ABS(C57 >= XAVGC50.57) * 57 + ABS(C57 < XAVGC50.57) * (ABS(C58 >= XAVGC50.58) * 58 + ABS(C58 < XAVGC50.58) * (ABS(C59 >= XAVGC50.59) * 59 + ABS(C59 < XAVGC50.59) * 60)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))



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

Forum Jump
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.