Bollinger Bands: population vs sample
Author: dansmo
Creation Date: 8/14/2009 9:57 AM
profile picture

dansmo

#1
Hello,

I have a difference in the Bollinger Bands between v4 and v5.
In WL4 I use the Stdandard Deviation of Sample. Is this the cause for the difference?
If yes: how can I manipulate WL5 to get the same results?
profile picture

Eugene

#2
Yes, because in V5, Bollinger bands are using the population method of calculating standard deviation -- I believe, due to simplification. Nonetheless, the author uses the population method according to his book "Bollinger on Bollinger Bands", p.52.

Knowing that the formula is utterly simple, we could reconstruct the "sample" method bands with this code:
CODE:
Please log in to see this code.

As can be seen, the difference is almost negligible.

Probably we could add BBandLower2/BBandUpper2 to Community.Indicators. Robert, what do you think?
profile picture

Cone

#3
I see both sides here:

1. Surely no one can think that one version of BB will give them a statistically significant trading advantage over the other, so I think clarifying the documentation would be sufficient, if that's required.

2. The BB indicator shouldn't have changed between v4 and v5 (afaik), so it's a bug that we should discuss.
profile picture

dansmo

#4
How can I implement this code as an own indicator, so I can use it in my strategy code?
profile picture

Eugene

#5
In strategy code, you can already use it as is: namely the BBandLower2 and BBandUpper2 data series.

Although the indicator library documentation isn't available yet, the process is pretty straightforward. You can take the free source code of Community.Indicators or TASCIndicators as a template.

Basically it takes you coding the indicator (done), implementing the IndicatorHelper interface, compiling an indicator library in Visual Studio (or SharpDevelop) and finally dropping the assembly into the Wealth-Lab 5 main folder. After restarting, your indicator will appear on the Indicator list.

I could simplify the task for you and include BBandLower2/BBandUpper2 in Community.Indicators, but we need to have the green light from Robert on this one -- after all, if it's considered a bug/limitation, the built-in indicator could be changed instead.
profile picture

dansmo

#6
At the moment, I think it will be sufficient to have it directly in the strategy code. Thank you.

Two more questions:

- in v4 I was used to write some codes I would use over and over again to studies and use the Incluse statment to use them in the code. How can this be done in v5?

- You wrote the Performance Visualizers? Is there space for enhancement suggestions? And where shall I post these?
profile picture

Eugene

#7
QUOTE:
- in v4 I was used to write some codes I would use over and over again to studies and use the Incluse statment to use them in the code. How can this be done in v5?

This has been answered many times, my bad I haven't put this on our WL5 Wiki FAQ. With .NET, you'll need to create an assembly, include your code there, compile, and drop the DLL(s) in Wealth-Lab 5's main folder. Our open source Community.Components library can serve you as a template.

As you can see from our recent replies, getting a copy of a C# IDE is what you need. Fortunately, there are excellent ones - Microsoft Visual C# Express 2008 and SharpDevelop - and you can't beat their price (free).

QUOTE:
- You wrote the Performance Visualizers? Is there space for enhancement suggestions? And where shall I post these?

1 - Yes
2 - Yes
3 - Use this link, please
profile picture

Eugene

#8
dansmo, you may create a support ticket for tracking this issue if you like.
profile picture

dansmo

#9
You mean regarding the Visualizers?
profile picture

Eugene

#10
No, I'll take a look at your visualizer idea when time permits. It's meant for tracking the BBandUpper/BBandLower bug.

Edited
profile picture

dansmo

#11
its okay for me.
profile picture

Eugene

#12
Update: A version of Bollinger Bands allowing to specify standard deviation calculation method will be included in the upcoming release of Community.Indicators.
profile picture

Cone

#13
Update 2:The version of BBands in the Standard.Indicators will be changed to the Sample method so that it matches the Version 4 indicator.
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).