Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 3/25/2011 Posts: 18
|
Is it possible to include ADX calculations and Swing High/Low calculations in PCFs?
Thanks,
~mike
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Assuming a Swing High is a High surrounded by a specified number of lower Highs on both sides, we can create a formula that will return True once the Swing High is identified. for example, a formula for a Swing High with two lower Highs on both sides could be written as:
How to create a Personal Criteria Forumula (PCF)
PCF Formula Descriptions
Handy PCF example formulas to help you learn the syntax of PCFs!
MAXH2 < H2 AND H2 > MAXH2.3
A similar formula for a Swing Low could be written as:
MINL2 > L2 AND L2 < MINL2.3
While it is possible to identify the crossover of the +DI and -DI or determine their values using a PCF as long as the DX period is know.
PCF for Wilder's Directional Movement DMI-crossovers
PCF for Wilder's DX, and/or a CI for Wilder's ADX
I am not aware of a practical method of creating the ADX line itself as a Personal Criteria Formula. It is possible to sort by ADX using Indicator Sorts however.
Sorting by the ADX indicator
Average Directional Index (ADX)
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 3/25/2011 Posts: 18
|
Thanks Bruce! One of the criterions for my setup is that the current price is greater than the last swing high (5). I see that with your formula the swing high can be identified immediately after it forms but is it possible to check back in the past and find the last swing high and compare it to the current price?
~mike
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
I'm not quite sure what a Swing High (5) is. Does the 5 represent the total number of bars in the pattern or the number of highs that must happen both before and after the highest high in the pattern?
The following assumes the 5 represents the total number of Bars in the pattern (it uses the Swing High formula provided earlier). It looks back 30 Bars for a Swing High. If a Swing High does not occur during that time, the formula will return False.
Days Since Last Peak (or other day-counting needs)
C > ABS(MAXH2.1 < H3 AND H3 > MAXH2.4) * H3 + ABS(MAXH2.1 >= H3 OR H3 <= MAXH2.4) * (ABS(MAXH2.2 < H4 AND H4 > MAXH2.5) * H4 + ABS(MAXH2.2 >= H4 OR H4 <= MAXH2.5) * (ABS(MAXH2.3 < H5 AND H5 > MAXH2.6) * H5 + ABS(MAXH2.3 >= H5 OR H5 <= MAXH2.6) * (ABS(MAXH2.4 < H6 AND H6 > MAXH2.7) * H6 + ABS(MAXH2.4 >= H6 OR H6 <= MAXH2.7) * (ABS(MAXH2.5 < H7 AND H7 > MAXH2.8) * H7 + ABS(MAXH2.5 >= H7 OR H7 <= MAXH2.8) * (ABS(MAXH2.6 < H8 AND H8 > MAXH2.9) * H8 + ABS(MAXH2.6 >= H8 OR H8 <= MAXH2.9) * (ABS(MAXH2.7 < H9 AND H9 > MAXH2.10) * H9 + ABS(MAXH2.7 >= H9 OR H9 <= MAXH2.10) * (ABS(MAXH2.8 < H10 AND H10 > MAXH2.11) * H10 + ABS(MAXH2.8 >= H10 OR H10 <= MAXH2.11) * (ABS(MAXH2.9 < H11 AND H11 > MAXH2.12) * H11 + ABS(MAXH2.9 >= H11 OR H11 <= MAXH2.12) * (ABS(MAXH2.10 < H12 AND H12 > MAXH2.13) * H12 + ABS(MAXH2.10 >= H12 OR H12 <= MAXH2.13) * (ABS(MAXH2.11 < H13 AND H13 > MAXH2.14) * H13 + ABS(MAXH2.11 >= H13 OR H13 <= MAXH2.14) * (ABS(MAXH2.12 < H14 AND H14 > MAXH2.15) * H14 + ABS(MAXH2.12 >= H14 OR H14 <= MAXH2.15) * (ABS(MAXH2.13 < H15 AND H15 > MAXH2.16) * H15 + ABS(MAXH2.13 >= H15 OR H15 <= MAXH2.16) * (ABS(MAXH2.14 < H16 AND H16 > MAXH2.17) * H16 + ABS(MAXH2.14 >= H16 OR H16 <= MAXH2.17) * (ABS(MAXH2.15 < H17 AND H17 > MAXH2.18) * H17 + ABS(MAXH2.15 >= H17 OR H17 <= MAXH2.18) * (ABS(MAXH2.16 < H18 AND H18 > MAXH2.19) * H18 + ABS(MAXH2.16 >= H18 OR H18 <= MAXH2.19) * (ABS(MAXH2.17 < H19 AND H19 > MAXH2.20) * H19 + ABS(MAXH2.17 >= H19 OR H19 <= MAXH2.20) * (ABS(MAXH2.18 < H20 AND H20 > MAXH2.21) * H20 + ABS(MAXH2.18 >= H20 OR H20 <= MAXH2.21) * (ABS(MAXH2.19 < H21 AND H21 > MAXH2.22) * H21 + ABS(MAXH2.19 >= H21 OR H21 <= MAXH2.22) * (ABS(MAXH2.20 < H22 AND H22 > MAXH2.23) * H22 + ABS(MAXH2.20 >= H22 OR H22 <= MAXH2.23) * (ABS(MAXH2.21 < H23 AND H23 > MAXH2.24) * H23 + ABS(MAXH2.21 >= H23 OR H23 <= MAXH2.24) * (ABS(MAXH2.22 < H24 AND H24 > MAXH2.25) * H24 + ABS(MAXH2.22 >= H24 OR H24 <= MAXH2.25) * (ABS(MAXH2.23 < H25 AND H25 > MAXH2.26) * H25 + ABS(MAXH2.23 >= H25 OR H25 <= MAXH2.26) * (ABS(MAXH2.24 < H26 AND H26 > MAXH2.27) * H26 + ABS(MAXH2.24 >= H26 OR H26 <= MAXH2.27) * (ABS(MAXH2.25 < H27 AND H27 > MAXH2.28) * H27 + ABS(MAXH2.25 >= H27 OR H27 <= MAXH2.28) * (ABS(MAXH2.26 < H28 AND H28 > MAXH2.29) * H28 + ABS(MAXH2.26 >= H28 OR H28 <= MAXH2.29) * (ABS(MAXH2.27 < H29 AND H29 > MAXH2.30) * H29 + ABS(MAXH2.27 >= H29 OR H29 <= MAXH2.30) * (ABS(MAXH2.28 < H30 AND H30 > MAXH2.31) * H30 + ABS(MAXH2.28 >= H30 OR H30 <= MAXH2.31) * (ABS(MAXH2.29 < H31 AND H31 > MAXH2.32) * H31 + ABS(MAXH2.29 >= H31 OR H31 <= MAXH2.32) * (ABS(MAXH2.30 < H32 AND H32 > MAXH2.33) * H32 + ABS(MAXH2.30 >= H32 OR H32 <= MAXH2.33) * (C + 1))))))))))))))))))))))))))))))
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 3/25/2011 Posts: 18
|
Sorry for not being clear. Swing High (5) would have 5 lower bars on either side of the high.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
I suspect you will want to increase the lookback beyond 30-Bars as your Swing High is rarer, but I will wait on feedback from you:
C > ABS(MAXH5.1 < H6 AND H6 > MAXH5.7) * H6 + ABS(MAXH5.1 >= H6 OR H6 <= MAXH5.7) * (ABS(MAXH5.2 < H7 AND H7 > MAXH5.8) * H7 + ABS(MAXH5.2 >= H7 OR H7 <= MAXH5.8) * (ABS(MAXH5.3 < H8 AND H8 > MAXH5.9) * H8 + ABS(MAXH5.3 >= H8 OR H8 <= MAXH5.9) * (ABS(MAXH5.4 < H9 AND H9 > MAXH5.10) * H9 + ABS(MAXH5.4 >= H9 OR H9 <= MAXH5.10) * (ABS(MAXH5.5 < H10 AND H10 > MAXH5.11) * H10 + ABS(MAXH5.5 >= H10 OR H10 <= MAXH5.11) * (ABS(MAXH5.6 < H11 AND H11 > MAXH5.12) * H11 + ABS(MAXH5.6 >= H11 OR H11 <= MAXH5.12) * (ABS(MAXH5.7 < H12 AND H12 > MAXH5.13) * H12 + ABS(MAXH5.7 >= H12 OR H12 <= MAXH5.13) * (ABS(MAXH5.8 < H13 AND H13 > MAXH5.14) * H13 + ABS(MAXH5.8 >= H13 OR H13 <= MAXH5.14) * (ABS(MAXH5.9 < H14 AND H14 > MAXH5.15) * H14 + ABS(MAXH5.9 >= H14 OR H14 <= MAXH5.15) * (ABS(MAXH5.10 < H15 AND H15 > MAXH5.16) * H15 + ABS(MAXH5.10 >= H15 OR H15 <= MAXH5.16) * (ABS(MAXH5.11 < H16 AND H16 > MAXH5.17) * H16 + ABS(MAXH5.11 >= H16 OR H16 <= MAXH5.17) * (ABS(MAXH5.12 < H17 AND H17 > MAXH5.18) * H17 + ABS(MAXH5.12 >= H17 OR H17 <= MAXH5.18) * (ABS(MAXH5.13 < H18 AND H18 > MAXH5.19) * H18 + ABS(MAXH5.13 >= H18 OR H18 <= MAXH5.19) * (ABS(MAXH5.14 < H19 AND H19 > MAXH5.20) * H19 + ABS(MAXH5.14 >= H19 OR H19 <= MAXH5.20) * (ABS(MAXH5.15 < H20 AND H20 > MAXH5.21) * H20 + ABS(MAXH5.15 >= H20 OR H20 <= MAXH5.21) * (ABS(MAXH5.16 < H21 AND H21 > MAXH5.22) * H21 + ABS(MAXH5.16 >= H21 OR H21 <= MAXH5.22) * (ABS(MAXH5.17 < H22 AND H22 > MAXH5.23) * H22 + ABS(MAXH5.17 >= H22 OR H22 <= MAXH5.23) * (ABS(MAXH5.18 < H23 AND H23 > MAXH5.24) * H23 + ABS(MAXH5.18 >= H23 OR H23 <= MAXH5.24) * (ABS(MAXH5.19 < H24 AND H24 > MAXH5.25) * H24 + ABS(MAXH5.19 >= H24 OR H24 <= MAXH5.25) * (ABS(MAXH5.20 < H25 AND H25 > MAXH5.26) * H25 + ABS(MAXH5.20 >= H25 OR H25 <= MAXH5.26) * (ABS(MAXH5.21 < H26 AND H26 > MAXH5.27) * H26 + ABS(MAXH5.21 >= H26 OR H26 <= MAXH5.27) * (ABS(MAXH5.22 < H27 AND H27 > MAXH5.28) * H27 + ABS(MAXH5.22 >= H27 OR H27 <= MAXH5.28) * (ABS(MAXH5.23 < H28 AND H28 > MAXH5.29) * H28 + ABS(MAXH5.23 >= H28 OR H28 <= MAXH5.29) * (ABS(MAXH5.24 < H29 AND H29 > MAXH5.30) * H29 + ABS(MAXH5.24 >= H29 OR H29 <= MAXH5.30) * (ABS(MAXH5.25 < H30 AND H30 > MAXH5.31) * H30 + ABS(MAXH5.25 >= H30 OR H30 <= MAXH5.31) * (ABS(MAXH5.26 < H31 AND H31 > MAXH5.32) * H31 + ABS(MAXH5.26 >= H31 OR H31 <= MAXH5.32) * (ABS(MAXH5.27 < H32 AND H32 > MAXH5.33) * H32 + ABS(MAXH5.27 >= H32 OR H32 <= MAXH5.33) * (ABS(MAXH5.28 < H33 AND H33 > MAXH5.34) * H33 + ABS(MAXH5.28 >= H33 OR H33 <= MAXH5.34) * (ABS(MAXH5.29 < H34 AND H34 > MAXH5.35) * H34 + ABS(MAXH5.29 >= H34 OR H34 <= MAXH5.35) * (ABS(MAXH5.30 < H35 AND H35 > MAXH5.36) * H35 + ABS(MAXH5.30 >= H35 OR H35 <= MAXH5.36) * (C + 1))))))))))))))))))))))))))))))
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 3/25/2011 Posts: 18
|
thanks again Bruce...yes I would like to increase the lookback beyond 30 days. I really just need to find the last swing high.
~mike
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Yes is not the number of Bars. It would be possible to set it as arbirtrarily high as you want and still not guarantee that it will find the most recent Swing High. You will need to determine how many Bars you want to look back.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 3/25/2011 Posts: 18
|
Ok...so I need to settle on a definite lookback period. Where do I set that in the formula?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You don't set it within the formula in that there isn't a number that you can just go in and change to make the adjustment.
The technique outlined in the previously referenced Days Since Last Peak (or other day-counting needs) topic requires adding an additional term for each additional lookback Bar. This will generally result in an approximately linear increase in the size of the formula when the number of lookback Bars is increased. So increasing the lookback from 30 to 60 Bars would approximately double the size of the formula (and the time it takes to calculate).
C > ABS(MAXH5.1 < H6 AND H6 > MAXH5.7) * H6 + ABS(MAXH5.1 >= H6 OR H6 <= MAXH5.7) * (ABS(MAXH5.2 < H7 AND H7 > MAXH5.8) * H7 + ABS(MAXH5.2 >= H7 OR H7 <= MAXH5.8) * (ABS(MAXH5.3 < H8 AND H8 > MAXH5.9) * H8 + ABS(MAXH5.3 >= H8 OR H8 <= MAXH5.9) * (ABS(MAXH5.4 < H9 AND H9 > MAXH5.10) * H9 + ABS(MAXH5.4 >= H9 OR H9 <= MAXH5.10) * (ABS(MAXH5.5 < H10 AND H10 > MAXH5.11) * H10 + ABS(MAXH5.5 >= H10 OR H10 <= MAXH5.11) * (ABS(MAXH5.6 < H11 AND H11 > MAXH5.12) * H11 + ABS(MAXH5.6 >= H11 OR H11 <= MAXH5.12) * (ABS(MAXH5.7 < H12 AND H12 > MAXH5.13) * H12 + ABS(MAXH5.7 >= H12 OR H12 <= MAXH5.13) * (ABS(MAXH5.8 < H13 AND H13 > MAXH5.14) * H13 + ABS(MAXH5.8 >= H13 OR H13 <= MAXH5.14) * (ABS(MAXH5.9 < H14 AND H14 > MAXH5.15) * H14 + ABS(MAXH5.9 >= H14 OR H14 <= MAXH5.15) * (ABS(MAXH5.10 < H15 AND H15 > MAXH5.16) * H15 + ABS(MAXH5.10 >= H15 OR H15 <= MAXH5.16) * (ABS(MAXH5.11 < H16 AND H16 > MAXH5.17) * H16 + ABS(MAXH5.11 >= H16 OR H16 <= MAXH5.17) * (ABS(MAXH5.12 < H17 AND H17 > MAXH5.18) * H17 + ABS(MAXH5.12 >= H17 OR H17 <= MAXH5.18) * (ABS(MAXH5.13 < H18 AND H18 > MAXH5.19) * H18 + ABS(MAXH5.13 >= H18 OR H18 <= MAXH5.19) * (ABS(MAXH5.14 < H19 AND H19 > MAXH5.20) * H19 + ABS(MAXH5.14 >= H19 OR H19 <= MAXH5.20) * (ABS(MAXH5.15 < H20 AND H20 > MAXH5.21) * H20 + ABS(MAXH5.15 >= H20 OR H20 <= MAXH5.21) * (ABS(MAXH5.16 < H21 AND H21 > MAXH5.22) * H21 + ABS(MAXH5.16 >= H21 OR H21 <= MAXH5.22) * (ABS(MAXH5.17 < H22 AND H22 > MAXH5.23) * H22 + ABS(MAXH5.17 >= H22 OR H22 <= MAXH5.23) * (ABS(MAXH5.18 < H23 AND H23 > MAXH5.24) * H23 + ABS(MAXH5.18 >= H23 OR H23 <= MAXH5.24) * (ABS(MAXH5.19 < H24 AND H24 > MAXH5.25) * H24 + ABS(MAXH5.19 >= H24 OR H24 <= MAXH5.25) * (ABS(MAXH5.20 < H25 AND H25 > MAXH5.26) * H25 + ABS(MAXH5.20 >= H25 OR H25 <= MAXH5.26) * (ABS(MAXH5.21 < H26 AND H26 > MAXH5.27) * H26 + ABS(MAXH5.21 >= H26 OR H26 <= MAXH5.27) * (ABS(MAXH5.22 < H27 AND H27 > MAXH5.28) * H27 + ABS(MAXH5.22 >= H27 OR H27 <= MAXH5.28) * (ABS(MAXH5.23 < H28 AND H28 > MAXH5.29) * H28 + ABS(MAXH5.23 >= H28 OR H28 <= MAXH5.29) * (ABS(MAXH5.24 < H29 AND H29 > MAXH5.30) * H29 + ABS(MAXH5.24 >= H29 OR H29 <= MAXH5.30) * (ABS(MAXH5.25 < H30 AND H30 > MAXH5.31) * H30 + ABS(MAXH5.25 >= H30 OR H30 <= MAXH5.31) * (ABS(MAXH5.26 < H31 AND H31 > MAXH5.32) * H31 + ABS(MAXH5.26 >= H31 OR H31 <= MAXH5.32) * (ABS(MAXH5.27 < H32 AND H32 > MAXH5.33) * H32 + ABS(MAXH5.27 >= H32 OR H32 <= MAXH5.33) * (ABS(MAXH5.28 < H33 AND H33 > MAXH5.34) * H33 + ABS(MAXH5.28 >= H33 OR H33 <= MAXH5.34) * (ABS(MAXH5.29 < H34 AND H34 > MAXH5.35) * H34 + ABS(MAXH5.29 >= H34 OR H34 <= MAXH5.35) * (ABS(MAXH5.30 < H35 AND H35 > MAXH5.36) * H35 + ABS(MAXH5.30 >= H35 OR H35 <= MAXH5.36) * (ABS(MAXH5.31 < H36 AND H36 > MAXH5.37) * H36 + ABS(MAXH5.31 >= H36 OR H36 <= MAXH5.37) * (ABS(MAXH5.32 < H37 AND H37 > MAXH5.38) * H37 + ABS(MAXH5.32 >= H37 OR H37 <= MAXH5.38) * (ABS(MAXH5.33 < H38 AND H38 > MAXH5.39) * H38 + ABS(MAXH5.33 >= H38 OR H38 <= MAXH5.39) * (ABS(MAXH5.34 < H39 AND H39 > MAXH5.40) * H39 + ABS(MAXH5.34 >= H39 OR H39 <= MAXH5.40) * (ABS(MAXH5.35 < H40 AND H40 > MAXH5.41) * H40 + ABS(MAXH5.35 >= H40 OR H40 <= MAXH5.41) * (ABS(MAXH5.36 < H41 AND H41 > MAXH5.42) * H41 + ABS(MAXH5.36 >= H41 OR H41 <= MAXH5.42) * (ABS(MAXH5.37 < H42 AND H42 > MAXH5.43) * H42 + ABS(MAXH5.37 >= H42 OR H42 <= MAXH5.43) * (ABS(MAXH5.38 < H43 AND H43 > MAXH5.44) * H43 + ABS(MAXH5.38 >= H43 OR H43 <= MAXH5.44) * (ABS(MAXH5.39 < H44 AND H44 > MAXH5.45) * H44 + ABS(MAXH5.39 >= H44 OR H44 <= MAXH5.45) * (ABS(MAXH5.40 < H45 AND H45 > MAXH5.46) * H45 + ABS(MAXH5.40 >= H45 OR H45 <= MAXH5.46) * (ABS(MAXH5.41 < H46 AND H46 > MAXH5.47) * H46 + ABS(MAXH5.41 >= H46 OR H46 <= MAXH5.47) * (ABS(MAXH5.42 < H47 AND H47 > MAXH5.48) * H47 + ABS(MAXH5.42 >= H47 OR H47 <= MAXH5.48) * (ABS(MAXH5.43 < H48 AND H48 > MAXH5.49) * H48 + ABS(MAXH5.43 >= H48 OR H48 <= MAXH5.49) * (ABS(MAXH5.44 < H49 AND H49 > MAXH5.50) * H49 + ABS(MAXH5.44 >= H49 OR H49 <= MAXH5.50) * (ABS(MAXH5.45 < H50 AND H50 > MAXH5.51) * H50 + ABS(MAXH5.45 >= H50 OR H50 <= MAXH5.51) * (ABS(MAXH5.46 < H51 AND H51 > MAXH5.52) * H51 + ABS(MAXH5.46 >= H51 OR H51 <= MAXH5.52) * (ABS(MAXH5.47 < H52 AND H52 > MAXH5.53) * H52 + ABS(MAXH5.47 >= H52 OR H52 <= MAXH5.53) * (ABS(MAXH5.48 < H53 AND H53 > MAXH5.54) * H53 + ABS(MAXH5.48 >= H53 OR H53 <= MAXH5.54) * (ABS(MAXH5.49 < H54 AND H54 > MAXH5.55) * H54 + ABS(MAXH5.49 >= H54 OR H54 <= MAXH5.55) * (ABS(MAXH5.50 < H55 AND H55 > MAXH5.56) * H55 + ABS(MAXH5.50 >= H55 OR H55 <= MAXH5.56) * (ABS(MAXH5.51 < H56 AND H56 > MAXH5.57) * H56 + ABS(MAXH5.51 >= H56 OR H56 <= MAXH5.57) * (ABS(MAXH5.52 < H57 AND H57 > MAXH5.58) * H57 + ABS(MAXH5.52 >= H57 OR H57 <= MAXH5.58) * (ABS(MAXH5.53 < H58 AND H58 > MAXH5.59) * H58 + ABS(MAXH5.53 >= H58 OR H58 <= MAXH5.59) * (ABS(MAXH5.54 < H59 AND H59 > MAXH5.60) * H59 + ABS(MAXH5.54 >= H59 OR H59 <= MAXH5.60) * (ABS(MAXH5.55 < H60 AND H60 > MAXH5.61) * H60 + ABS(MAXH5.55 >= H60 OR H60 <= MAXH5.61) * (ABS(MAXH5.56 < H61 AND H61 > MAXH5.62) * H61 + ABS(MAXH5.56 >= H61 OR H61 <= MAXH5.62) * (ABS(MAXH5.57 < H62 AND H62 > MAXH5.63) * H62 + ABS(MAXH5.57 >= H62 OR H62 <= MAXH5.63) * (ABS(MAXH5.58 < H63 AND H63 > MAXH5.64) * H63 + ABS(MAXH5.58 >= H63 OR H63 <= MAXH5.64) * (ABS(MAXH5.59 < H64 AND H64 > MAXH5.65) * H64 + ABS(MAXH5.59 >= H64 OR H64 <= MAXH5.65) * (ABS(MAXH5.60 < H65 AND H65 > MAXH5.66) * H65 + ABS(MAXH5.60 >= H65 OR H65 <= MAXH5.66) * (C + 1))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |