Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 10/7/2004 Posts: 1,178
|
I'd like a PCF that places the Close a small percentage above or below a 40-Period Forward-Weighted Moving Average.
Also, the same PCF, calculated with a 40-Period Exponential Moving Average.
Thanks for your work, Bruce!
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
A Condition Formula for price being within 1% of a 40-Period Front Weighted Moving Average could be written as:
ABS(820 * C / (40 * C + 39 * C1 + 38 * C2 + 37 * C3 + 36 * C4 + 35 * C5 + 34 * C6 + 33 * C7 + 32 * C8 + 31 * C9 + 30 * C10 + 29 * C11 + 28 * C12 + 27 * C13 + 26 * C14 + 25 * C15 + 24 * C16 + 23 * C17 + 22 * C18 + 21 * C19 + 20 * C20 + 19 * C21 + 18 * C22 + 17 * C23 + 16 * C24 + 15 * C25 + 14 * C26 + 13 * C27 + 12 * C28 + 11 * C29 + 10 * C30 + 9 * C31 + 8 * C32 + 7 * C33 + 6 * C34 + 5 * C35 + 4 * C36 + 3 * C37 + 2 * C38 + C39) - 1) <= .01
A Condition Formula for price being within 1% of a 40-Period Exponential Moving Average could be written as:
ABS(C / XAVGC40 - 1) <= .01
You can adjust the percentage in both Condition Formulas by adjusting the <= .01 at the end.
PCF Formula Descriptions
Handy PCF example formulas to help you learn the syntax of PCFs!
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 10/7/2004 Posts: 1,178
|
Bruce, I've been experimenting with increasing the percent (the final two numbers) in PCF you provided for price being within 1% of a 40-Period Weighted Moving Average.
I don't understand why, but the same ETFs or stocks are coming up no matter the number. Could you please check this out for me making sure this PCF is correct -- let's say whether the final two digits are 01 (as in your formula) or 05.
ABS(820 * C / (40 * C + 39 * C1 + 38 * C2 + 37 * C3 + 36 * C4 + 35 * C5 + 34 * C6 + 33 * C7 + 32 * C8 + 31 * C9 + 30 * C10 + 29 * C11 + 28 * C12 + 27 * C13 + 26 * C14 + 25 * C15 + 24 * C16 + 23 * C17 + 22 * C18 + 21 * C19 + 20 * C20 + 19 * C21 + 18 * C22 + 17 * C23 + 16 * C24 + 15 * C25 + 14 * C26 + 13 * C27 + 12 * C28 + 11 * C29 + 10 * C30 + 9 * C31 + 8 * C32 + 7 * C33 + 6 * C34 + 5 * C35 + 4 * C36 + 3 * C37 + 2 * C38 + C39) - 1) <= .01
Thanks much.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
My guess is that you are not deleting and replacing the various copies of the PCF after you edit it. Any copies of the PCF that you have created are not linked to the original in any way.
If for example, you have used the PCF as a WatchList Column or EasyScan Condition, those copies would not change when you edit the original PCF. These copies will be based on the older version of the original PCF from which they were created.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 10/7/2004 Posts: 1,178
|
Bruce, I've found one problem relating to my last post
But, I am still experimenting, this time with a Simple Average -- thus, the PCF becomes...
ABS(C / AVGC40 - 1) <= .05.
In my columns, I have added AvgC40 (resulting in values) and AvgC40*.95 (also resulting in values). The problem is this: My logic says the Close value should be equal to or less than AvgC40*.95. However, my results show numbers that are ABOVE avgC40*.95.
Can you explain what is wrong?
With ETFs, three examples are EWT, EWI, and XME.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
ABS(C / AVGC40 - 1) <= .05 represents price being within 5% of its 40-period simple moving average in either direction. If you want price to be at least 5% below its 40-period simple moving average, you would want:
C <= .95 * AVGC40
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 10/7/2004 Posts: 1,178
|
C <= .95 * AVGC40
1) How can this PCF be converted to C<= .95 * FWAvgC40?
2) How can it be converted, also, to C<= .95 FWAvgC30?
You're appreciated!
If you're a Dad, have a Happy Father's Day on Sunday.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
For the 40-Period Front Weighted Moving Average this would be:
C <= .95 * (40 * C + 39 * C1 + 38 * C2 + 37 * C3 + 36 * C4 + 35 * C5 + 34 * C6 + 33 * C7 + 32 * C8 + 31 * C9 + 30 * C10 + 29 * C11 + 28 * C12 + 27 * C13 + 26 * C14 + 25 * C15 + 24 * C16 + 23 * C17 + 22 * C18 + 21 * C19 + 20 * C20 + 19 * C21 + 18 * C22 + 17 * C23 + 16 * C24 + 15 * C25 + 14 * C26 + 13 * C27 + 12 * C28 + 11 * C29 + 10 * C30 + 9 * C31 + 8 * C32 + 7 * C33 + 6 * C34 + 5 * C35 + 4 * C36 + 3 * C37 + 2 * C38 + C39) / 820
For the 30-Period Front Weighted Moving Average this would be:
C <= .95 * (30 * C + 29 * C1 + 28 * C2 + 27 * C3 + 26 * C4 + 25 * C5 + 24 * C6 + 23 * C7 + 22 * C8 + 21 * C9 + 20 * C10 + 19 * C11 + 18 * C12 + 17 * C13 + 16 * C14 + 15 * C15 + 14 * C16 + 13 * C17 + 12 * C18 + 11 * C19 + 10 * C20 + 9 * C21 + 8 * C22 + 7 * C23 + 6 * C24 + 5 * C25 + 4 * C26 + 3 * C27 + 2 * C28 + 1 * C29) / 465
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 1/10/2012 Posts: 7
|
Bruce, can you do the same for a 120-Period Front Weighted Moving Average?
thanks
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Please try the following Condition Formula to identify symbols which are at least 5% below their 120-Period Front Weighted Moving Average:
C <= .95 * (120 * C + 119 * C1 + 118 * C2 + 117 * C3 + 116 * C4 + 115 * C5 + 114 * C6 + 113 * C7 + 112 * C8 + 111 * C9 + 110 * C10 + 109 * C11 + 108 * C12 + 107 * C13 + 106 * C14 + 105 * C15 + 104 * C16 + 103 * C17 + 102 * C18 + 101 * C19 + 100 * C20 + 99 * C21 + 98 * C22 + 97 * C23 + 96 * C24 + 95 * C25 + 94 * C26 + 93 * C27 + 92 * C28 + 91 * C29 + 90 * C30 + 89 * C31 + 88 * C32 + 87 * C33 + 86 * C34 + 85 * C35 + 84 * C36 + 83 * C37 + 82 * C38 + 81 * C39 + 80 * C40 + 79 * C41 + 78 * C42 + 77 * C43 + 76 * C44 + 75 * C45 + 74 * C46 + 73 * C47 + 72 * C48 + 71 * C49 + 70 * C50 + 69 * C51 + 68 * C52 + 67 * C53 + 66 * C54 + 65 * C55 + 64 * C56 + 63 * C57 + 62 * C58 + 61 * C59 + 60 * C60 + 59 * C61 + 58 * C62 + 57 * C63 + 56 * C64 + 55 * C65 + 54 * C66 + 53 * C67 + 52 * C68 + 51 * C69 + 50 * C70 + 49 * C71 + 48 * C72 + 47 * C73 + 46 * C74 + 45 * C75 + 44 * C76 + 43 * C77 + 42 * C78 + 41 * C79 + 40 * C80 + 39 * C81 + 38 * C82 + 37 * C83 + 36 * C84 + 35 * C85 + 34 * C86 + 33 * C87 + 32 * C88 + 31 * C89 + 30 * C90 + 29 * C91 + 28 * C92 + 27 * C93 + 26 * C94 + 25 * C95 + 24 * C96 + 23 * C97 + 22 * C98 + 21 * C99 + 20 * C100 + 19 * C101 + 18 * C102 + 17 * C103 + 16 * C104 + 15 * C105 + 14 * C106 + 13 * C107 + 12 * C108 + 11 * C109 + 10 * C110 + 9 * C111 + 8 * C112 + 7 * C113 + 6 * C114 + 5 * C115 + 4 * C116 + 3 * C117 + 2 * C118 + C119) / 7260
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 1/10/2012 Posts: 7
|
what about 1% above/below the 120-Period Front Weighted Moving average?
thanks
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Please try the following Condition Formula to check for price being at least 1% away from the moving average:
ABS(7260 * C / (120 * C + 119 * C1 + 118 * C2 + 117 * C3 + 116 * C4 + 115 * C5 + 114 * C6 + 113 * C7 + 112 * C8 + 111 * C9 + 110 * C10 + 109 * C11 + 108 * C12 + 107 * C13 + 106 * C14 + 105 * C15 + 104 * C16 + 103 * C17 + 102 * C18 + 101 * C19 + 100 * C20 + 99 * C21 + 98 * C22 + 97 * C23 + 96 * C24 + 95 * C25 + 94 * C26 + 93 * C27 + 92 * C28 + 91 * C29 + 90 * C30 + 89 * C31 + 88 * C32 + 87 * C33 + 86 * C34 + 85 * C35 + 84 * C36 + 83 * C37 + 82 * C38 + 81 * C39 + 80 * C40 + 79 * C41 + 78 * C42 + 77 * C43 + 76 * C44 + 75 * C45 + 74 * C46 + 73 * C47 + 72 * C48 + 71 * C49 + 70 * C50 + 69 * C51 + 68 * C52 + 67 * C53 + 66 * C54 + 65 * C55 + 64 * C56 + 63 * C57 + 62 * C58 + 61 * C59 + 60 * C60 + 59 * C61 + 58 * C62 + 57 * C63 + 56 * C64 + 55 * C65 + 54 * C66 + 53 * C67 + 52 * C68 + 51 * C69 + 50 * C70 + 49 * C71 + 48 * C72 + 47 * C73 + 46 * C74 + 45 * C75 + 44 * C76 + 43 * C77 + 42 * C78 + 41 * C79 + 40 * C80 + 39 * C81 + 38 * C82 + 37 * C83 + 36 * C84 + 35 * C85 + 34 * C86 + 33 * C87 + 32 * C88 + 31 * C89 + 30 * C90 + 29 * C91 + 28 * C92 + 27 * C93 + 26 * C94 + 25 * C95 + 24 * C96 + 23 * C97 + 22 * C98 + 21 * C99 + 20 * C100 + 19 * C101 + 18 * C102 + 17 * C103 + 16 * C104 + 15 * C105 + 14 * C106 + 13 * C107 + 12 * C108 + 11 * C109 + 10 * C110 + 9 * C111 + 8 * C112 + 7 * C113 + 6 * C114 + 5 * C115 + 4 * C116 + 3 * C117 + 2 * C118 + C119) - 1) >= .01
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 1/10/2012 Posts: 7
|
not working here.. i am showing candidates that are over 5% from its 120 weighted average
|
|
Registered User Joined: 1/10/2012 Posts: 7
|
e.g Scan all stocks showing within 1% above/below the 120 FW MA
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
As stated in the description of the formula as given in my response, the Condition Formula was written for being at least 1% away from the moving average as all of the most recent posts were for being at least 5% below the moving average.
If you want to check for being within 1% of the moving average, you would need to change the >= at the end of the formula to <= instead:
ABS(7260 * C / (120 * C + 119 * C1 + 118 * C2 + 117 * C3 + 116 * C4 + 115 * C5 + 114 * C6 + 113 * C7 + 112 * C8 + 111 * C9 + 110 * C10 + 109 * C11 + 108 * C12 + 107 * C13 + 106 * C14 + 105 * C15 + 104 * C16 + 103 * C17 + 102 * C18 + 101 * C19 + 100 * C20 + 99 * C21 + 98 * C22 + 97 * C23 + 96 * C24 + 95 * C25 + 94 * C26 + 93 * C27 + 92 * C28 + 91 * C29 + 90 * C30 + 89 * C31 + 88 * C32 + 87 * C33 + 86 * C34 + 85 * C35 + 84 * C36 + 83 * C37 + 82 * C38 + 81 * C39 + 80 * C40 + 79 * C41 + 78 * C42 + 77 * C43 + 76 * C44 + 75 * C45 + 74 * C46 + 73 * C47 + 72 * C48 + 71 * C49 + 70 * C50 + 69 * C51 + 68 * C52 + 67 * C53 + 66 * C54 + 65 * C55 + 64 * C56 + 63 * C57 + 62 * C58 + 61 * C59 + 60 * C60 + 59 * C61 + 58 * C62 + 57 * C63 + 56 * C64 + 55 * C65 + 54 * C66 + 53 * C67 + 52 * C68 + 51 * C69 + 50 * C70 + 49 * C71 + 48 * C72 + 47 * C73 + 46 * C74 + 45 * C75 + 44 * C76 + 43 * C77 + 42 * C78 + 41 * C79 + 40 * C80 + 39 * C81 + 38 * C82 + 37 * C83 + 36 * C84 + 35 * C85 + 34 * C86 + 33 * C87 + 32 * C88 + 31 * C89 + 30 * C90 + 29 * C91 + 28 * C92 + 27 * C93 + 26 * C94 + 25 * C95 + 24 * C96 + 23 * C97 + 22 * C98 + 21 * C99 + 20 * C100 + 19 * C101 + 18 * C102 + 17 * C103 + 16 * C104 + 15 * C105 + 14 * C106 + 13 * C107 + 12 * C108 + 11 * C109 + 10 * C110 + 9 * C111 + 8 * C112 + 7 * C113 + 6 * C114 + 5 * C115 + 4 * C116 + 3 * C117 + 2 * C118 + C119) - 1) >= .01
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |