Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 7/23/2005 Posts: 39
|
HI How can I create a PCF to scan stocks last 21 days price never cut through 20d sma? Thanks Song
|
|
Worden Trainer
Joined: 10/1/2004 Posts: 4,308
|
There may be shorter ways to do this, but the long way will ensure that price never cut through the moving average. This formula uses the low price of each day, so that price will have never touched the moving average at any time during the day. If you want to base your scan on closing prices, replace each L with C.
L20>AVGC20.20 AND L19>AVGC20.19 AND L18>AVGC20.18 AND L17>AVGC20.17 AND L16>AVGC20.16 AND L15>AVGC20.15 AND L14>AVGC20.14 AND L13>AVGC20.13 AND L12>AVGC20.12 AND L11>AVGC20.11 AND L10>AVGC20.10 AND L9>AVGC20.9 AND L8>AVGC20.8 AND L7>AVGC20.7 AND L6>AVGC20.6 AND L5>AVGC20.5 AND L4>AVGC20.4 AND L3>AVGC20.3 AND L2>AVGC20.2 AND L1>AVGC20.1 AND L>AVGC20
- Doug Teaching Online!
|
|
Registered User Joined: 7/23/2005 Posts: 39
|
Thanks, What is the shorter version to my questions since I am also looking for a longer periods. Song
|
|
Worden Trainer
Joined: 10/1/2004 Posts: 4,308
|
You could include, perhaps, every third period from the formula above as sort of a spot check, and you'll likely only run into a few stocks that have violated your condition. Including every period above, though, you can be sure that the price will have never violated the moving average during the entire period.
If you want longer periods, just copy and paste from above, and then change the numbers to reflect the period you want. A little extra work up front, but if you use the PCF for a long time, it makes sense to make it as accurate as possible up front.
- Doug Teaching Online!
|
|
Registered User Joined: 7/23/2005 Posts: 39
|
I am wondering whether MINLn will return a number and incorporate that number into AVGCn to create a condition, like MINL90>AVGC20.(MINL90)? thanks
|
|
Worden Trainer
Joined: 10/1/2004 Posts: 4,308
|
Can't do it. MINL90 is fine by itself, but not after the period following AVGC20.
- Doug Teaching Online!
|
|
Registered User Joined: 10/7/2004 Posts: 43
|
...Here is longer period , 6-months, but I noticed its not accurate as 21 days price ...why..??
L120>AVGC20.120 AND L119>AVGC20.119 AND L118>AVGC20.118 AND L117>AVGC20.117 AND L116>AVGC20.116 AND L115>AVGC20.115 AND L114>AVGC20.114 AND L113>AVGC20.113 AND L112>AVGC20.112 AND L111>AVGC20.111 AND L110>AVGC20.110 AND L109>AVGC20.109 AND L108>AVGC20.108 AND L107>AVGC20.107 AND L106>AVGC20.106 AND L105>AVGC20.105 AND L104>AVGC20.104 AND L103>AVGC103 L102>AVGC20.102 AND L101>AVGC20.101 AND L100>AVGC20.100 AND L99>AVGC20.99 AND L98>AVGC20.98 AND L97>AVGC20.97 AND L96>AVGC20.96 AND L95>AVGC20.95 AND L94>AVGC20.94 AND L93>AVGC20.93 AND L92>AVGC20.92 AND L91>AVGC20.91 AND L90>AVGC20.90 AND L89>AVGC20.89 AND L88>AVGC20.88 AND L87>AVGC20.87 AND L86>AVGC20.86 AND L85>AVGC20.85 AND L84>AVGC20.84 AND L83>AVGC20.83 AND L82>AVGC82 L81>AVGC20.81 AND L80>AVGC20.80 AND L79>AVGC20.79 AND L78>AVGC20.78 AND L77>AVGC20.77 AND L76>AVGC20.76 AND L56>AVGC20.56 AND L55>AVGC20.55 AND L75>AVGC20.75 AND L74>AVGC20.74 AND L73>AVGC20.73 AND L72>AVGC20.72 AND L71>AVGC20.71 AND L70>AVGC20.70 AND L69>AVGC20.69 AND L68>AVGC20.68 AND L67>AVGC20.67 AND L66>AVGC20.66 AND L65>AVGC20.65 AND L64>AVGC20.64 AND L63>AVGC63 L62>AVGC20.62 AND L61>AVGC20.61 AND L60>AVGC20.60 AND L59>AVGC20.59 AND L58>AVGC20.58 AND L57>AVGC20.57 AND L56>AVGC20.56 AND L55>AVGC20.55 AND L54>AVGC20.54 AND L53>AVGC20.53 AND L52>AVGC20.52 AND L51>AVGC20.51 AND L50>AVGC20.50 AND L49>AVGC20.49 AND L48>AVGC20.48 AND L47>AVGC20.47 AND L46>AVGC20.46 AND L45>AVGC20.45 AND L44>AVGC20.44 AND L43>AVGC20.43 AND L42>AVGC42 L41>AVGC20.41 AND L40>AVGC20.40 AND L39>AVGC20.39 AND L38>AVGC20.38 AND L37>AVGC20.37 AND L36>AVGC20.36 AND L35>AVGC20.35 AND L34>AVGC20.34 AND L33>AVGC20.33 AND L32>AVGC20.32 AND L31>AVGC20.31 AND L30>AVGC20.30 AND L29>AVGC20.29 AND L28>AVGC20.28 AND L27>AVGC20.27 AND L26>AVGC20.26 AND L25>AVGC20.25 AND L24>AVGC20.24 AND L23>AVGC20.23 AND L22>AVGC20.22 AND L21>AVGC21 L20>AVGC20.20 AND L19>AVGC20.19 AND L18>AVGC20.18 AND L17>AVGC20.17 AND L16>AVGC20.16 AND L15>AVGC20.15 AND L14>AVGC20.14 AND L13>AVGC20.13 AND L12>AVGC20.12 AND L11>AVGC20.11 AND L10>AVGC20.10 AND L9>AVGC20.9 AND L8>AVGC20.8 AND L7>AVGC20.7 AND L6>AVGC20.6 AND L5>AVGC20.5 AND L4>AVGC20.4 AND L3>AVGC20.3 AND L2>AVGC20.2 AND L1>AVGC20.1 AND L>AVGC20
|
|
Worden Trainer
Joined: 10/1/2004 Posts: 18,819
|
What do you mean by "not accurate"?
- Craig Here to Help!
|
|
Registered User Joined: 10/7/2004 Posts: 43
|
Actually, I noticed prices are cutting MANY TIMES through 20d sma..and not like when we are using 21 days..? Maybe something is missing from my formula..???
|
|
Registered User Joined: 7/23/2005 Posts: 39
|
I did not notice any "or" in your formula. I guess 20dsma is calculated based on 20 bar from today and 180d price goes beyond that. Song
|
|
Worden Trainer
Joined: 10/1/2004 Posts: 18,819
|
Looking over your formula I found a few typo errors.
Asking a stock to keep its lows above such a short-term MA as 20 for six months is steep. So steep that, as of last market day, not one stock was able to do it.
Here is the correct formula. I would either reduce the number of terms (down to 3 or less months) or increase the 20 to something else.
L>AVGC20 AND L1>AVGC20.1 AND L2>AVGC20.2 AND L3>AVGC20.3 AND L4>AVGC20.4 AND L5>AVGC20.5 AND L6>AVGC20.6 AND L7>AVGC20.7 AND L8>AVGC20.8 AND L9>AVGC20.9 AND L10>AVGC20.10 AND L11>AVGC20.11 AND L12>AVGC20.12 AND L13>AVGC20.13 AND L14>AVGC20.14 AND L15>AVGC20.15 AND L16>AVGC20.16 AND L17>AVGC20.17 AND L18>AVGC20.18 AND L19>AVGC20.19 AND L20>AVGC20.20 AND L21>AVGC20.21 AND L22>AVGC20.22 AND L23>AVGC20.23 AND L24>AVGC20.24 AND L25>AVGC20.25 AND L26>AVGC20.26 AND L27>AVGC20.27 AND L28>AVGC20.28 AND L29>AVGC20.29 AND L30>AVGC20.30 AND L31>AVGC20.31 AND L32>AVGC20.32 AND L33>AVGC20.33 AND L34>AVGC20.34 AND L35>AVGC20.35 AND L36>AVGC20.36 AND L37>AVGC20.37 AND L38>AVGC20.38 AND L39>AVGC20.39 AND L40>AVGC20.40 AND L41>AVGC20.41 AND L42>AVGC20.42 AND L43>AVGC20.43 AND L44>AVGC20.44 AND L45>AVGC20.45 AND L46>AVGC20.46 AND L47>AVGC20.47 AND L48>AVGC20.48 AND L49>AVGC20.49 AND L50>AVGC20.50 AND L51>AVGC20.51 AND L52>AVGC20.52 AND L53>AVGC20.53 AND L54>AVGC20.54 AND L55>AVGC20.55 AND L56>AVGC20.56 AND L57>AVGC20.57 AND L58>AVGC20.58 AND L59>AVGC20.59 AND L60>AVGC20.60 AND L61>AVGC20.61 AND L62>AVGC20.62 AND L63>AVGC20.63 AND L64>AVGC20.64 AND L65>AVGC20.65 AND L66>AVGC20.66 AND L67>AVGC20.67 AND L68>AVGC20.68 AND L69>AVGC20.69 AND L70>AVGC20.70 AND L71>AVGC20.71 AND L72>AVGC20.72 AND L73>AVGC20.73 AND L74>AVGC20.74 AND L75>AVGC20.75 AND L76>AVGC20.76 AND L77>AVGC20.77 AND L78>AVGC20.78 AND L79>AVGC20.79 AND L80>AVGC20.80 AND L81>AVGC20.81 AND L82>AVGC20.82 AND L83>AVGC20.83 AND L84>AVGC20.84 AND L85>AVGC20.85 AND L86>AVGC20.86 AND L87>AVGC20.87 AND L88>AVGC20.88 AND L89>AVGC20.89 AND L90>AVGC20.90 AND L91>AVGC20.91 AND L92>AVGC20.92 AND L93>AVGC20.93 AND L94>AVGC20.94 AND L95>AVGC20.95 AND L96>AVGC20.96 AND L97>AVGC20.97 AND L98>AVGC20.98 AND L99>AVGC20.99 AND L100>AVGC20.100 AND L101>AVGC20.101 AND L102>AVGC20.102 AND L103>AVGC20.103 AND L104>AVGC20.104 AND L105>AVGC20.105 AND L106>AVGC20.106 AND L107>AVGC20.107 AND L108>AVGC20.108 AND L109>AVGC20.109 AND L110>AVGC20.110 AND L111>AVGC20.111 AND L112>AVGC20.112 AND L113>AVGC20.113 AND L114>AVGC20.114 AND L115>AVGC20.115 AND L116>AVGC20.116 AND L117>AVGC20.117 AND L118>AVGC20.118 AND L119>AVGC20.119 AND L120>AVGC20.120
- Craig Here to Help!
|
|
Registered User Joined: 10/7/2004 Posts: 43
|
..Thanks Craig. The one you created is good. I test it and I found two really good stocks: ASGN & ITG. Thanks again.
|
|
Guest-1 |