Registered User Joined: 10/7/2004 Posts: 30
|
I have a PCF where I want to add a rule that rejects any stocks which have a daily gap > than x% of the closing price over the past Y days.
Is there some some simple PCF code I can write to add a rule that says; Do *not* include stocks where the (((H-L1)/C*100)< x) over the past, say 50 days ?
I am trying to add this to an existing PCF which does a 50 day Historical Volatility ranking.
|
|
Worden Trainer
Joined: 10/1/2004 Posts: 18,819
|
No need to add it to an already existing PCF. Keep your PCFs as simple and single-purpose as possible. You can always combine PCFs in EasyScan later.
Here is your formula for Y=10 (you need to fill in the X, note 20% will be X=0.20)
You are using H and L1 so I assume you are looking for a GAP DOWN. I would write your formula a bit differently:
(L1-H)/C< X AND (L2-H1)/C1 < X AND (L3-H2)/C2 < X AND (L4-H3)/C3 < X AND (L5-H4)/C4 < X AND (L6-H5)/C5 < X AND (L7-H6)/C6 < X AND (L8-H7)/C7 < X AND (L9-H8)/C8 < X AND (L10-H9)/C9 < X
- Craig Here to Help!
|
|
Registered User Joined: 8/10/2006 Posts: 23
|
What if you want in fact to count the number of a times a stock has gapped either up or down. How would you do that?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
telster, The following formula would count the number of gaps up and gaps down during the last 100-trading days (defined by comparing the current High and Low to the previous High and Low):
ABS((L > H1) + (L1 > H2) + (L2 > H3) + (L3 > H4) + (L4 > H5) + (L5 > H6) + (L6 > H7) + (L7 > H8) + (L8 > H9) + (L9 > H10) + (L10 > H11) + (L11 > H12) + (L12 > H13) + (L13 > H14) + (L14 > H15) + (L15 > H16) + (L16 > H17) + (L17 > H18) + (L18 > H19) + (L19 > H20) + (L20 > H21) + (L21 > H22) + (L22 > H23) + (L23 > H24) + (L24 > H25) + (L25 > H26) + (L26 > H27) + (L27 > H28) + (L28 > H29) + (L29 > H30) + (L30 > H31) + (L31 > H32) + (L32 > H33) + (L33 > H34) + (L34 > H35) + (L35 > H36) + (L36 > H37) + (L37 > H38) + (L38 > H39) + (L39 > H40) + (L40 > H41) + (L41 > H42) + (L42 > H43) + (L43 > H44) + (L44 > H45) + (L45 > H46) + (L46 > H47) + (L47 > H48) + (L48 > H49) + (L49 > H50) + (L50 > H51) + (L51 > H52) + (L52 > H53) + (L53 > H54) + (L54 > H55) + (L55 > H56) + (L56 > H57) + (L57 > H58) + (L58 > H59) + (L59 > H60) + (L60 > H61) + (L61 > H62) + (L62 > H63) + (L63 > H64) + (L64 > H65) + (L65 > H66) + (L66 > H67) + (L67 > H68) + (L68 > H69) + (L69 > H70) + (L70 > H71) + (L71 > H72) + (L72 > H73) + (L73 > H74) + (L74 > H75) + (L75 > H76) + (L76 > H77) + (L77 > H78) + (L78 > H79) + (L79 > H80) + (L80 > H81) + (L81 > H82) + (L82 > H83) + (L83 > H84) + (L84 > H85) + (L85 > H86) + (L86 > H87) + (L87 > H88) + (L88 > H89) + (L89 > H90) + (L90 > H91) + (L91 > H92) + (L92 > H93) + (L93 > H94) + (L94 > H95) + (L95 > H96) + (L96 > H97) + (L97 > H98) + (L98 > H99) + (L99 > H100) + (H < L1) + (H1 < L2) + (H2 < L3) + (H3 < L4) + (H4 < L5) + (H5 < L6) + (H6 < L7) + (H7 < L8) + (H8 < L9) + (H9 < L10) + (H10 < L11) + (H11 < L12) + (H12 < L13) + (H13 < L14) + (H14 < L15) + (H15 < L16) + (H16 < L17) + (H17 < L18) + (H18 < L19) + (H19 < L20) + (H20 < L21) + (H21 < L22) + (H22 < L23) + (H23 < L24) + (H24 < L25) + (H25 < L26) + (H26 < L27) + (H27 < L28) + (H28 < L29) + (H29 < L30) + (H30 < L31) + (H31 < L32) + (H32 < L33) + (H33 < L34) + (H34 < L35) + (H35 < L36) + (H36 < L37) + (H37 < L38) + (H38 < L39) + (H39 < L40) + (H40 < L41) + (H41 < L42) + (H42 < L43) + (H43 < L44) + (H44 < L45) + (H45 < L46) + (H46 < L47) + (H47 < L48) + (H48 < L49) + (H49 < L50) + (H50 < L51) + (H51 < L52) + (H52 < L53) + (H53 < L54) + (H54 < L55) + (H55 < L56) + (H56 < L57) + (H57 < L58) + (H58 < L59) + (H59 < L60) + (H60 < L61) + (H61 < L62) + (H62 < L63) + (H63 < L64) + (H64 < L65) + (H65 < L66) + (H66 < L67) + (H67 < L68) + (H68 < L69) + (H69 < L70) + (H70 < L71) + (H71 < L72) + (H72 < L73) + (H73 < L74) + (H74 < L75) + (H75 < L76) + (H76 < L77) + (H77 < L78) + (H78 < L79) + (H79 < L80) + (H80 < L81) + (H81 < L82) + (H82 < L83) + (H83 < L84) + (H84 < L85) + (H85 < L86) + (H86 < L87) + (H87 < L88) + (H88 < L89) + (H89 < L90) + (H90 < L91) + (H91 < L92) + (H92 < L93) + (H93 < L94) + (H94 < L95) + (H95 < L96) + (H96 < L97) + (H97 < L98) + (H98 < L99) + (H99 < L100))
You may wish to review the following:
Scan to find potential Stocks that will gap up the next day.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 8/10/2006 Posts: 23
|
Wow. Would it also be possible to count the number of times the MACD cycled from top to bottom in the last few months? Thanks so much Steve
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
telster, Theoretically, yes. The practicality of such a formula would depend on the definitions of cycled, top, bottom, few and your specific MACD settings. In many cases, the formula would not end up being short enough to be practical for actual use.
Some of the simpler methods would count the number of times the MACD crossed through zero or the number of deflections of the MACD above and/or below the zero line.
Once the definitions and technique for identifying a cycle are determined, the exact MACD settings would be required to write a formula:
Short: ? Long: ? Period: ? Average Type: Simple or Exponential Plot MACD as Histogram: Checked or Unchecked
If Plot MACD as Histogram is Unchecked, it would be necessary to know if we were concerned with the Raw MACD (fast line) or its trigger (slow line).
You may wish to review the following:
Understanding MACD
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 8/10/2006 Posts: 23
|
I see that there is a built in formula called stoc. Using this, I can count the number of times in the last 4 days that the stochastic was either above 80 or below 20.
abs((stoc15.5.0 > 80) + (stoc15.5.1 > 80) + (stoc15.5.2 > 80) + (stoc15.5.3 > 80) + (stoc15.5.4 > 80) + (stoc15.5.0 < 20) + (stoc15.5.1 < 20) + (stoc15.5.2 < 20) + (stoc15.5.3 < 20) + (stoc15.5.4 < 20))
But how would I count cycles? Specifically, for the stoc15.5? 1) # of times a stock had cycled to 20, 2) then turned around and reached 80 3) only to turn around and go back to 20 4) etc, etc
Is this possible? Thanks Steve
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
telster, I have not been able to create a practical formula for this so far.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 8/10/2006 Posts: 23
|
Perhaps a compromise. Is there a formula that can count the number of times the stoc15.5 crosses above or below 0? Thanks Steve
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
telster, A Stochastic will never cross through zero. Do you mean when it crosses up or down through the centerline (50)?
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 8/10/2006 Posts: 23
|
yes, sorry about that.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
telster, This can be done with certain constraints. The following should count the number of times this happened during the last 100-Trading Days as long as STOC15.5 does not actually equal 50 during the period:
ABS((SGN(STOC15.5 - 50) <> SGN(STOC15.5.1 - 50)) + (SGN(STOC15.5.1 - 50) <> SGN(STOC15.5.2 - 50)) + (SGN(STOC15.5.2 - 50) <> SGN(STOC15.5.3 - 50)) + (SGN(STOC15.5.3 - 50) <> SGN(STOC15.5.4 - 50)) + (SGN(STOC15.5.4 - 50) <> SGN(STOC15.5.5 - 50)) + (SGN(STOC15.5.5 - 50) <> SGN(STOC15.5.6 - 50)) + (SGN(STOC15.5.6 - 50) <> SGN(STOC15.5.7 - 50)) + (SGN(STOC15.5.7 - 50) <> SGN(STOC15.5.8 - 50)) + (SGN(STOC15.5.8 - 50) <> SGN(STOC15.5.9 - 50)) + (SGN(STOC15.5.9 - 50) <> SGN(STOC15.5.10 - 50)) + (SGN(STOC15.5.10 - 50) <> SGN(STOC15.5.11 - 50)) + (SGN(STOC15.5.11 - 50) <> SGN(STOC15.5.12 - 50)) + (SGN(STOC15.5.12 - 50) <> SGN(STOC15.5.13 - 50)) + (SGN(STOC15.5.13 - 50) <> SGN(STOC15.5.14 - 50)) + (SGN(STOC15.5.14 - 50) <> SGN(STOC15.5.15 - 50)) + (SGN(STOC15.5.15 - 50) <> SGN(STOC15.5.16 - 50)) + (SGN(STOC15.5.16 - 50) <> SGN(STOC15.5.17 - 50)) + (SGN(STOC15.5.17 - 50) <> SGN(STOC15.5.18 - 50)) + (SGN(STOC15.5.18 - 50) <> SGN(STOC15.5.19 - 50)) + (SGN(STOC15.5.19 - 50) <> SGN(STOC15.5.20 - 50)) + (SGN(STOC15.5.20 - 50) <> SGN(STOC15.5.21 - 50)) + (SGN(STOC15.5.21 - 50) <> SGN(STOC15.5.22 - 50)) + (SGN(STOC15.5.22 - 50) <> SGN(STOC15.5.23 - 50)) + (SGN(STOC15.5.23 - 50) <> SGN(STOC15.5.24 - 50)) + (SGN(STOC15.5.24 - 50) <> SGN(STOC15.5.25 - 50)) + (SGN(STOC15.5.25 - 50) <> SGN(STOC15.5.26 - 50)) + (SGN(STOC15.5.26 - 50) <> SGN(STOC15.5.27 - 50)) + (SGN(STOC15.5.27 - 50) <> SGN(STOC15.5.28 - 50)) + (SGN(STOC15.5.28 - 50) <> SGN(STOC15.5.29 - 50)) + (SGN(STOC15.5.29 - 50) <> SGN(STOC15.5.30 - 50)) + (SGN(STOC15.5.30 - 50) <> SGN(STOC15.5.31 - 50)) + (SGN(STOC15.5.31 - 50) <> SGN(STOC15.5.32 - 50)) + (SGN(STOC15.5.32 - 50) <> SGN(STOC15.5.33 - 50)) + (SGN(STOC15.5.33 - 50) <> SGN(STOC15.5.34 - 50)) + (SGN(STOC15.5.34 - 50) <> SGN(STOC15.5.35 - 50)) + (SGN(STOC15.5.35 - 50) <> SGN(STOC15.5.36 - 50)) + (SGN(STOC15.5.36 - 50) <> SGN(STOC15.5.37 - 50)) + (SGN(STOC15.5.37 - 50) <> SGN(STOC15.5.38 - 50)) + (SGN(STOC15.5.38 - 50) <> SGN(STOC15.5.39 - 50)) + (SGN(STOC15.5.39 - 50) <> SGN(STOC15.5.40 - 50)) + (SGN(STOC15.5.40 - 50) <> SGN(STOC15.5.41 - 50)) + (SGN(STOC15.5.41 - 50) <> SGN(STOC15.5.42 - 50)) + (SGN(STOC15.5.42 - 50) <> SGN(STOC15.5.43 - 50)) + (SGN(STOC15.5.43 - 50) <> SGN(STOC15.5.44 - 50)) + (SGN(STOC15.5.44 - 50) <> SGN(STOC15.5.45 - 50)) + (SGN(STOC15.5.45 - 50) <> SGN(STOC15.5.46 - 50)) + (SGN(STOC15.5.46 - 50) <> SGN(STOC15.5.47 - 50)) + (SGN(STOC15.5.47 - 50) <> SGN(STOC15.5.48 - 50)) + (SGN(STOC15.5.48 - 50) <> SGN(STOC15.5.49 - 50)) + (SGN(STOC15.5.49 - 50) <> SGN(STOC15.5.50 - 50)) + (SGN(STOC15.5.50 - 50) <> SGN(STOC15.5.51 - 50)) + (SGN(STOC15.5.51 - 50) <> SGN(STOC15.5.52 - 50)) + (SGN(STOC15.5.52 - 50) <> SGN(STOC15.5.53 - 50)) + (SGN(STOC15.5.53 - 50) <> SGN(STOC15.5.54 - 50)) + (SGN(STOC15.5.54 - 50) <> SGN(STOC15.5.55 - 50)) + (SGN(STOC15.5.55 - 50) <> SGN(STOC15.5.56 - 50)) + (SGN(STOC15.5.56 - 50) <> SGN(STOC15.5.57 - 50)) + (SGN(STOC15.5.57 - 50) <> SGN(STOC15.5.58 - 50)) + (SGN(STOC15.5.58 - 50) <> SGN(STOC15.5.59 - 50)) + (SGN(STOC15.5.59 - 50) <> SGN(STOC15.5.60 - 50)) + (SGN(STOC15.5.60 - 50) <> SGN(STOC15.5.61 - 50)) + (SGN(STOC15.5.61 - 50) <> SGN(STOC15.5.62 - 50)) + (SGN(STOC15.5.62 - 50) <> SGN(STOC15.5.63 - 50)) + (SGN(STOC15.5.63 - 50) <> SGN(STOC15.5.64 - 50)) + (SGN(STOC15.5.64 - 50) <> SGN(STOC15.5.65 - 50)) + (SGN(STOC15.5.65 - 50) <> SGN(STOC15.5.66 - 50)) + (SGN(STOC15.5.66 - 50) <> SGN(STOC15.5.67 - 50)) + (SGN(STOC15.5.67 - 50) <> SGN(STOC15.5.68 - 50)) + (SGN(STOC15.5.68 - 50) <> SGN(STOC15.5.69 - 50)) + (SGN(STOC15.5.69 - 50) <> SGN(STOC15.5.70 - 50)) + (SGN(STOC15.5.70 - 50) <> SGN(STOC15.5.71 - 50)) + (SGN(STOC15.5.71 - 50) <> SGN(STOC15.5.72 - 50)) + (SGN(STOC15.5.72 - 50) <> SGN(STOC15.5.73 - 50)) + (SGN(STOC15.5.73 - 50) <> SGN(STOC15.5.74 - 50)) + (SGN(STOC15.5.74 - 50) <> SGN(STOC15.5.75 - 50)) + (SGN(STOC15.5.75 - 50) <> SGN(STOC15.5.76 - 50)) + (SGN(STOC15.5.76 - 50) <> SGN(STOC15.5.77 - 50)) + (SGN(STOC15.5.77 - 50) <> SGN(STOC15.5.78 - 50)) + (SGN(STOC15.5.78 - 50) <> SGN(STOC15.5.79 - 50)) + (SGN(STOC15.5.79 - 50) <> SGN(STOC15.5.80 - 50)) + (SGN(STOC15.5.80 - 50) <> SGN(STOC15.5.81 - 50)) + (SGN(STOC15.5.81 - 50) <> SGN(STOC15.5.82 - 50)) + (SGN(STOC15.5.82 - 50) <> SGN(STOC15.5.83 - 50)) + (SGN(STOC15.5.83 - 50) <> SGN(STOC15.5.84 - 50)) + (SGN(STOC15.5.84 - 50) <> SGN(STOC15.5.85 - 50)) + (SGN(STOC15.5.85 - 50) <> SGN(STOC15.5.86 - 50)) + (SGN(STOC15.5.86 - 50) <> SGN(STOC15.5.87 - 50)) + (SGN(STOC15.5.87 - 50) <> SGN(STOC15.5.88 - 50)) + (SGN(STOC15.5.88 - 50) <> SGN(STOC15.5.89 - 50)) + (SGN(STOC15.5.89 - 50) <> SGN(STOC15.5.90 - 50)) + (SGN(STOC15.5.90 - 50) <> SGN(STOC15.5.91 - 50)) + (SGN(STOC15.5.91 - 50) <> SGN(STOC15.5.92 - 50)) + (SGN(STOC15.5.92 - 50) <> SGN(STOC15.5.93 - 50)) + (SGN(STOC15.5.93 - 50) <> SGN(STOC15.5.94 - 50)) + (SGN(STOC15.5.94 - 50) <> SGN(STOC15.5.95 - 50)) + (SGN(STOC15.5.95 - 50) <> SGN(STOC15.5.96 - 50)) + (SGN(STOC15.5.96 - 50) <> SGN(STOC15.5.97 - 50)) + (SGN(STOC15.5.97 - 50) <> SGN(STOC15.5.98 - 50)) + (SGN(STOC15.5.98 - 50) <> SGN(STOC15.5.99 - 50)) + (SGN(STOC15.5.99 - 50) <> SGN(STOC15.5.100 - 50)))
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 8/10/2006 Posts: 23
|
Would this do it? ABS( (stoc15.5.1 < 50 AND stoc15.5.0 > 50) + (stoc15.5.2 < 50 AND stoc15.5.1 > 50) + (stoc15.5.3 < 50 AND stoc15.5.2 > 50) )
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
telster, Your formula should count the number of times STOC15.5 crossed up through 50 during the last 3-Periods (with similar constraints about STOC15.5 not being equal to zero as occur with the formula I provided).
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 8/10/2006 Posts: 23
|
OK. Great. Then perhaps the questions become this: 1) Let's call your formula for counting crosses as #A. 2) And we could make another one for counting crosses up to a high point on the sotchastic. Let's say that this is formula #B and the high point on the stochastic is what 80, does that make sense? 3) Then we could have another for crosses down to 20. Formula #C.
If a stock has crosses of #a and #b and #c, then that might indicate an stochastic that regularly oscilates. But it would be better to be able to identify a stock that first hits a low point on the stochastic, then crosses above 50, then moves on up to a high point.
The ability to isolate this kind of sequence then count it would be useful.
Or if you could export the data for the stochastic, I could do this with another program. Does snapcharts allow exporting? Steve
|
|
Registered User Joined: 8/10/2006 Posts: 23
|
I am guessing we can't get the data for stochastic out of tc2000. So how about this? Is there a way to write a formula that asks the following:
Within the last 40 days, did 1) the stoc15.5 crossover 50 2) the stoc15.5 cross below 20 3) the stoc15.5 cross above 80
If it meets these 3 conditions, then we can assume that the stochastic oscilated from 20 up to 80, or 1/2 of a cycle.
But my problem is this, how do I ask if something happened within the last 40 days. For instance, what does the following really tell me?
(stoc15.5.40 < 50 AND stoc15.5.0 > 50)
It asks if the stoc from 40 days ago was below 50 as compared to todays. But it does not ask if at anytime in the last 40 days, was the stoc below 50 Steve
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
telster, The following should count the number of times STOC15.5 crossed up through 80 during the last 100-Trading Days as long as STOC15.5 does not actually equal 80 during the period:
ABS((SGN(STOC15.5 - 80) > SGN(STOC15.5.1 - 80)) + (SGN(STOC15.5.1 - 80) > SGN(STOC15.5.2 - 80)) + (SGN(STOC15.5.2 - 80) > SGN(STOC15.5.3 - 80)) + (SGN(STOC15.5.3 - 80) > SGN(STOC15.5.4 - 80)) + (SGN(STOC15.5.4 - 80) > SGN(STOC15.5.5 - 80)) + (SGN(STOC15.5.5 - 80) > SGN(STOC15.5.6 - 80)) + (SGN(STOC15.5.6 - 80) > SGN(STOC15.5.7 - 80)) + (SGN(STOC15.5.7 - 80) > SGN(STOC15.5.8 - 80)) + (SGN(STOC15.5.8 - 80) > SGN(STOC15.5.9 - 80)) + (SGN(STOC15.5.9 - 80) > SGN(STOC15.5.10 - 80)) + (SGN(STOC15.5.10 - 80) > SGN(STOC15.5.11 - 80)) + (SGN(STOC15.5.11 - 80) > SGN(STOC15.5.12 - 80)) + (SGN(STOC15.5.12 - 80) > SGN(STOC15.5.13 - 80)) + (SGN(STOC15.5.13 - 80) > SGN(STOC15.5.14 - 80)) + (SGN(STOC15.5.14 - 80) > SGN(STOC15.5.15 - 80)) + (SGN(STOC15.5.15 - 80) > SGN(STOC15.5.16 - 80)) + (SGN(STOC15.5.16 - 80) > SGN(STOC15.5.17 - 80)) + (SGN(STOC15.5.17 - 80) > SGN(STOC15.5.18 - 80)) + (SGN(STOC15.5.18 - 80) > SGN(STOC15.5.19 - 80)) + (SGN(STOC15.5.19 - 80) > SGN(STOC15.5.20 - 80)) + (SGN(STOC15.5.20 - 80) > SGN(STOC15.5.21 - 80)) + (SGN(STOC15.5.21 - 80) > SGN(STOC15.5.22 - 80)) + (SGN(STOC15.5.22 - 80) > SGN(STOC15.5.23 - 80)) + (SGN(STOC15.5.23 - 80) > SGN(STOC15.5.24 - 80)) + (SGN(STOC15.5.24 - 80) > SGN(STOC15.5.25 - 80)) + (SGN(STOC15.5.25 - 80) > SGN(STOC15.5.26 - 80)) + (SGN(STOC15.5.26 - 80) > SGN(STOC15.5.27 - 80)) + (SGN(STOC15.5.27 - 80) > SGN(STOC15.5.28 - 80)) + (SGN(STOC15.5.28 - 80) > SGN(STOC15.5.29 - 80)) + (SGN(STOC15.5.29 - 80) > SGN(STOC15.5.30 - 80)) + (SGN(STOC15.5.30 - 80) > SGN(STOC15.5.31 - 80)) + (SGN(STOC15.5.31 - 80) > SGN(STOC15.5.32 - 80)) + (SGN(STOC15.5.32 - 80) > SGN(STOC15.5.33 - 80)) + (SGN(STOC15.5.33 - 80) > SGN(STOC15.5.34 - 80)) + (SGN(STOC15.5.34 - 80) > SGN(STOC15.5.35 - 80)) + (SGN(STOC15.5.35 - 80) > SGN(STOC15.5.36 - 80)) + (SGN(STOC15.5.36 - 80) > SGN(STOC15.5.37 - 80)) + (SGN(STOC15.5.37 - 80) > SGN(STOC15.5.38 - 80)) + (SGN(STOC15.5.38 - 80) > SGN(STOC15.5.39 - 80)) + (SGN(STOC15.5.39 - 80) > SGN(STOC15.5.40 - 80)) + (SGN(STOC15.5.40 - 80) > SGN(STOC15.5.41 - 80)) + (SGN(STOC15.5.41 - 80) > SGN(STOC15.5.42 - 80)) + (SGN(STOC15.5.42 - 80) > SGN(STOC15.5.43 - 80)) + (SGN(STOC15.5.43 - 80) > SGN(STOC15.5.44 - 80)) + (SGN(STOC15.5.44 - 80) > SGN(STOC15.5.45 - 80)) + (SGN(STOC15.5.45 - 80) > SGN(STOC15.5.46 - 80)) + (SGN(STOC15.5.46 - 80) > SGN(STOC15.5.47 - 80)) + (SGN(STOC15.5.47 - 80) > SGN(STOC15.5.48 - 80)) + (SGN(STOC15.5.48 - 80) > SGN(STOC15.5.49 - 80)) + (SGN(STOC15.5.49 - 80) > SGN(STOC15.5.50 - 80)) + (SGN(STOC15.5.50 - 80) > SGN(STOC15.5.51 - 80)) + (SGN(STOC15.5.51 - 80) > SGN(STOC15.5.52 - 80)) + (SGN(STOC15.5.52 - 80) > SGN(STOC15.5.53 - 80)) + (SGN(STOC15.5.53 - 80) > SGN(STOC15.5.54 - 80)) + (SGN(STOC15.5.54 - 80) > SGN(STOC15.5.55 - 80)) + (SGN(STOC15.5.55 - 80) > SGN(STOC15.5.56 - 80)) + (SGN(STOC15.5.56 - 80) > SGN(STOC15.5.57 - 80)) + (SGN(STOC15.5.57 - 80) > SGN(STOC15.5.58 - 80)) + (SGN(STOC15.5.58 - 80) > SGN(STOC15.5.59 - 80)) + (SGN(STOC15.5.59 - 80) > SGN(STOC15.5.60 - 80)) + (SGN(STOC15.5.60 - 80) > SGN(STOC15.5.61 - 80)) + (SGN(STOC15.5.61 - 80) > SGN(STOC15.5.62 - 80)) + (SGN(STOC15.5.62 - 80) > SGN(STOC15.5.63 - 80)) + (SGN(STOC15.5.63 - 80) > SGN(STOC15.5.64 - 80)) + (SGN(STOC15.5.64 - 80) > SGN(STOC15.5.65 - 80)) + (SGN(STOC15.5.65 - 80) > SGN(STOC15.5.66 - 80)) + (SGN(STOC15.5.66 - 80) > SGN(STOC15.5.67 - 80)) + (SGN(STOC15.5.67 - 80) > SGN(STOC15.5.68 - 80)) + (SGN(STOC15.5.68 - 80) > SGN(STOC15.5.69 - 80)) + (SGN(STOC15.5.69 - 80) > SGN(STOC15.5.70 - 80)) + (SGN(STOC15.5.70 - 80) > SGN(STOC15.5.71 - 80)) + (SGN(STOC15.5.71 - 80) > SGN(STOC15.5.72 - 80)) + (SGN(STOC15.5.72 - 80) > SGN(STOC15.5.73 - 80)) + (SGN(STOC15.5.73 - 80) > SGN(STOC15.5.74 - 80)) + (SGN(STOC15.5.74 - 80) > SGN(STOC15.5.75 - 80)) + (SGN(STOC15.5.75 - 80) > SGN(STOC15.5.76 - 80)) + (SGN(STOC15.5.76 - 80) > SGN(STOC15.5.77 - 80)) + (SGN(STOC15.5.77 - 80) > SGN(STOC15.5.78 - 80)) + (SGN(STOC15.5.78 - 80) > SGN(STOC15.5.79 - 80)) + (SGN(STOC15.5.79 - 80) > SGN(STOC15.5.80 - 80)) + (SGN(STOC15.5.80 - 80) > SGN(STOC15.5.81 - 80)) + (SGN(STOC15.5.81 - 80) > SGN(STOC15.5.82 - 80)) + (SGN(STOC15.5.82 - 80) > SGN(STOC15.5.83 - 80)) + (SGN(STOC15.5.83 - 80) > SGN(STOC15.5.84 - 80)) + (SGN(STOC15.5.84 - 80) > SGN(STOC15.5.85 - 80)) + (SGN(STOC15.5.85 - 80) > SGN(STOC15.5.86 - 80)) + (SGN(STOC15.5.86 - 80) > SGN(STOC15.5.87 - 80)) + (SGN(STOC15.5.87 - 80) > SGN(STOC15.5.88 - 80)) + (SGN(STOC15.5.88 - 80) > SGN(STOC15.5.89 - 80)) + (SGN(STOC15.5.89 - 80) > SGN(STOC15.5.90 - 80)) + (SGN(STOC15.5.90 - 80) > SGN(STOC15.5.91 - 80)) + (SGN(STOC15.5.91 - 80) > SGN(STOC15.5.92 - 80)) + (SGN(STOC15.5.92 - 80) > SGN(STOC15.5.93 - 80)) + (SGN(STOC15.5.93 - 80) > SGN(STOC15.5.94 - 80)) + (SGN(STOC15.5.94 - 80) > SGN(STOC15.5.95 - 80)) + (SGN(STOC15.5.95 - 80) > SGN(STOC15.5.96 - 80)) + (SGN(STOC15.5.96 - 80) > SGN(STOC15.5.97 - 80)) + (SGN(STOC15.5.97 - 80) > SGN(STOC15.5.98 - 80)) + (SGN(STOC15.5.98 - 80) > SGN(STOC15.5.99 - 80)) + (SGN(STOC15.5.99 - 80) > SGN(STOC15.5.100 - 80)))
The following should count the number of times STOC15.5 crossed down through 20 during the last 100-Trading Days as long as STOC15.5 does not actually equal 20 during the period:
ABS((SGN(STOC15.5 - 20) < SGN(STOC15.5.1 - 20)) + (SGN(STOC15.5.1 - 20) < SGN(STOC15.5.2 - 20)) + (SGN(STOC15.5.2 - 20) < SGN(STOC15.5.3 - 20)) + (SGN(STOC15.5.3 - 20) < SGN(STOC15.5.4 - 20)) + (SGN(STOC15.5.4 - 20) < SGN(STOC15.5.5 - 20)) + (SGN(STOC15.5.5 - 20) < SGN(STOC15.5.6 - 20)) + (SGN(STOC15.5.6 - 20) < SGN(STOC15.5.7 - 20)) + (SGN(STOC15.5.7 - 20) < SGN(STOC15.5.8 - 20)) + (SGN(STOC15.5.8 - 20) < SGN(STOC15.5.9 - 20)) + (SGN(STOC15.5.9 - 20) < SGN(STOC15.5.10 - 20)) + (SGN(STOC15.5.10 - 20) < SGN(STOC15.5.11 - 20)) + (SGN(STOC15.5.11 - 20) < SGN(STOC15.5.12 - 20)) + (SGN(STOC15.5.12 - 20) < SGN(STOC15.5.13 - 20)) + (SGN(STOC15.5.13 - 20) < SGN(STOC15.5.14 - 20)) + (SGN(STOC15.5.14 - 20) < SGN(STOC15.5.15 - 20)) + (SGN(STOC15.5.15 - 20) < SGN(STOC15.5.16 - 20)) + (SGN(STOC15.5.16 - 20) < SGN(STOC15.5.17 - 20)) + (SGN(STOC15.5.17 - 20) < SGN(STOC15.5.18 - 20)) + (SGN(STOC15.5.18 - 20) < SGN(STOC15.5.19 - 20)) + (SGN(STOC15.5.19 - 20) < SGN(STOC15.5.20 - 20)) + (SGN(STOC15.5.20 - 20) < SGN(STOC15.5.21 - 20)) + (SGN(STOC15.5.21 - 20) < SGN(STOC15.5.22 - 20)) + (SGN(STOC15.5.22 - 20) < SGN(STOC15.5.23 - 20)) + (SGN(STOC15.5.23 - 20) < SGN(STOC15.5.24 - 20)) + (SGN(STOC15.5.24 - 20) < SGN(STOC15.5.25 - 20)) + (SGN(STOC15.5.25 - 20) < SGN(STOC15.5.26 - 20)) + (SGN(STOC15.5.26 - 20) < SGN(STOC15.5.27 - 20)) + (SGN(STOC15.5.27 - 20) < SGN(STOC15.5.28 - 20)) + (SGN(STOC15.5.28 - 20) < SGN(STOC15.5.29 - 20)) + (SGN(STOC15.5.29 - 20) < SGN(STOC15.5.30 - 20)) + (SGN(STOC15.5.30 - 20) < SGN(STOC15.5.31 - 20)) + (SGN(STOC15.5.31 - 20) < SGN(STOC15.5.32 - 20)) + (SGN(STOC15.5.32 - 20) < SGN(STOC15.5.33 - 20)) + (SGN(STOC15.5.33 - 20) < SGN(STOC15.5.34 - 20)) + (SGN(STOC15.5.34 - 20) < SGN(STOC15.5.35 - 20)) + (SGN(STOC15.5.35 - 20) < SGN(STOC15.5.36 - 20)) + (SGN(STOC15.5.36 - 20) < SGN(STOC15.5.37 - 20)) + (SGN(STOC15.5.37 - 20) < SGN(STOC15.5.38 - 20)) + (SGN(STOC15.5.38 - 20) < SGN(STOC15.5.39 - 20)) + (SGN(STOC15.5.39 - 20) < SGN(STOC15.5.40 - 20)) + (SGN(STOC15.5.40 - 20) < SGN(STOC15.5.41 - 20)) + (SGN(STOC15.5.41 - 20) < SGN(STOC15.5.42 - 20)) + (SGN(STOC15.5.42 - 20) < SGN(STOC15.5.43 - 20)) + (SGN(STOC15.5.43 - 20) < SGN(STOC15.5.44 - 20)) + (SGN(STOC15.5.44 - 20) < SGN(STOC15.5.45 - 20)) + (SGN(STOC15.5.45 - 20) < SGN(STOC15.5.46 - 20)) + (SGN(STOC15.5.46 - 20) < SGN(STOC15.5.47 - 20)) + (SGN(STOC15.5.47 - 20) < SGN(STOC15.5.48 - 20)) + (SGN(STOC15.5.48 - 20) < SGN(STOC15.5.49 - 20)) + (SGN(STOC15.5.49 - 20) < SGN(STOC15.5.50 - 20)) + (SGN(STOC15.5.50 - 20) < SGN(STOC15.5.51 - 20)) + (SGN(STOC15.5.51 - 20) < SGN(STOC15.5.52 - 20)) + (SGN(STOC15.5.52 - 20) < SGN(STOC15.5.53 - 20)) + (SGN(STOC15.5.53 - 20) < SGN(STOC15.5.54 - 20)) + (SGN(STOC15.5.54 - 20) < SGN(STOC15.5.55 - 20)) + (SGN(STOC15.5.55 - 20) < SGN(STOC15.5.56 - 20)) + (SGN(STOC15.5.56 - 20) < SGN(STOC15.5.57 - 20)) + (SGN(STOC15.5.57 - 20) < SGN(STOC15.5.58 - 20)) + (SGN(STOC15.5.58 - 20) < SGN(STOC15.5.59 - 20)) + (SGN(STOC15.5.59 - 20) < SGN(STOC15.5.60 - 20)) + (SGN(STOC15.5.60 - 20) < SGN(STOC15.5.61 - 20)) + (SGN(STOC15.5.61 - 20) < SGN(STOC15.5.62 - 20)) + (SGN(STOC15.5.62 - 20) < SGN(STOC15.5.63 - 20)) + (SGN(STOC15.5.63 - 20) < SGN(STOC15.5.64 - 20)) + (SGN(STOC15.5.64 - 20) < SGN(STOC15.5.65 - 20)) + (SGN(STOC15.5.65 - 20) < SGN(STOC15.5.66 - 20)) + (SGN(STOC15.5.66 - 20) < SGN(STOC15.5.67 - 20)) + (SGN(STOC15.5.67 - 20) < SGN(STOC15.5.68 - 20)) + (SGN(STOC15.5.68 - 20) < SGN(STOC15.5.69 - 20)) + (SGN(STOC15.5.69 - 20) < SGN(STOC15.5.70 - 20)) + (SGN(STOC15.5.70 - 20) < SGN(STOC15.5.71 - 20)) + (SGN(STOC15.5.71 - 20) < SGN(STOC15.5.72 - 20)) + (SGN(STOC15.5.72 - 20) < SGN(STOC15.5.73 - 20)) + (SGN(STOC15.5.73 - 20) < SGN(STOC15.5.74 - 20)) + (SGN(STOC15.5.74 - 20) < SGN(STOC15.5.75 - 20)) + (SGN(STOC15.5.75 - 20) < SGN(STOC15.5.76 - 20)) + (SGN(STOC15.5.76 - 20) < SGN(STOC15.5.77 - 20)) + (SGN(STOC15.5.77 - 20) < SGN(STOC15.5.78 - 20)) + (SGN(STOC15.5.78 - 20) < SGN(STOC15.5.79 - 20)) + (SGN(STOC15.5.79 - 20) < SGN(STOC15.5.80 - 20)) + (SGN(STOC15.5.80 - 20) < SGN(STOC15.5.81 - 20)) + (SGN(STOC15.5.81 - 20) < SGN(STOC15.5.82 - 20)) + (SGN(STOC15.5.82 - 20) < SGN(STOC15.5.83 - 20)) + (SGN(STOC15.5.83 - 20) < SGN(STOC15.5.84 - 20)) + (SGN(STOC15.5.84 - 20) < SGN(STOC15.5.85 - 20)) + (SGN(STOC15.5.85 - 20) < SGN(STOC15.5.86 - 20)) + (SGN(STOC15.5.86 - 20) < SGN(STOC15.5.87 - 20)) + (SGN(STOC15.5.87 - 20) < SGN(STOC15.5.88 - 20)) + (SGN(STOC15.5.88 - 20) < SGN(STOC15.5.89 - 20)) + (SGN(STOC15.5.89 - 20) < SGN(STOC15.5.90 - 20)) + (SGN(STOC15.5.90 - 20) < SGN(STOC15.5.91 - 20)) + (SGN(STOC15.5.91 - 20) < SGN(STOC15.5.92 - 20)) + (SGN(STOC15.5.92 - 20) < SGN(STOC15.5.93 - 20)) + (SGN(STOC15.5.93 - 20) < SGN(STOC15.5.94 - 20)) + (SGN(STOC15.5.94 - 20) < SGN(STOC15.5.95 - 20)) + (SGN(STOC15.5.95 - 20) < SGN(STOC15.5.96 - 20)) + (SGN(STOC15.5.96 - 20) < SGN(STOC15.5.97 - 20)) + (SGN(STOC15.5.97 - 20) < SGN(STOC15.5.98 - 20)) + (SGN(STOC15.5.98 - 20) < SGN(STOC15.5.99 - 20)) + (SGN(STOC15.5.99 - 20) < SGN(STOC15.5.100 - 20)))
QUOTE (telster) But it would be better to be able to identify a stock that first hits a low point on the stochastic, then crosses above 50, then moves on up to a high point.
The ability to isolate this kind of sequence then count it would be useful. But none of the formulas I've worked on to do this have actually been practical.
QUOTE (telster) Or if you could export the data for the stochastic, I could do this with another program. Does snapcharts allow exporting? This information is not currently directly exportable using either TeleChart or Blocks Player. If you have programming experience, it is possible to access the information using the TeleChart Developer Kit (TCDK) however.
QUOTE (telster) Is there a way to write a formula that asks the following:
Within the last 40 days, did 1) the stoc15.5 crossover 50 2) the stoc15.5 cross below 20 3) the stoc15.5 cross above 80
If it meets these 3 conditions, then we can assume that the stochastic oscilated from 20 up to 80, or 1/2 of a cycle. The above would actually allow you to count the number of times each condition was met.
QUOTE (telster) For instance, what does the following really tell me?
(stoc15.5.40 < 50 AND stoc15.5.0 > 50)
It asks if the stoc from 40 days ago was below 50 as compared to todays. But it does not ask if at anytime in the last 40 days, was the stoc below 50 True. I do not know why you would use that formula based on what you've indicated you wish to find.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 8/10/2006 Posts: 23
|
I do have programming experience. I have tried to use the TeleChart Developer Kit (TCDK). But was unable to figure out how to 1) get price data or 2) something like stochastic values. Can you provide an example that can do this
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
telster, Located in the TeleChart folder is a TCDK subfolder. (By default C:\Program Files\TeleChart\TCDK) It includes documentation on the TeleChart Developer's Kit.
Any questions not answered there can be emailed to TCDK@worden.com or asked in the TeleChart Developer Kit (TCDK) forum.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 6/30/2006 Posts: 6
|
I am trying to create a PCF that I can add to an EASY SCAN that will show me all stocks that have open candels through the 50 DMA. This is the formula I am using: ( O <= AVGC50 AND C >= AVGC50) AND C > O.
The formula looks like it works but does not match the 50dma plotted on the charts.I am using a 50 Simple MA on the charts. What is up?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
ramjet777, Assuming you want the intersection to be of the Body of the Candle and not the entire candle the most likely reason for the Personal Criteria Formula to not match your charts would be that the charted Moving Average is Exponential while the PCF is using Simple Moving Averages. Please try the following:
O <= XAVGC50 AND XAVGC50 <= C AND O < C
You may wish to review the following:
Things to check if your moving averages don't "seem right" or "seem to match" Handy PCF example formulas to help you learn the syntax of PCFs! How to create a Personal Criteria Forumula (PCF)
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 6/30/2006 Posts: 6
|
Thanks!
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
ramjet777, You're welcome. Our pleasure.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |