TradersEdgeSystems.com

Consulting | Custom Trading Systems
Built-In Indicators | Custom Indicators

May 2010 Stocks and Commodities Traders Tips


Smoothing The Bollinger %B

Original article by Sylvain Vervoort
AIQ Code by Richard Denning
Traders Studio Code by Richard Denning

AIQ Version:

The AIQ code for Sylvain Vervoort’s indicators from his May 2010 article, “Smoothing The Bollinger % b”, is shown below. Note that I have provided only the code for the final indicator the SVE_BB%b. In order to plot the author’s indicator which contains three indicator lines and a reference line at 50 on an AIQ chart, we have to use two custom plots which I have labeled plotA and plotB in the code next to the formulas that need to be added to the AIQ chart as custom indicators.

In Figure 1, I show the plotA which has the upper band, the SVE_BB%b and the midpoint reference line at 50. We then must do plotB to show the lower band, the SVE_BB%b (repeated) and the midpoint reference line at 50 (repeated). Also note that the weighted moving average does not have an input because the parameter of 18-length for the weighted moving average (WMA) had to be coded long hand. To change this parameter we need to completely recode the WMA for the new length. All of the other values that where I have provided in the inputs (see input section of code) are parameters that can be changed without any recoding.

AIQ EDS Code for Smoothing The Bollinger %b:
Smoth PctB.EDS
(RIGHT CLICK AND CHOOSE "SAVE AS." DO NOT LEFT CLICK OR YOUR BROWSER WILL TRY TO OPEN THE FILE.)


Traders Studio Version:

The TradersStudio code for Sylvain Vervoort’s indicator and the related functions from his May 2010 article, “Smoothing The Bollinger % b”, is shown below. I broke the computations for the final indicator labeled the SVE_pctB into five separate functions: PctB, haC, TEMA, ZLHA, and SVE_pctB_HA.

  • The function pctB can calculate all the various varieties of the BB%b indicators by changing the input lengths and middle band moving average types.
  • The haC function returns the Heinkin-Ashi close as modified by the author.
  • The TEMA function returns the triple exponential moving average.
  • The ZLHA function returns the zero-lag Heinkin-Ashi close.
  • The SVE_pctB_HA function is a multi-output function and it returns the final three indicator lines, the SVE_pctB_HA along with the upperBand and the LowerBand.

Breaking up the indicator into these components makes for much easier debugging and allows us to call the functions from both the indicator plot and from a system without having to duplicate the code multiple times.

I created a simple trading system that uses the indicator which is contra-trend and then tested it on both my standard futures portfolio (38 futures contracts) and also on a group of NASDAQ stocks (101 stocks) that are both liquid and fairly volatile. The futures system performed very poorly but the stock system appears to have some potential. Since the author indicates he will provide some system tests that use the indicator in the next month’s article, I decided to wait to show my comparison tests to the original Bollinger %b until next month. So for this month, I will provide only the code and a chart showing the indicator as applied to a price chart of Apple Computer, Inc (Figure 1).

Captions:

Figure 1: Apple Inc. chart with the SVE_BB%b indicator.

Traders Studio Code for Smoothing The Bollinger %b:
SVE_%B.zip
(RIGHT CLICK AND CHOOSE "SAVE AS.")

 

 

 

 

 

 

 

 

 

 

 

 

 

Disclaimer | Privacy Policy | Contact Us | Spam Blocker | ©2009 Traders Edge Systems