Registered User Joined: 2/23/2006 Posts: 20
|
I would like to create a PCF that lets me know when the Upper Bollinger Band (standard Telechart settings of 20 period and a 20 width) has crossed the Upper Keltner Band (Custom Indicator). In otherwords, if the Upper Bollinger Band was below the Upper Keltner Band (Custom Indicator) yesterday and it is above the Upper Keltner Band (Custom Indicator) today, I would like the PCF to return True. Also I would like to create a PCF that lets me know when the Lower Bollinger Band (standard Telechart settings of 20 period and a 20 width) has crossed the Lower Keltner Band (Custom Indicator). In otherwords, if the Lower Bollinger Band was above the Keltner Band (Custom Indicator) yesterday and it is below the Keltner Band (Custom Indicator) today, I would like the PCF to return True.
For the Upper Keltner Band (Custom Indicator) I use: (AvgH20+AvgL20+AvgC20)/3 + 1.5*(AvgH20-AvgL20)
For the Lower Keltner Band (Custom Indicator) I use: (AvgH20+AvgL20+AvgC20)/3 - 1.5*(AvgH20-AvgL20)
An add-on option might be to use a 3 day range, like if they have crossed within the last three days, as an example.
Can you help me with this? Thanks
|
|
Worden Trainer
Joined: 10/1/2004 Posts: 4,308
|
This is beyond my capabilities, and it may require Bruce's expertise. He is away from the boards until next Monday, April 17th. In the meantime, I will alert him to your post so he sees it when he returns, and I will alert Craig, as well...who may or may not be able to help you.
- Doug Teaching Online!
|
|
Worden Trainer
Joined: 10/1/2004 Posts: 18,819
|
Try this for the upper band crosses. If you like it, I will put together the lower band version
(AvgH20+AvgL20+AvgC20)/3 + 1.5*(AvgH20-AvgL20) < AVGC20+2*SQR(((C-AVGC20)^2 +(C1-AVGC20)^2 +(C2-AVGC20)^2 +(C3-AVGC20)^2 +(C4-AVGC20)^2 +(C5-AVGC20)^2 +(C6-AVGC20)^2 +(C7-AVGC20)^2 +(C8-AVGC20)^2 +(C9-AVGC20)^2 +(C10-AVGC20)^2 +(C11-AVGC20)^2 +(C12-AVGC20)^2 +(C13-AVGC20)^2 +(C14-AVGC20)^2 +(C15-AVGC20)^2 +(C16-AVGC20)^2 +(C17-AVGC20)^2 +(C18-AVGC20)^2 +(C19-AVGC20)^2)/19) AND (AvgH20.1+AvgL20.1+AvgC20.1)/3 + 1.5*(AvgH20.1-AvgL20.1)> AVGC20.1+2*SQR(((C20-AVGC20.1)^2 +(C1-AVGC20.1)^2 +(C2-AVGC20.1)^2 +(C3-AVGC20.1)^2 +(C4-AVGC20.1)^2 +(C5-AVGC20.1)^2 +(C6-AVGC20.1)^2 +(C7-AVGC20.1)^2 +(C8-AVGC20.1)^2 +(C9-AVGC20.1)^2 +(C10-AVGC20.1)^2 +(C11-AVGC20.1)^2 +(C12-AVGC20.1)^2 +(C13-AVGC20.1)^2 +(C14-AVGC20.1)^2 +(C15-AVGC20.1)^2 +(C16-AVGC20.1)^2 +(C17-AVGC20.1)^2 +(C18-AVGC20.1)^2 +(C19-AVGC20.1)^2)/19)
- Craig Here to Help!
|
|
Registered User Joined: 2/23/2006 Posts: 20
|
Craig, Thanks for your help. This doesn't seem to work. Looks like it should but some stocks show no cross recently and some show a faily recent cross. None however show a cross from a day ago. It looks like your formula says that the Keltner Channel(Custom Indicator)is less then the Upper Bollinger Band today and the Keltner Channel(Custom Indicator)is greater then the Upper Bollinger Band 1 day ago. Is that correct? If so that would need to be reversed. I switched the < and > in the formula but that didnt change the results of the scan, still no stocks where the line had crossed today. Any other thoughts? Thanks
|
|
Worden Trainer
Joined: 10/1/2004 Posts: 18,819
|
Do you have "use price scale" checked when you plot your K channels?
QUOTE (you) In otherwords, if the Upper Bollinger Band was below the Upper Keltner Band (Custom Indicator) yesterday and it is above the Upper Keltner Band (Custom Indicator) today, I would like the PCF to return True.
Based on what you said here I thought the BB should be above today and below yesterday. Is that not correct?
- Craig Here to Help!
|
|
Registered User Joined: 2/23/2006 Posts: 20
|
Thanks, Yes I have "Plot using price scale" on the K channels checked and yes BB should be above today and below yesterday
|
|
Worden Trainer
Joined: 10/1/2004 Posts: 18,819
|
The PCF looks for the upper bands to be above to day and below yesterday.
Delete and recopy the PCF for me. Run the scan and give me a few tickers that show up in the scan that you think DO NOT fit.
- Craig Here to Help!
|
|
Registered User Joined: 2/23/2006 Posts: 20
|
Ok, Thanks, I also think there may be an error in the formula. On the second part of the formula after AND and then right after the *SQR((( you have C21 instead of just C1, So I deleted the C21 part of the formula. Is this correct? I edited the formula to this: (AvgH20+AvgL20+AvgC20)/3 + 1.5*(AvgH20-AvgL20) < AVGC20+2*SQR(((C-AVGC20)^2 +(C1-AVGC20)^2 +(C2-AVGC20)^2 +(C3-AVGC20)^2 +(C4-AVGC20)^2 +(C5-AVGC20)^2 +(C6-AVGC20)^2 +(C7-AVGC20)^2 +(C8-AVGC20)^2 +(C9-AVGC20)^2 +(C10-AVGC20)^2 +(C11-AVGC20)^2 +(C12-AVGC20)^2 +(C13-AVGC20)^2 +(C14-AVGC20)^2 +(C15-AVGC20)^2 +(C16-AVGC20)^2 +(C17-AVGC20)^2 +(C18-AVGC20)^2 +(C19-AVGC20)^2)/19) AND (AvgH20.1+AvgL20.1+AvgC20.1)/3 + 1.5*(AvgH20.1-AvgL20.1)> AVGC20.1+2*SQR(((C1-AVGC20.1)^2 +(C2-AVGC20.1)^2 +(C3-AVGC20.1)^2 +(C4-AVGC20.1)^2 +(C5-AVGC20.1)^2 +(C6-AVGC20.1)^2 +(C7-AVGC20.1)^2 +(C8-AVGC20.1)^2 +(C9-AVGC20.1)^2 +(C10-AVGC20.1)^2 +(C11-AVGC20.1)^2 +(C12-AVGC20.1)^2 +(C13-AVGC20.1)^2 +(C14-AVGC20.1)^2 +(C15-AVGC20.1)^2 +(C16-AVGC20.1)^2 +(C17-AVGC20.1)^2 +(C18-AVGC20.1)^2 +(C19-AVGC20.1)^2 +(C20-AVGC20.1)^2)/19)
it seems to work OK. I made some changes the end and divided by 19 instead of 20. Is that right? Please check. Thanks If this is correct, How would you do the Lower band version now?
|
|
Worden Trainer
Joined: 10/1/2004 Posts: 18,819
|
No.
C21 is correct and 20 was correct. The formula should be used as I originally gave it. The second part is for 1 day ago. All of teh AVGC20 become AVGC20.1 and C is replaced by C21.
Change it back and it should work. Run the EasyScan with the PCF. Give me any tickers that appear that you think should not.
- Craig Here to Help!
|
|
Registered User Joined: 2/23/2006 Posts: 20
|
I did a new scan with your original formula and this time it worked great, dont know why it didnt work the previous times. Here are a few symbols from the S&P 500 scan: DOV, ADBE, GPS, RRD, DUK, PCL. They all show true to the scan.
|
|
Worden Trainer
Joined: 10/1/2004 Posts: 18,819
|
Glad to hear it.
bustermu noticed a small mistake in my formula. I corrected the one above.
- Craig Here to Help!
|
|
Registered User Joined: 2/23/2006 Posts: 20
|
Thanks for you help Craig. So now what would I need to change to scan for the Lower Bollinger Band to close below the Lower Keltner Band?
|
|
Worden Trainer
Joined: 10/1/2004 Posts: 18,819
|
Try this for me
(AvgH20+AvgL20+AvgC20)/3 - 1.5*(AvgH20-AvgL20) < AVGC20-2*SQR(((C-AVGC20)^2 +(C1-AVGC20)^2 +(C2-AVGC20)^2 +(C3-AVGC20)^2 +(C4-AVGC20)^2 +(C5-AVGC20)^2 +(C6-AVGC20)^2 +(C7-AVGC20)^2 +(C8-AVGC20)^2 +(C9-AVGC20)^2 +(C10-AVGC20)^2 +(C11-AVGC20)^2 +(C12-AVGC20)^2 +(C13-AVGC20)^2 +(C14-AVGC20)^2 +(C15-AVGC20)^2 +(C16-AVGC20)^2 +(C17-AVGC20)^2 +(C18-AVGC20)^2 +(C19-AVGC20)^2)/19) AND (AvgH20.1+AvgL20.1+AvgC20.1)/3 - 1.5*(AvgH20.1-AvgL20.1)> AVGC20.1-2*SQR(((C20-AVGC20.1)^2 +(C1-AVGC20.1)^2 +(C2-AVGC20.1)^2 +(C3-AVGC20.1)^2 +(C4-AVGC20.1)^2 +(C5-AVGC20.1)^2 +(C6-AVGC20.1)^2 +(C7-AVGC20.1)^2 +(C8-AVGC20.1)^2 +(C9-AVGC20.1)^2 +(C10-AVGC20.1)^2 +(C11-AVGC20.1)^2 +(C12-AVGC20.1)^2 +(C13-AVGC20.1)^2 +(C14-AVGC20.1)^2 +(C15-AVGC20.1)^2 +(C16-AVGC20.1)^2 +(C17-AVGC20.1)^2 +(C18-AVGC20.1)^2 +(C19-AVGC20.1)^2)/19)
- Craig Here to Help!
|
|
Registered User Joined: 2/28/2005 Posts: 825
|
Craig, Bruce gave suggested a link which sent me over here. I was looking for something which would mimic the TTM SQUEEZE indicator.
I ran the first sort UP which worked great! But when running Scan #2 (for the Lower Bollinger Band to close below the Lower Keltner Band) on All Stocks, I did not receive even one True sort value. Any ideas why?
TIA
|
|
Registered User Joined: 2/28/2005 Posts: 825
|
I said Scan 1 worked fine. Actually it works pretty well. Out of all stocks, it gave me 31 true hits. But many of them, the price is crossing "Below" the lower BB line. Weird.
|
|
Gold Customer
Joined: 1/26/2005 Posts: 2
|
Craig, I just started searching for the TTM squeeze and I found that you had been working on it back in April. I tried out your PCF and it returned no hits. Is there a later version that I don't see/
QUOTE (Craig_S) Try this for me
(AvgH20+AvgL20+AvgC20)/3 - 1.5*(AvgH20-AvgL20) > AVGC20+2*SQR(((C-AVGC20)^2 +(C1-AVGC20)^2 +(C2-AVGC20)^2 +(C3-AVGC20)^2 +(C4-AVGC20)^2 +(C5-AVGC20)^2 +(C6-AVGC20)^2 +(C7-AVGC20)^2 +(C8-AVGC20)^2 +(C9-AVGC20)^2 +(C10-AVGC20)^2 +(C11-AVGC20)^2 +(C12-AVGC20)^2 +(C13-AVGC20)^2 +(C14-AVGC20)^2 +(C15-AVGC20)^2 +(C16-AVGC20)^2 +(C17-AVGC20)^2 +(C18-AVGC20)^2 +(C19-AVGC20)^2)/19) AND (AvgH20.1+AvgL20.1+AvgC20.1)/3 - 1.5*(AvgH20.1-AvgL20.1)< AVGC20.1+2*SQR(((C20-AVGC20.1)^2 +(C1-AVGC20.1)^2 +(C2-AVGC20.1)^2 +(C3-AVGC20.1)^2 +(C4-AVGC20.1)^2 +(C5-AVGC20.1)^2 +(C6-AVGC20.1)^2 +(C7-AVGC20.1)^2 +(C8-AVGC20.1)^2 +(C9-AVGC20.1)^2 +(C10-AVGC20.1)^2 +(C11-AVGC20.1)^2 +(C12-AVGC20.1)^2 +(C13-AVGC20.1)^2 +(C14-AVGC20.1)^2 +(C15-AVGC20.1)^2 +(C16-AVGC20.1)^2 +(C17-AVGC20.1)^2 +(C18-AVGC20.1)^2 +(C19-AVGC20.1)^2)/19)
|
|
Worden Trainer
Joined: 10/1/2004 Posts: 18,819
|
Error fixed. Here the correct formula for lower bands crossing.
(AvgH20+AvgL20+AvgC20)/3 - 1.5*(AvgH20-AvgL20) < AVGC20-2*SQR(((C-AVGC20)^2 +(C1-AVGC20)^2 +(C2-AVGC20)^2 +(C3-AVGC20)^2 +(C4-AVGC20)^2 +(C5-AVGC20)^2 +(C6-AVGC20)^2 +(C7-AVGC20)^2 +(C8-AVGC20)^2 +(C9-AVGC20)^2 +(C10-AVGC20)^2 +(C11-AVGC20)^2 +(C12-AVGC20)^2 +(C13-AVGC20)^2 +(C14-AVGC20)^2 +(C15-AVGC20)^2 +(C16-AVGC20)^2 +(C17-AVGC20)^2 +(C18-AVGC20)^2 +(C19-AVGC20)^2)/19) AND (AvgH20.1+AvgL20.1+AvgC20.1)/3 - 1.5*(AvgH20.1-AvgL20.1)> AVGC20.1-2*SQR(((C20-AVGC20.1)^2 +(C1-AVGC20.1)^2 +(C2-AVGC20.1)^2 +(C3-AVGC20.1)^2 +(C4-AVGC20.1)^2 +(C5-AVGC20.1)^2 +(C6-AVGC20.1)^2 +(C7-AVGC20.1)^2 +(C8-AVGC20.1)^2 +(C9-AVGC20.1)^2 +(C10-AVGC20.1)^2 +(C11-AVGC20.1)^2 +(C12-AVGC20.1)^2 +(C13-AVGC20.1)^2 +(C14-AVGC20.1)^2 +(C15-AVGC20.1)^2 +(C16-AVGC20.1)^2 +(C17-AVGC20.1)^2 +(C18-AVGC20.1)^2 +(C19-AVGC20.1)^2)/19)
- Craig Here to Help!
|
|
Gold Customer
Joined: 1/26/2005 Posts: 2
|
Craig, Thanks for the fix.
|
|
Worden Trainer
Joined: 10/1/2004 Posts: 18,819
|
My pleasure!
- Craig Here to Help!
|
|
Registered User Joined: 12/12/2006 Posts: 77
|
I actually prefer using and upper BB line setting of 13 and a lower BB line of 15 setting.
What will I have to change in the above formulas? ( Above correspondence... Upper formula - Thursday, April 13, 2006 10:12:18 AM and Lower formula - Sunday, July 16, 2006 11:32:08 AM)
Thank you for your assistance!
ucsense1
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Are you changing the Bollinger Band Period setting, the Bollinger Band Width setting or both?
Are you leaving the Keltner portions of the formulas unchanged?
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 12/12/2006 Posts: 77
|
Bollinger band settings only. i prefer 13 on upper band and 15 on lower band. I am seeking assistance on the formula changes necessary to meet these adjustments.
Thanks, Bruce!
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
I'll guess then that "Bollinger band settings only" in response to my "Are you changing the Bollinger Band Period setting, the Bollinger Band Width setting or both?" question means "Bollinger Band Period setting".
Upper Bands conversion:
(AVGH20 + AVGL20 + AVGC20) / 3 + 1.5 * (AVGH20 - AVGL20) < AVGC13 + 2 * 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 - 13 * AVGC13 ^ 2) / 12) AND (AVGH20.1 + AVGL20.1 + AVGC20.1) / 3 + 1.5 * (AVGH20.1 - AVGL20.1) > AVGC13.1 + 2 * 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 - 13 * AVGC13.1 ^ 2) / 12)
Lower Bands conversion:
(AVGH20 + AVGL20 + AVGC20) / 3 - 1.5 * (AVGH20 - AVGL20) < AVGC15 - 2 * 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 - 15 * AVGC15 ^ 2) / 14) AND (AVGH20.1 + AVGL20.1 + AVGC20.1) / 3 - 1.5 * (AVGH20.1 - AVGL20.1) > AVGC15.1 - 2 * 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 - 15 * AVGC15.1 ^ 2) / 14)
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 7/7/2008 Posts: 115
|
To above condition, I would like to add following:
BB Width is lowest over past 6 months which comes to across 126 days should be lower than 0.05
how can this be done?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
It can't. We can check for Bollinger Bandwidth being less than 0.05 in a Personal Criteria Formula (the following is designed to match a Bollinger Bandwidth Indicator with settings of 20, 2.00 in the TC2000.com version 11 beta.
4 * 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) / 20) / AVGC20 <= .05
But a formula to check for Bollinger Bandwidth being at its lowest point in the most recent 126 Bars would be too long to be practical as you would need to explicitly compare the current Bandwidth to each of the other 125 Bars. This means the formula is about 250 times the size of the fomula already given in this post. I was able to create it, but the resulting formula was too big to even be copied and pasted using the Windows clipboard.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 7/7/2008 Posts: 115
|
Thanks for quick response.
|
|
Registered User Joined: 10/7/2004 Posts: 1,006
|
QUOTE (Bruce_L)
4 * 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) / 20) / AVGC20 <= .05
Bruce, can you clarify the denominator 20, shouldn't that be 19?
Thanks
Winnie
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
No. As stated in my response, the formula is designed to match the Bollinger Band Indicator in the TC2000.com version 11 beta. If I were trying to match a Bollinger Band calculation based on the Bollinger Bands in the current production release of TeleChart, it would have used a 19 instead of a 20.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 10/7/2004 Posts: 1,006
|
Is this the correct assumption? The TC2007 PCF subtracts -1 from the MA for the denominator, as the new TC2000 version uses the MA as the denominator? It’s just my simple mind! J
TC2007 PCF Daily Time Frame for the Upper Bollinger Band (20,20), Today is:
AVGC20+ 2* 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)
TC2000 version 11 PCF Daily Time for the Upper Bollinger Band (20,20), Today is:
AVGC20+ 2* 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) / 20)
Thanks
Winnie
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Your formulas appear to be correct (although the Width is not specified in tenths of a SD in the TC2000.com version 11 beta).
The current version of TeleChart uses Standard Deviation of Sample in its Bollinger Band calculations (using Period - 1 for the denominator).
The TC2000.com version 11 beta uses Standard Deviation of Population in its Bollinger Band calculations (using Period for the denominator).
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 10/7/2004 Posts: 1,006
|
Thanks Bruce.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |