Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

Moving average question Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
spendabuck
Posted : Friday, April 3, 2009 4:30:58 PM
Gold Customer Gold Customer

Joined: 3/24/2005
Posts: 18

I'm trying to write a PCF for at 150 day weighted moving average.  Here's the formula

 WMA = ( PRICE * n + PRICE(1) * n-1 + ... PRICE(n-1) * 1) / ( n * (n + 1) / 2 )
         n = Period

Not having any luck. Help would be appreciated

spendabuck
Posted : Friday, April 3, 2009 4:37:04 PM
Gold Customer Gold Customer

Joined: 3/24/2005
Posts: 18
Also how to I identify when price closes above the line for the first time.
Bruce_L
Posted : Friday, April 3, 2009 4:37:28 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Please try the following for the Moving Average itself:

(150 * C + 149 * C1 + 148 * C2 + 147 * C3 + 146 * C4 + 145 * C5 + 144 * C6 + 143 * C7 + 142 * C8 + 141 * C9 + 140 * C10 + 139 * C11 + 138 * C12 + 137 * C13 + 136 * C14 + 135 * C15 + 134 * C16 + 133 * C17 + 132 * C18 + 131 * C19 + 130 * C20 + 129 * C21 + 128 * C22 + 127 * C23 + 126 * C24 + 125 * C25 + 124 * C26 + 123 * C27 + 122 * C28 + 121 * C29 + 120 * C30 + 119 * C31 + 118 * C32 + 117 * C33 + 116 * C34 + 115 * C35 + 114 * C36 + 113 * C37 + 112 * C38 + 111 * C39 + 110 * C40 + 109 * C41 + 108 * C42 + 107 * C43 + 106 * C44 + 105 * C45 + 104 * C46 + 103 * C47 + 102 * C48 + 101 * C49 + 100 * C50 + 99 * C51 + 98 * C52 + 97 * C53 + 96 * C54 + 95 * C55 + 94 * C56 + 93 * C57 + 92 * C58 + 91 * C59 + 90 * C60 + 89 * C61 + 88 * C62 + 87 * C63 + 86 * C64 + 85 * C65 + 84 * C66 + 83 * C67 + 82 * C68 + 81 * C69 + 80 * C70 + 79 * C71 + 78 * C72 + 77 * C73 + 76 * C74 + 75 * C75 + 74 * C76 + 73 * C77 + 72 * C78 + 71 * C79 + 70 * C80 + 69 * C81 + 68 * C82 + 67 * C83 + 66 * C84 + 65 * C85 + 64 * C86 + 63 * C87 + 62 * C88 + 61 * C89 + 60 * C90 + 59 * C91 + 58 * C92 + 57 * C93 + 56 * C94 + 55 * C95 + 54 * C96 + 53 * C97 + 52 * C98 + 51 * C99 + 50 * C100 + 49 * C101 + 48 * C102 + 47 * C103 + 46 * C104 + 45 * C105 + 44 * C106 + 43 * C107 + 42 * C108 + 41 * C109 + 40 * C110 + 39 * C111 + 38 * C112 + 37 * C113 + 36 * C114 + 35 * C115 + 34 * C116 + 33 * C117 + 32 * C118 + 31 * C119 + 30 * C120 + 29 * C121 + 28 * C122 + 27 * C123 + 26 * C124 + 25 * C125 + 24 * C126 + 23 * C127 + 22 * C128 + 21 * C129 + 20 * C130 + 19 * C131 + 18 * C132 + 17 * C133 + 16 * C134 + 15 * C135 + 14 * C136 + 13 * C137 + 12 * C138 + 11 * C139 + 10 * C140 + 9 * C141 + 8 * C142 + 7 * C143 + 6 * C144 + 5 * C145 + 4 * C146 + 3 * C147 + 2 * C148 + C149) / 11325

And the following formula for Price crossing up through the Moving Average:

C > (150 * C + 149 * C1 + 148 * C2 + 147 * C3 + 146 * C4 + 145 * C5 + 144 * C6 + 143 * C7 + 142 * C8 + 141 * C9 + 140 * C10 + 139 * C11 + 138 * C12 + 137 * C13 + 136 * C14 + 135 * C15 + 134 * C16 + 133 * C17 + 132 * C18 + 131 * C19 + 130 * C20 + 129 * C21 + 128 * C22 + 127 * C23 + 126 * C24 + 125 * C25 + 124 * C26 + 123 * C27 + 122 * C28 + 121 * C29 + 120 * C30 + 119 * C31 + 118 * C32 + 117 * C33 + 116 * C34 + 115 * C35 + 114 * C36 + 113 * C37 + 112 * C38 + 111 * C39 + 110 * C40 + 109 * C41 + 108 * C42 + 107 * C43 + 106 * C44 + 105 * C45 + 104 * C46 + 103 * C47 + 102 * C48 + 101 * C49 + 100 * C50 + 99 * C51 + 98 * C52 + 97 * C53 + 96 * C54 + 95 * C55 + 94 * C56 + 93 * C57 + 92 * C58 + 91 * C59 + 90 * C60 + 89 * C61 + 88 * C62 + 87 * C63 + 86 * C64 + 85 * C65 + 84 * C66 + 83 * C67 + 82 * C68 + 81 * C69 + 80 * C70 + 79 * C71 + 78 * C72 + 77 * C73 + 76 * C74 + 75 * C75 + 74 * C76 + 73 * C77 + 72 * C78 + 71 * C79 + 70 * C80 + 69 * C81 + 68 * C82 + 67 * C83 + 66 * C84 + 65 * C85 + 64 * C86 + 63 * C87 + 62 * C88 + 61 * C89 + 60 * C90 + 59 * C91 + 58 * C92 + 57 * C93 + 56 * C94 + 55 * C95 + 54 * C96 + 53 * C97 + 52 * C98 + 51 * C99 + 50 * C100 + 49 * C101 + 48 * C102 + 47 * C103 + 46 * C104 + 45 * C105 + 44 * C106 + 43 * C107 + 42 * C108 + 41 * C109 + 40 * C110 + 39 * C111 + 38 * C112 + 37 * C113 + 36 * C114 + 35 * C115 + 34 * C116 + 33 * C117 + 32 * C118 + 31 * C119 + 30 * C120 + 29 * C121 + 28 * C122 + 27 * C123 + 26 * C124 + 25 * C125 + 24 * C126 + 23 * C127 + 22 * C128 + 21 * C129 + 20 * C130 + 19 * C131 + 18 * C132 + 17 * C133 + 16 * C134 + 15 * C135 + 14 * C136 + 13 * C137 + 12 * C138 + 11 * C139 + 10 * C140 + 9 * C141 + 8 * C142 + 7 * C143 + 6 * C144 + 5 * C145 + 4 * C146 + 3 * C147 + 2 * C148 + C149) / 11325 AND C1 <= (150 * C1 + 149 * C2 + 148 * C3 + 147 * C4 + 146 * C5 + 145 * C6 + 144 * C7 + 143 * C8 + 142 * C9 + 141 * C10 + 140 * C11 + 139 * C12 + 138 * C13 + 137 * C14 + 136 * C15 + 135 * C16 + 134 * C17 + 133 * C18 + 132 * C19 + 131 * C20 + 130 * C21 + 129 * C22 + 128 * C23 + 127 * C24 + 126 * C25 + 125 * C26 + 124 * C27 + 123 * C28 + 122 * C29 + 121 * C30 + 120 * C31 + 119 * C32 + 118 * C33 + 117 * C34 + 116 * C35 + 115 * C36 + 114 * C37 + 113 * C38 + 112 * C39 + 111 * C40 + 110 * C41 + 109 * C42 + 108 * C43 + 107 * C44 + 106 * C45 + 105 * C46 + 104 * C47 + 103 * C48 + 102 * C49 + 101 * C50 + 100 * C51 + 99 * C52 + 98 * C53 + 97 * C54 + 96 * C55 + 95 * C56 + 94 * C57 + 93 * C58 + 92 * C59 + 91 * C60 + 90 * C61 + 89 * C62 + 88 * C63 + 87 * C64 + 86 * C65 + 85 * C66 + 84 * C67 + 83 * C68 + 82 * C69 + 81 * C70 + 80 * C71 + 79 * C72 + 78 * C73 + 77 * C74 + 76 * C75 + 75 * C76 + 74 * C77 + 73 * C78 + 72 * C79 + 71 * C80 + 70 * C81 + 69 * C82 + 68 * C83 + 67 * C84 + 66 * C85 + 65 * C86 + 64 * C87 + 63 * C88 + 62 * C89 + 61 * C90 + 60 * C91 + 59 * C92 + 58 * C93 + 57 * C94 + 56 * C95 + 55 * C96 + 54 * C97 + 53 * C98 + 52 * C99 + 51 * C100 + 50 * C101 + 49 * C102 + 48 * C103 + 47 * C104 + 46 * C105 + 45 * C106 + 44 * C107 + 43 * C108 + 42 * C109 + 41 * C110 + 40 * C111 + 39 * C112 + 38 * C113 + 37 * C114 + 36 * C115 + 35 * C116 + 34 * C117 + 33 * C118 + 32 * C119 + 31 * C120 + 30 * C121 + 29 * C122 + 28 * C123 + 27 * C124 + 26 * C125 + 25 * C126 + 24 * C127 + 23 * C128 + 22 * C129 + 21 * C130 + 20 * C131 + 19 * C132 + 18 * C133 + 17 * C134 + 16 * C135 + 15 * C136 + 14 * C137 + 13 * C138 + 12 * C139 + 11 * C140 + 10 * C141 + 9 * C142 + 8 * C143 + 7 * C144 + 6 * C145 + 5 * C146 + 4 * C147 + 3 * C148 + 2 * C149 + C150) / 11325

You may wish to review the following:

How to create a Personal Criteria Forumula (PCF)
PCF Formula Descriptions
Handy PCF example formulas to help you learn the syntax of PCFs!

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
spendabuck
Posted : Friday, April 3, 2009 4:40:40 PM
Gold Customer Gold Customer

Joined: 3/24/2005
Posts: 18
You da man!  Have a great weekend!
Bruce_L
Posted : Friday, April 3, 2009 4:41:28 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
You're welcome.

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