chetron 2,817 posts msg #60032 - Ignore chetron |
2/27/2008 7:52:39 PM
does anyone have something that takes a custom indictor to derive bollinger bands from,
for instance...
i would like to use something like median_price, instead of close, to wrap in bollinger bands.
any ideas would be appreciated.
tia chet
|
nikoschopen 2,824 posts msg #60034 - Ignore nikoschopen |
2/27/2008 10:35:06 PM
The Bollinger band formula consists of the following:
BOLU = Upper Bollinger Band
BOLD = Lower Bollinger Band
where
n = Smoothing Period
m = Number of Standard Deviations (SD)
SD = Standard Deviation over Last n Periods
Typical Price (TP) = (HI + LO + CL) / 3 (here replaced with (HI + LO) / 2)
BOLU = MA(TP, n) + m * SD[TP, n]
BOLD = MA(TP, n) - m * SD[TP, n]
(Source:Investopedia)
The following filter takes into account 2 standard deviation of the 20-day moving average of the "median": For some reason, however, it doesn't look right. I'm thinking the fault lies with the way the standard deviation is calculated by StockFetcher.
|
chetron 2,817 posts msg #60035 - Ignore chetron |
2/27/2008 10:46:41 PM
thank you very much, niko
|
tomb 267 posts msg #60062 - Ignore tomb |
2/29/2008 8:44:22 AM
Hi,
A couple notes on why your Custom Bollinger Band doesn't quite look right. First, on line 3 you are taking the standard deviation of the median line. According to your posted formula, it actually should be the standard deviation of the typical price, not the average of the typical price.
Next, you have placed a "pow(SD,2)" on line 4, I am not sure where that originates. Anyhow, below is a version that should produce a bit closer representation:
If you wanted, for verification, to see how these compare to the default Bollinger Bands on StockFetcher (we use "close" by default, instead of typical price.)
Tom
|
chetron 2,817 posts msg #60063 - Ignore chetron |
2/29/2008 8:55:22 AM
thank you very much, tom
chet
|
stocktrader 294 posts msg #60064 - Ignore stocktrader |
2/29/2008 9:38:42 AM
|
nikoschopen 2,824 posts msg #60065 - Ignore nikoschopen |
2/29/2008 11:49:38 AM
Tomb,
Thanks for the clarification. As for the "pow(SD,2)" on line 4, I dunno what happened. I guess I got tripped up while working with more than just one formula.
|
chetron 2,817 posts msg #60067 - Ignore chetron |
2/29/2008 12:52:02 PM
another thought....
|
nikoschopen 2,824 posts msg #60069 - Ignore nikoschopen |
2/29/2008 4:08:35 PM
Alright, bro, I fess up: I'm a slop. :^)
May this serve as a reminder to always double-check the damn filter before rubber-stamping it.
Cheers!
|
tomb 267 posts msg #60074 - Ignore tomb |
2/29/2008 7:06:59 PM
Hi,
Certainly didn't mean to imply that anything was sloppy; quite the contrary, I have seen some great StockFetcher filters from you (and many others.) I had just noticed the mention of a potential problem with the standard deviation function and wanted to double-check that the bands could be recreated!
Tom
|