Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 12/30/2004 Posts: 38
|
I need a formula which expresses the daily variation of the percentage by which a security price, in standard deviations, varies from the 200 day simple moving average.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The percent difference between price and its 200-Period Simple Moving Average:
100 * (C / AVGC200 - 1)
And the difference between price and its 200-Period Simple Moving Average in Standard Devations:
(C - AVGC200) / SQR(ABS(C ^ 2 + C1 ^ 2 + C2 ^ 2 + C3 ^ 2 + C4 ^ 2 + C5 ^ 2 + C6 ^ 2 + C7 ^ 2 + C8 ^ 2 + C9 ^ 2 + C10 ^ 2 + C11 ^ 2 + C12 ^ 2 + C13 ^ 2 + C14 ^ 2 + C15 ^ 2 + C16 ^ 2 + C17 ^ 2 + C18 ^ 2 + C19 ^ 2 + C20 ^ 2 + C21 ^ 2 + C22 ^ 2 + C23 ^ 2 + C24 ^ 2 + C25 ^ 2 + C26 ^ 2 + C27 ^ 2 + C28 ^ 2 + C29 ^ 2 + C30 ^ 2 + C31 ^ 2 + C32 ^ 2 + C33 ^ 2 + C34 ^ 2 + C35 ^ 2 + C36 ^ 2 + C37 ^ 2 + C38 ^ 2 + C39 ^ 2 + C40 ^ 2 + C41 ^ 2 + C42 ^ 2 + C43 ^ 2 + C44 ^ 2 + C45 ^ 2 + C46 ^ 2 + C47 ^ 2 + C48 ^ 2 + C49 ^ 2 + C50 ^ 2 + C51 ^ 2 + C52 ^ 2 + C53 ^ 2 + C54 ^ 2 + C55 ^ 2 + C56 ^ 2 + C57 ^ 2 + C58 ^ 2 + C59 ^ 2 + C60 ^ 2 + C61 ^ 2 + C62 ^ 2 + C63 ^ 2 + C64 ^ 2 + C65 ^ 2 + C66 ^ 2 + C67 ^ 2 + C68 ^ 2 + C69 ^ 2 + C70 ^ 2 + C71 ^ 2 + C72 ^ 2 + C73 ^ 2 + C74 ^ 2 + C75 ^ 2 + C76 ^ 2 + C77 ^ 2 + C78 ^ 2 + C79 ^ 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182 ^ 2 + C183 ^ 2 + C184 ^ 2 + C185 ^ 2 + C186 ^ 2 + C187 ^ 2 + C188 ^ 2 + C189 ^ 2 + C190 ^ 2 + C191 ^ 2 + C192 ^ 2 + C193 ^ 2 + C194 ^ 2 + C195 ^ 2 + C196 ^ 2 + C197 ^ 2 + C198 ^ 2 + C199 ^ 2 - 200 * AVGC200 ^ 2) / 200)
Are very different things.
Modelling Bollinger Bands (& Standard Deviation) in a TC PCF
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: 12/30/2004 Posts: 38
|
Thanks, Bruce.
|
|
Registered User Joined: 12/30/2004 Posts: 38
|
I am attempting (and failing) to produce a custom indicator for the negative side of the standard deviations. I get an error message which states error: this must return a boolean %true. I am bracketing off the formula above and adding to it the following "<= -1.5" and c < avgc200. What am I doing wrong?
|
|
Registered User Joined: 12/30/2004 Posts: 38
|
I should have said "a custom boolean indicator of percent true." What I am attempting to show is the standard deviations below the 200ma.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
In TC2000 version 12, you should be able to just add the <= -1.5 to the end. There is no need for the C < AVGC200 portion.
In TC2000 version 7, you would need to put parentheses around the negative number. So you would need to add <= (-1.5) instead of <= -1.5 to the end.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 12/30/2004 Posts: 38
|
Thanks, again, Bruce.
|
|
Registered User Joined: 12/30/2004 Posts: 38
|
Bruce: Is it possible to calculate the standard deviations of the values of the standard deviations derived from the formula we have been discussing?
If so, what is that formula and what is the composite formula?
Thanks,
Mark
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
I am not sure exactly what you are asking.
If you want to plot the value of the 200-Period Standard Deviation of Price itself, it would be:
SQR(ABS(C ^ 2 + C1 ^ 2 + C2 ^ 2 + C3 ^ 2 + C4 ^ 2 + C5 ^ 2 + C6 ^ 2 + C7 ^ 2 + C8 ^ 2 + C9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 2 + C112 ^ 2 + C113 ^ 2 + C114 ^ 2 + C115 ^ 2 + C116 ^ 2 + C117 ^ 2 + C118 ^ 2 + C119 ^ 2 + C120 ^ 2 + C121 ^ 2 + C122 ^ 2 + C123 ^ 2 + C124 ^ 2 + C125 ^ 2 + C126 ^ 2 + C127 ^ 2 + C128 ^ 2 + C129 ^ 2 + C130 ^ 2 + C131 ^ 2 + C132 ^ 2 + C133 ^ 2 + C134 ^ 2 + C135 ^ 2 + C136 ^ 2 + C137 ^ 2 + C138 ^ 2 + C139 ^ 2 + C140 ^ 2 + C141 ^ 2 + C142 ^ 2 + C143 ^ 2 + C144 ^ 2 + C145 ^ 2 + C146 ^ 2 + C147 ^ 2 + C148 ^ 2 + C149 ^ 2 + C150 ^ 2 + C151 ^ 2 + C152 ^ 2 + C153 ^ 2 + C154 ^ 2 + C155 ^ 2 + C156 ^ 2 + C157 ^ 2 + C158 ^ 2 + C159 ^ 2 + C160 ^ 2 + C161 ^ 2 + C162 ^ 2 + C163 ^ 2 + C164 ^ 2 + C165 ^ 2 + C166 ^ 2 + C167 ^ 2 + C168 ^ 2 + C169 ^ 2 + C170 ^ 2 + C171 ^ 2 + C172 ^ 2 + C173 ^ 2 + C174 ^ 2 + C175 ^ 2 + C176 ^ 2 + C177 ^ 2 + C178 ^ 2 + C179 ^ 2 + C180 ^ 2 + C181 ^ 2 + C182 ^ 2 + C183 ^ 2 + C184 ^ 2 + C185 ^ 2 + C186 ^ 2 + C187 ^ 2 + C188 ^ 2 + C189 ^ 2 + C190 ^ 2 + C191 ^ 2 + C192 ^ 2 + C193 ^ 2 + C194 ^ 2 + C195 ^ 2 + C196 ^ 2 + C197 ^ 2 + C198 ^ 2 + C199 ^ 2 - 200 * AVGC200 ^ 2) / 200)
If you want to plot the Standard Deviation of the difference between Price and its 200-Period Simple Moving Average in Standard Deviations, I cannot think of a way to create a formula which would be short enough to be practical.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 12/30/2004 Posts: 38
|
B: I would like to plot the standard deviation of the standard deviation of the percentage variation of price as related to the 200 sma. It does sound complex, but in the age of the intel core i7 I think that it might be possible to calculate within a reasonable time, if the formula can be generated.
Thanks,
Mark
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
No. It wouldn't be practical. It would be hundreds of times the size of the formula I already posted and would likely exceed the calculation time threshold on our servers.
The formula could not even be copied and pasted using the Windows clipboard as it has a 32768 character limit when copying and pasting text.
It would be possible to do this calculation in StockFinder. RealCode and Block Diagrams both offer techniques for optimizing how the algorithm could be created and calculated which cannot be done using the Personal Criteria Formula Language.
You could even create something in StockFinder without writing a RealCode or creating any Block Diagrams manually by just using Standard Deviation indicators and Comparison Plots.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 12/30/2004 Posts: 38
|
Thanks, Bruce. Just a thought.
Regards,
Mark
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |