Bollinger Bands discrepancy
Author: JohnColes666
Creation Date: 4/22/2012 10:23 AM
profile picture

JohnColes666

#1
I am not sure what I have done wrong. I have been modifying it significantly to try to get it to work properly. It my just be my understanding of bollinger bands.

CODE:
Please log in to see this code.

When I run this on AAP I get exactly what I expect. When I run it on AAT I get unexpected results, bollinger band are outside of the 3% channel, but they should be inside the channel.

SMA 20 BB Width 3% Width BB upper BB lower 3% Upper 3% Lower
AAP 20-APR-12 89.708 1.6866 2.6912 91.3946 88.0214 92.3992 87.0168 -- Calculated/Chart
AAT 20-APR-12 22.802 .6084 .6841 23.4104 22.1936 23.4861 22.1179 -- Calculated
AAT 20-APR-12 22.802 .7681 .684 23.5701 22.1200 33.4861 22.1200 -- Chart


Price Close for AAT
22.88
22.5
22.57
23.1
22.73
22.45
22.77
22.74
22.18
22.56
23.19
23
23.05
23.54
22.8
22.61
22.59
22.83
22.99
22.96

profile picture

Eugene

#2
To tell the truth, I dont know what you expect; but from what I saw, your SMA and BB bands are based on different data series:
CODE:
Please log in to see this code.

The set of Bollinger Bands uses High/Low while the SMA bands is based on the Close. I guess this is the answer for the unexpected "discrepancy"?
profile picture

JohnColes666

#3
Thanks, I know I was doing something stupid.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).