Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 12/13/2004 Posts: 4
|
did a search on %b but didn't get any results. John Bollinger in his book "Bollinger on Bollinger Bands" uses a %b indicator and gives the formula as:
(last - lower bollinger band) / (upper bollinger band - lower bollinger band) How do I write that in TC2000?
|
|
Registered User Joined: 11/28/2005 Posts: 15
|
QUOTE (pkolble) did a search on %b but didn't get any results. John Bollinger in his book "Bollinger on Bollinger Bands" uses a %b indicator and gives the formula as:
(last - lower bollinger band) / (upper bollinger band - lower bollinger band) How do I write that in TC2000?
Try this:
(C - (AVGC20 - 2 * SQR((20 * (C * C + C1 * C1 + C2 * C2 + C3 * C3 + C4 * C4 + C5 * C5 + C6 * C6 + C7 * C7 + C8 * C8 + C9 * C9 + C10 * C10 + C11 * C11 + C12 * C12 + C13 * C13 + C14 * C14 + C15 * C15 + C16 * C16 + C17 * C17 + C18 * C18 + C19 * C19) - (AVGC20 * 20) * (AVGC20 * 20)) / (20 * 20)))) / (((AVGC20 + 2 * SQR((20 * (C * C + C1 * C1 + C2 * C2 + C3 * C3 + C4 * C4 + C5 * C5 + C6 * C6 + C7 * C7 + C8 * C8 + C9 * C9 + C10 * C10 + C11 * C11 + C12 * C12 + C13 * C13 + C14 * C14 + C15 * C15 + C16 * C16 + C17 * C17 + C18 * C18 + C19 * C19) - (AVGC20 * 20) * (AVGC20 * 20)) / (20 * 20))) - (AVGC20 - 2 * SQR((20 * (C * C + C1 * C1 + C2 * C2 + C3 * C3 + C4 * C4 + C5 * C5 + C6 * C6 + C7 * C7 + C8 * C8 + C9 * C9 + C10 * C10 + C11 * C11 + C12 * C12 + C13 * C13 + C14 * C14 + C15 * C15 + C16 * C16 + C17 * C17 + C18 * C18 + C19 * C19) - (AVGC20 * 20) * (AVGC20 * 20)) / (20 * 20)))))
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
pkolble, The formula posted by bluto will work fairly well for a 20-Period Bollinger Band of Width 20, but will not match the charts exactly because the Bollinger Bands in TeleChart have a denominator of 19 in some places where his formula uses a denominator of 20. The following should produce a slightly closer match to TeleChart's charts (it should probably be noted that this number is frequently multiplied by 100 in actual practice):
Bollinger Band (20,20) %b:
(C - AVGC20) / 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 - 20 * AVGC20 ^ 2) / 19) / 4 + .5
You may wish to review the following:
Modelling Bollinger Bands (& Standard Deviation) in a TC PCF How to create a Personal Criteria Forumula (PCF) Handy PCF example formulas to help you learn the syntax of PCFs!
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 11/28/2005 Posts: 15
|
QUOTE (Bruce_L) pkolble, The formula posted by bluto will work fairly well for a 20-Period Bollinger Band of Width 20, but will not match the charts exactly because the Bollinger Bands in TeleChart have a denominator of 19 in some places where his formula uses a denominator of 20. The following should produce a slightly closer match to TeleChart's charts (it should probably be noted that this number is frequently multiplied by 100 in actual practice): Bollinger Band (20,20) %b: (C - AVGC20) / 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 - 20 * AVGC20 ^ 2) / 19) / 4 + .5 You may wish to review the following: Modelling Bollinger Bands (& Standard Deviation) in a TC PCFHow to create a Personal Criteria Forumula (PCF)Handy PCF example formulas to help you learn the syntax of PCFs!
Fantastic, Bruce! I found that %b on one of the Worden forum pages awhile back, but looks like yours is new & improved.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
bluto, It has been optimized to make it a bit shorter.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 11/13/2004 Posts: 121
|
If I also wanted to get the %b for yesterday and the day before, are these PCFs the correct approach?
%b yesterday:
(C1 - AVGC20.1) / SQR(ABS(C1 ^ 2 + C1.1 ^ 2 + C2.1 ^ 2 + C3.1 ^ 2 + C4.1 ^ 2 + C5.1 ^ 2 + C6.1 ^ 2 + C7.1 ^ 2 + C8.1 ^ 2 + C9.1 ^ 2 + C10.1 ^ 2 + C11.1 ^ 2 + C12.1 ^ 2 + C13.1 ^ 2 + C14.1 ^ 2 + C15.1 ^ 2 + C16.1 ^ 2 + C17.1 ^ 2 + C18.1 ^ 2 + C19.1 ^ 2 - 20 * AVGC20.1 ^ 2) / 19) / 4 + .5
%b two days ago:
(C2 - AVGC20.2) / SQR(ABS(C2 ^ 2 + C1.2 ^ 2 + C2.2 ^ 2 + C3.2 ^ 2 + C4.2 ^ 2 + C5.2 ^ 2 + C6.2 ^ 2 + C7.2 ^ 2 + C8.2 ^ 2 + C9.2 ^ 2 + C10.2 ^ 2 + C11.2 ^ 2 + C12.2 ^ 2 + C13.2 ^ 2 + C14.2 ^ 2 + C15.2 ^ 2 + C16.2 ^ 2 + C17.2 ^ 2 + C18.2 ^ 2 + C19.2 ^ 2 - 20 * AVGC20.2 ^ 2) / 19) / 4 + .5
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
No, you can't add an additional Bars Ago parameter to an item that already has a Bars Ago parameter.
Bollinger Band (20,20) %b (previous Bar):
(C1 - AVGC20.1) / SQR(ABS(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 - 20 * AVGC20.1 ^ 2) / 19) / 4 + .5
Bollinger Band (20,20) %b (2-Bars Ago):
(C2 - AVGC20.2) / SQR(ABS(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 - 20 * AVGC20.2 ^ 2) / 19) / 4 + .5
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 11/13/2004 Posts: 121
|
Thank you, Bruce, and happy Thanksgiving!
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome. Happy Thanksgiving!
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |