Gold Customer
Joined: 3/19/2008 Posts: 5
|
Any ideas on how to implement a volume-weighted exponential moving average in TeleChart? I've tried this syntax, XAVG(V*C,12)/XAVG(V,12), but it fails to produce the correct result.
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Please try the following for a 12-Period Volume Weighted Exponential Moving Average:
.153984303064341 * (C * V + 11 / 13 * (C1 * V1 + 11 / 13 * (C2 * V2 + 11 / 13 * (C3 * V3 + 11 / 13 * (C4 * V4 + 11 / 13 * (C5 * V5 + 11 / 13 * (C6 * V6 + 11 / 13 * (C7 * V7 + 11 / 13 * (C8 * V8 + 11 / 13 * (C9 * V9 + 11 / 13 * (C10 * V10 + 11 / 13 * (C11 * V11 + 11 / 13 * (C12 * V12 + 11 / 13 * (C13 * V13 + 11 / 13 * (C14 * V14 + 11 / 13 * (C15 * V15 + 11 / 13 * (C16 * V16 + 11 / 13 * (C17 * V17 + 11 / 13 * (C18 * V18 + 11 / 13 * (C19 * V19 + 11 / 13 * (C20 * V20 + 11 / 13 * (C21 * V21 + 11 / 13 * (C22 * V22 + 11 / 13 * (C23 * V23 + 11 / 13 * (C24 * V24 + 11 / 13 * (C25 * V25 + 11 / 13 * (C26 * V26 + 11 / 13 * (C27 * V27 + 11 / 13 * (C28 * V28 + 11 / 13 * (C29 * V29 + 11 / 13 * (C30 * V30 + 11 / 13 * (C31 * V31 + 11 / 13 * (C32 * V32 + 11 / 13 * (C33 * V33 + 11 / 13 * (C34 * V34 + 11 / 13 * (C35 * V35 + 11 / 13 * (C36 * V36 + 11 / 13 * (C37 * V37 + 11 / 13 * (C38 * V38 + 11 / 13 * (C39 * V39 + 11 / 13 * (C40 * V40 + 11 / 13 * (C41 * V41)))))))))))))))))))))))))))))))))))))))))) / XAVGV12
You may wish to review the following:
How to create a Personal Criteria Forumula (PCF)
Cascades of Moving Averages
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: 1/10/2012 Posts: 7
|
Hi Bruce,
I am trying to convert the 12 bar VWEMA code you posted to a 20 bar and a 50 bar average. I can't figure out what the number at the beginning of your code is all about: .153984303064341 and whether I need to change it to something else or not.
Also to change the exponential moving average to a simple one, I would only need to change the code from XAVG to AVG at the end. Correct?
Thanks.
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The .153984303064341 at the beginning of the formula is 2 / 13 rounded up slightly so the sum of all of the factors in the numerator add up to one.
You can't just change the XAVGV12 in the denominator to a AVGV12 to convert it from Exponential to Simple because you need to convert both the numerator and denominator to Simple.
A 12-Period Simple Volume Weighted Moving Average would be:
(C * V + C1 * V1 + C2 * V2 + C3 * V3 + C4 * V4 + C5 * V5 + C6 * V6 + C7 * V7 + C8 * V8 + C9 * V9 + C10 * V10 + C11 * V11 + C12 * V12) / 12 / AVGV12
A 20-Period Exponential Volume Weighted Moving Average would be:
.0953245136006837 * (C * V + 19 / 21 * (C1 * V1 + 19 / 21 * (C2 * V2 + 19 / 21 * (C3 * V3 + 19 / 21 * (C4 * V4 + 19 / 21 * (C5 * V5 + 19 / 21 * (C6 * V6 + 19 / 21 * (C7 * V7 + 19 / 21 * (C8 * V8 + 19 / 21 * (C9 * V9 + 19 / 21 * (C10 * V10 + 19 / 21 * (C11 * V11 + 19 / 21 * (C12 * V12 + 19 / 21 * (C13 * V13 + 19 / 21 * (C14 * V14 + 19 / 21 * (C15 * V15 + 19 / 21 * (C16 * V16 + 19 / 21 * (C17 * V17 + 19 / 21 * (C18 * V18 + 19 / 21 * (C19 * V19 + 19 / 21 * (C20 * V20 + 19 / 21 * (C21 * V21 + 19 / 21 * (C22 * V22 + 19 / 21 * (C23 * V23 + 19 / 21 * (C24 * V24 + 19 / 21 * (C25 * V25 + 19 / 21 * (C26 * V26 + 19 / 21 * (C27 * V27 + 19 / 21 * (C28 * V28 + 19 / 21 * (C29 * V29 + 19 / 21 * (C30 * V30 + 19 / 21 * (C31 * V31 + 19 / 21 * (C32 * V32 + 19 / 21 * (C33 * V33 + 19 / 21 * (C34 * V34 + 19 / 21 * (C35 * V35 + 19 / 21 * (C36 * V36 + 19 / 21 * (C37 * V37 + 19 / 21 * (C38 * V38 + 19 / 21 * (C39 * V39 + 19 / 21 * (C40 * V40 + 19 / 21 * (C41 * V41 + 19 / 21 * (C42 * V42 + 19 / 21 * (C43 * V43 + 19 / 21 * (C44 * V44 + 19 / 21 * (C45 * V45 + 19 / 21 * (C46 * V46 + 19 / 21 * (C47 * V47 + 19 / 21 * (C48 * V48 + 19 / 21 * (C49 * V49 + 19 / 21 * (C50 * V50 + 19 / 21 * (C51 * V51 + 19 / 21 * (C52 * V52 + 19 / 21 * (C53 * V53 + 19 / 21 * (C54 * V54 + 19 / 21 * (C55 * V55 + 19 / 21 * (C56 * V56 + 19 / 21 * (C57 * V57 + 19 / 21 * (C58 * V58 + 19 / 21 * (C59 * V59 + 19 / 21 * (C60 * V60 + 19 / 21 * (C61 * V61 + 19 / 21 * (C62 * V62 + 19 / 21 * (C63 * V63 + 19 / 21 * (C64 * V64 + 19 / 21 * (C65 * V65 + 19 / 21 * (C66 * V66 + 19 / 21 * (C67 * V67 + 19 / 21 * (C68 * V68 + 19 / 21 * (C69 * V69)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) / XAVGV20
A 20-Period Simple Volume Weighted Moving Average would be:
(C * V + C1 * V1 + C2 * V2 + C3 * V3 + C4 * V4 + C5 * V5 + C6 * V6 + C7 * V7 + C8 * V8 + C9 * V9 + C10 * V10 + C11 * V11 + C12 * V12 + C13 * V13 + C14 * V14 + C15 * V15 + C16 * V16 + C17 * V17 + C18 * V18 + C19 * V19) / 20 / AVGV20
A 50-Period Exponential Volume Weighted Moving Average would be:
.0392544272029514 * (C * V + 49 / 51 * (C1 * V1 + 49 / 51 * (C2 * V2 + 49 / 51 * (C3 * V3 + 49 / 51 * (C4 * V4 + 49 / 51 * (C5 * V5 + 49 / 51 * (C6 * V6 + 49 / 51 * (C7 * V7 + 49 / 51 * (C8 * V8 + 49 / 51 * (C9 * V9 + 49 / 51 * (C10 * V10 + 49 / 51 * (C11 * V11 + 49 / 51 * (C12 * V12 + 49 / 51 * (C13 * V13 + 49 / 51 * (C14 * V14 + 49 / 51 * (C15 * V15 + 49 / 51 * (C16 * V16 + 49 / 51 * (C17 * V17 + 49 / 51 * (C18 * V18 + 49 / 51 * (C19 * V19 + 49 / 51 * (C20 * V20 + 49 / 51 * (C21 * V21 + 49 / 51 * (C22 * V22 + 49 / 51 * (C23 * V23 + 49 / 51 * (C24 * V24 + 49 / 51 * (C25 * V25 + 49 / 51 * (C26 * V26 + 49 / 51 * (C27 * V27 + 49 / 51 * (C28 * V28 + 49 / 51 * (C29 * V29 + 49 / 51 * (C30 * V30 + 49 / 51 * (C31 * V31 + 49 / 51 * (C32 * V32 + 49 / 51 * (C33 * V33 + 49 / 51 * (C34 * V34 + 49 / 51 * (C35 * V35 + 49 / 51 * (C36 * V36 + 49 / 51 * (C37 * V37 + 49 / 51 * (C38 * V38 + 49 / 51 * (C39 * V39 + 49 / 51 * (C40 * V40 + 49 / 51 * (C41 * V41 + 49 / 51 * (C42 * V42 + 49 / 51 * (C43 * V43 + 49 / 51 * (C44 * V44 + 49 / 51 * (C45 * V45 + 49 / 51 * (C46 * V46 + 49 / 51 * (C47 * V47 + 49 / 51 * (C48 * V48 + 49 / 51 * (C49 * V49 + 49 / 51 * (C50 * V50 + 49 / 51 * (C51 * V51 + 49 / 51 * (C52 * V52 + 49 / 51 * (C53 * V53 + 49 / 51 * (C54 * V54 + 49 / 51 * (C55 * V55 + 49 / 51 * (C56 * V56 + 49 / 51 * (C57 * V57 + 49 / 51 * (C58 * V58 + 49 / 51 * (C59 * V59 + 49 / 51 * (C60 * V60 + 49 / 51 * (C61 * V61 + 49 / 51 * (C62 * V62 + 49 / 51 * (C63 * V63 + 49 / 51 * (C64 * V64 + 49 / 51 * (C65 * V65 + 49 / 51 * (C66 * V66 + 49 / 51 * (C67 * V67 + 49 / 51 * (C68 * V68 + 49 / 51 * (C69 * V69 + 49 / 51 * (C70 * V70 + 49 / 51 * (C71 * V71 + 49 / 51 * (C72 * V72 + 49 / 51 * (C73 * V73 + 49 / 51 * (C74 * V74 + 49 / 51 * (C75 * V75 + 49 / 51 * (C76 * V76 + 49 / 51 * (C77 * V77 + 49 / 51 * (C78 * V78 + 49 / 51 * (C79 * V79 + 49 / 51 * (C80 * V80 + 49 / 51 * (C81 * V81 + 49 / 51 * (C82 * V82 + 49 / 51 * (C83 * V83 + 49 / 51 * (C84 * V84 + 49 / 51 * (C85 * V85 + 49 / 51 * (C86 * V86 + 49 / 51 * (C87 * V87 + 49 / 51 * (C88 * V88 + 49 / 51 * (C89 * V89 + 49 / 51 * (C90 * V90 + 49 / 51 * (C91 * V91 + 49 / 51 * (C92 * V92 + 49 / 51 * (C93 * V93 + 49 / 51 * (C94 * V94 + 49 / 51 * (C95 * V95 + 49 / 51 * (C96 * V96 + 49 / 51 * (C97 * V97 + 49 / 51 * (C98 * V98 + 49 / 51 * (C99 * V99 + 49 / 51 * (C100 * V100 + 49 / 51 * (C101 * V101 + 49 / 51 * (C102 * V102 + 49 / 51 * (C103 * V103 + 49 / 51 * (C104 * V104 + 49 / 51 * (C105 * V105 + 49 / 51 * (C106 * V106 + 49 / 51 * (C107 * V107 + 49 / 51 * (C108 * V108 + 49 / 51 * (C109 * V109 + 49 / 51 * (C110 * V110 + 49 / 51 * (C111 * V111 + 49 / 51 * (C112 * V112 + 49 / 51 * (C113 * V113 + 49 / 51 * (C114 * V114 + 49 / 51 * (C115 * V115 + 49 / 51 * (C116 * V116 + 49 / 51 * (C117 * V117 + 49 / 51 * (C118 * V118 + 49 / 51 * (C119 * V119 + 49 / 51 * (C120 * V120 + 49 / 51 * (C121 * V121 + 49 / 51 * (C122 * V122 + 49 / 51 * (C123 * V123 + 49 / 51 * (C124 * V124 + 49 / 51 * (C125 * V125 + 49 / 51 * (C126 * V126 + 49 / 51 * (C127 * V127 + 49 / 51 * (C128 * V128 + 49 / 51 * (C129 * V129 + 49 / 51 * (C130 * V130 + 49 / 51 * (C131 * V131 + 49 / 51 * (C132 * V132 + 49 / 51 * (C133 * V133 + 49 / 51 * (C134 * V134 + 49 / 51 * (C135 * V135 + 49 / 51 * (C136 * V136 + 49 / 51 * (C137 * V137 + 49 / 51 * (C138 * V138 + 49 / 51 * (C139 * V139 + 49 / 51 * (C140 * V140 + 49 / 51 * (C141 * V141 + 49 / 51 * (C142 * V142 + 49 / 51 * (C143 * V143 + 49 / 51 * (C144 * V144 + 49 / 51 * (C145 * V145 + 49 / 51 * (C146 * V146 + 49 / 51 * (C147 * V147 + 49 / 51 * (C148 * V148 + 49 / 51 * (C149 * V149 + 49 / 51 * (C150 * V150 + 49 / 51 * (C151 * V151 + 49 / 51 * (C152 * V152 + 49 / 51 * (C153 * V153 + 49 / 51 * (C154 * V154 + 49 / 51 * (C155 * V155 + 49 / 51 * (C156 * V156 + 49 / 51 * (C157 * V157 + 49 / 51 * (C158 * V158 + 49 / 51 * (C159 * V159 + 49 / 51 * (C160 * V160 + 49 / 51 * (C161 * V161 + 49 / 51 * (C162 * V162 + 49 / 51 * (C163 * V163 + 49 / 51 * (C164 * V164 + 49 / 51 * (C165 * V165 + 49 / 51 * (C166 * V166 + 49 / 51 * (C167 * V167 + 49 / 51 * (C168 * V168 + 49 / 51 * (C169 * V169 + 49 / 51 * (C170 * V170 + 49 / 51 * (C171 * V171 + 49 / 51 * (C172 * V172))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) / XAVGV50
A 50-Period Simple Volume Weighted Moving Average would be:
(C * V + C1 * V1 + C2 * V2 + C3 * V3 + C4 * V4 + C5 * V5 + C6 * V6 + C7 * V7 + C8 * V8 + C9 * V9 + C10 * V10 + C11 * V11 + C12 * V12 + C13 * V13 + C14 * V14 + C15 * V15 + C16 * V16 + C17 * V17 + C18 * V18 + C19 * V19 + C20 * V20 + C21 * V21 + C22 * V22 + C23 * V23 + C24 * V24 + C25 * V25 + C26 * V26 + C27 * V27 + C28 * V28 + C29 * V29 + C30 * V30 + C31 * V31 + C32 * V32 + C33 * V33 + C34 * V34 + C35 * V35 + C36 * V36 + C37 * V37 + C38 * V38 + C39 * V39 + C40 * V40 + C41 * V41 + C42 * V42 + C43 * V43 + C44 * V44 + C45 * V45 + C46 * V46 + C47 * V47 + C48 * V48 + C49 * V49) / 50 / AVGV50
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
Registered User Joined: 1/10/2012 Posts: 7
|
Bruce,
Thank you. That helps a lot!
|
Registered User Joined: 3/3/2013 Posts: 57
|
Bruce,
Thanks for all your support you provide to all of us. It's truly a blessing.
Could you also provide a 10-Period Exponential Volume Weighted Moving Average please?
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
A 10-Period Volume Weighted Exponential Moving Average can be written as:
.1819803 * (C * V + 9 / 11 * (C1 * V1 + 9 / 11 * (C2 * V2 + 9 / 11 * (C3 * V3 + 9 / 11 * (C4 * V4 + 9 / 11 * (C5 * V5 + 9 / 11 * (C6 * V6 + 9 / 11 * (C7 * V7 + 9 / 11 * (C8 * V8 + 9 / 11 * (C9 * V9 + 9 / 11 * (C10 * V10 + 9 / 11 * (C11 * V11 + 9 / 11 * (C12 * V12 + 9 / 11 * (C13 * V13 + 9 / 11 * (C14 * V14 + 9 / 11 * (C15 * V15 + 9 / 11 * (C16 * V16 + 9 / 11 * (C17 * V17 + 9 / 11 * (C18 * V18 + 9 / 11 * (C19 * V19 + 9 / 11 * (C20 * V20 + 9 / 11 * (C21 * V21 + 9 / 11 * (C22 * V22 + 9 / 11 * (C23 * V23 + 9 / 11 * (C24 * V24 + 9 / 11 * (C25 * V25 + 9 / 11 * (C26 * V26 + 9 / 11 * (C27 * V27 + 9 / 11 * (C28 * V28 + 9 / 11 * (C29 * V29 + 9 / 11 * (C30 * V30 + 9 / 11 * (C31 * V31 + 9 / 11 * (C32 * V32 + 9 / 11 * (C33 * V33 + 9 / 11 * (C34 * V34))))))))))))))))))))))))))))))))))) / XAVGV10
-Bruce Personal Criteria Formulas TC2000 Support Articles
|