March 2006
TRADERS' TIPS
Here is this month's selection of Traders' Tips, contributed by various
developers of technical analysis software to help readers more easily implement
some of the strategies presented in this and other issues.
You can copy these formulas and programs for easy use in your spreadsheet
or analysis software. Simply "select" the desired text by highlighting
as you would in any word processing program, then use your standard key
command for copy or choose "copy" from the browser menu. The copied text
can then be "pasted" into any open spreadsheet or other software by selecting
an insertion point and executing a paste command. By toggling back and
forth between an application window and the open Web page, data can be
transferred with ease.
This month's tips include formulas and programs for:
METASTOCK: TRADING TRENDS WITH BOLLINGER BANDS Z-TEST
(BBZ)
TRADESTATION: TRADING TRENDS WITH BOLLINGER BANDS
Z-TEST (BBZ) SYSTEM
WEALTH-LAB: TRADING TRENDS WITH THE BOLLINGER BANDS Z-TEST
(BBZ) SYSTEM
AMIBROKER: TRADING TRENDS WITH BOLLINGER BANDS Z-TEST (BBZ)
AIQ SYSTEMS: TRADING TRENDS WITH BOLLINGER BANDS Z-TEST
(BBZ) SYSTEM
TRADING SOLUTIONS: TRADING TRENDS WITH BOLLINGER BANDS
Z-TEST (BBZ)
NEUROSHELL TRADER: TRADING TRENDS WITH BOLLINGER
BANDS Z-TEST (BBZ)
NEOTICKER: TRADING TRENDS WITH BOLLINGER BANDS Z-TEST
(BBZ)
TRADE NAVIGATOR: TRADING TRENDS WITH BOLLINGER BANDS Z-TEST
(BBZ) IN TRADESENSE
TECHNIFILITER PLUS: TRADING TRENDS WITH BOLLINGER
BANDS Z-TEST (BBZ) SYSTEM
BIOCOMP DAKOTA: TRADING TRENDS WITH BOLLINGER BANDS
Z-TEST (BBZ) SYSTEM
VT TRADER: TRADING TRENDS WITH BOLLINGER BANDS Z-TEST (BBZ)
SYSTEM
FINANCIAL DATA CALCULATOR: TRADING TRENDS WITH BOLLINGER
BANDS Z-TEST (BBZ)
TRADECISION: TRADING TRENDS WITH BOLLINGER BANDS
Z-TEST (BBZ) SYSTEM
SMARTRADER: TRADING TRENDS WITH BOLLINGER BANDS Z-TEST
(BBZ) SYSTEM
or return to March 2006 Contents
METASTOCK: TRADING TRENDS WITH BOLLINGER BANDS
Z-TEST (BBZ)
Editor's note: The MetaStock code for Jacinta Chan's technique
described in her article, "Trading Trends With The Bollinger Bands Z-Test,"
is already provided in a sidebar to Chan's article. The sidebar is titled
"Steps To Create Trading System BBZ In MetaStock."
GO BACK
TRADESTATION: TRADING TRENDS WITH BOLLINGER
BANDS Z-TEST (BBZ) SYSTEM
Jacinta Chan's article "Trading Trends With The Bollinger Bands Z-Test"
describes a set of trend trading signals. Entries and exits occur when
prices move above or below price bands of one standard deviation (Figure
1).

FIGURE 1: TRADESTATION, BOLLINGER BANDS Z SYSTEM. Here
is a sample chart of the emini S&P 500 continuous contract, day session
(@ES.D). The BBZ system and the Bollinger Bands indicator (which is built
into TradeStation) have both been applied to the chart. The Bollinger Bands
indicator has been set to show standard deviation bands of +1/-1.
The TradeStation code for her strategy is shown here. To download the TradeStation
code for this article, search for the file "Bbz.eld" in the TradeStation
Support Center at www.TradeStation.com.
Strategy: _BBZ EndOfBar
[IntrabarOrderGeneration = false]
inputs:
BollingerPrice( Close ),
Length( 20 ),
NumDevsUp( 1 ),
NumDevsDn( 1 ) ;
variables:
UpperBand( 0 ),
LowerBand( 0 ) ;
UpperBand = BollingerBand( BollingerPrice, Length,
NumDevsUp ) ;
LowerBand = BollingerBand( BollingerPrice, Length,
-NumDevsDn ) ;
if CurrentBar > 1 then
begin
if Close crosses over UpperBand then
Buy ( "BBandLE" ) next bar market ;
if Close crosses under UpperBand then
Sell ( "BBandLX" ) next bar at market ;
if Close crosses under LowerBand then
Sell short ( "BBandSE" ) next bar at market ;
if Close crosses over LowerBand then
Buy to cover ( "BBandSX" ) next bar market ;
end ;
-- Mitch Shack
TradeStation Securities, Inc.
www.TradeStationWorld.com
GO BACK
ESIGNAL: TRADING TRENDS WITH BOLLINGER BANDS
Z-TEST (BBZ) SYSTEM
For this month's article by Jacinta Chan, "Trading Trends With The Bollinger
Bands Z-Test," we've provided two formulas: BBZosc.efs and BBZ.efs. The
BBZosc study plots the Bbz series as a nonprice study histogram (Figure
2). The BBZ study plots a price study and includes the Bollinger Bands
for reference (Figure 3).

FIGURE 2: eSIGNAL, BOLLINGER BANDS Z SYSTEM. eSignal's
BBZosc study plots the BBZ series as a nonprice study histogram. Green
arrows suggest entry; red diamonds are exit signals.

FIGURE 3: eSIGNAL, BOLLINGER BANDS Z SYSTEM. eSignal's BBZ study
plots a price study and includes the Bollinger Bands for reference. Both
studies (BBZosc and BBZ) generate the same signals.
The trade signals generated by both studies are based on a crossing
of the +1/-1 thresholds of the BBZ series. Both studies generate the same
signals and are compatible for backtesting and real-time usage. In real
time, the studies will produce audible alerts for the trade signals and
will draw green up/down arrows for the entry signals. Red diamonds are
drawn for the exit signals.
Through the Edit Studies option in the Advanced Chart, you can customize
several study parameters for both studies. The price source for the study
is set to the closing price as the default but may be set to a number of
options (including open, high, low, close, hl2, hlc2, and ohlc4). There
are also study parameters for the number of periods and standard deviations
for the BBZ with defaults of 20 and 1, respectively. The BBZ study uses
these two parameters for the Bollinger Bands settings as well.
To discuss this study or download a complete copy of the formula, please
visit the EFS Library Discussion Board forum under the Bulletin Boards
link at www.esignalcentral.com. You can also copy and paste the eSignal
code from here (below).
BBZ.efs
/***************************************
Provided By : eSignal (c) Copyright 2006
Description: Trading Trends with Bollinger Bands Z - by Jacinta Chan
Version 1.0 01/05/2006
Notes:
* March 2006 Issue of Stocks &Commodities Magazine
* This study is configured for Back Testing and real-time usage.
* This study uses the z-score indicator and plots as a price study.
* Study requires version 7.9.1 or higher.
Formula Parameters: Defaults:
Price Source Close
[Open, High, Low, Close, HL/2, HLC/3, OHLC/4]
Number of Periods 20
Number of Standard Deviations 1
***************************************/
function preMain() {
setPriceStudy(true);
setStudyTitle("Bollinger Band Z");
setShowTitleParameters(false);
setCursorLabelName("Upper BB", 0);
setCursorLabelName("Lower BB", 1);
setCursorLabelName("BBZ", 2);
setDefaultBarThickness(2, 0);
setDefaultBarThickness(2, 1);
setComputeOnClose();
setColorPriceBars(true);
setDefaultPriceBarColor(Color.grey);
var fp1 = new FunctionParameter("sPrice", FunctionParameter.STRING);
fp1.setName("Price Source");
fp1.addOption("Open");
fp1.addOption("High");
fp1.addOption("Low");
fp1.addOption("Close");
fp1.addOption("HL/2");
fp1.addOption("HLC/3");
fp1.addOption("OHLC/4");
fp1.setDefault("Close");
var fp2 = new FunctionParameter("nLength", FunctionParameter.NUMBER);
fp2.setName("Number of Periods");
fp2.setLowerLimit(1);
fp2.setDefault(20);
var fp3 = new FunctionParameter("nStdev", FunctionParameter.NUMBER);
fp3.setName("Number of Standard Deviations");
fp3.setLowerLimit(0);
fp3.setDefault(1);
}
var bVersion = null;
var bInit = false;
var xUprBB = null; // Upper Bollinger Band Series
var xLwrBB = null; // Lower Bollinger Band Series
var xStdev = null; // Standard Deviation Series
var xPrice = null; // Price Source Series
var xMA = null; // Moving Average Series
var xZ = null; // Z-score Series
var nCntr = 0; // bar counter for shape tagIDs in doSignals()
var cLong = Color.green; // price bar color for long position
var cShort = Color.red; // price bar color for short position
var cFlat = Color.black; // price bar color for no position
var vColor = Color.grey; // current bar color
function main(sPrice, nLength, nStdev) {
if (bVersion == null) bVersion = verify();
if (bVersion == false) return;
if (bInit == false) {
xMA = sma(nLength);
switch (sPrice) {
case "Open" :
xPrice = open();
break;
case "High" :
xPrice = high();
break;
case "Low" :
xPrice = low();
break;
case "Close" :
xPrice = close();
break;
case "HL/2" :
xPrice = hl2();
break;
case "HLC/3" :
xPrice = hlc3();
break;
case "OHLC/4" :
xPrice = ohlc4();
break;
default: xPrice = close();
}
xUprBB = upperBB(nLength, nStdev, xPrice);
xLwrBB = lowerBB(nLength, nStdev, xPrice);
xStdev = efsInternal("Stdev", nLength, xPrice);
xZ = efsInternal("calcZ", xPrice, xMA, xStdev, nStdev)
bInit = true;
}
var nState = getBarState();
var Z = xZ.getValue(0);
var Z_1 = xZ.getValue(-1);
if (Z_1 == null) return;
if (nState == BARSTATE_NEWBAR) {
nCntr++;
bExit = false;
}
doSignals(Z, Z_1);
setPriceBarColor(vColor);
if (getCurrentBarIndex() < 0) doBackTest(Z, Z_1);
return new Array(xUprBB.getValue(0), xLwrBB.getValue(0), Z.toFixed(2));
}
/***** Support Functions *****/
var bExit = false; // Flags an exit trade to prevent re-entry on
// the same bar.
function doBackTest(z, z_1) {
// long exit
if (Strategy.isLong()) {
if (z_1 >= 1 && z < 1) {
Strategy.doSell("Long Stop",
Strategy.CLOSE, Strategy.THISBAR);
bExit = true;
}
}
// short exit
if (Strategy.isShort()) {
if (z_1 <= -1 && z > -1) {
Strategy.doCover("Short Stop",
Strategy.CLOSE, Strategy.THISBAR);
bExit = true;
}
}
// long entry
if (!Strategy.isLong() && bExit == false) {
if (z_1 <= 1 && z > 1) Strategy.doLong("Long Entry",
Strategy.CLOSE, Strategy.THISBAR);
}
// short entry
if (!Strategy.isShort() && bExit == false) {
if (z_1 >= -1 && z < -1) Strategy.doShort("Short Entry",
Strategy.CLOSE, Strategy.THISBAR);
}
return;
}
function doSignals(z, z_1) {
// long entry
if (z_1 <= 1 && z > 1) {
drawShape(Shape.UPARROW, BelowBar1, Color.green, "upEntry"+nCntr);
Alert.playSound("ding.wav");
vColor = cLong;
}
// short entry
if (z_1 >= -1 && z < -1) {
drawShape(Shape.DOWNARROW, AboveBar1, Color.green, "dnEntry"+nCntr);
Alert.playSound("ding.wav");
vColor = cShort;
}
// long exit
if (z_1 >= 1 && z < 1) {
drawShape(Shape.DIAMOND, AboveBar1, Color.maroon, "upExit"+nCntr);
Alert.playSound("train.wav");
vColor = cFlat;
}
// short exit
if (z_1 <= -1 && z > -1) {
drawShape(Shape.DIAMOND, BelowBar1, Color.maroon, "dnExit"+nCntr);
Alert.playSound("train.wav");
vColor = cFlat;
}
return;
}
function Stdev(n, source) {
if (source.getValue(-n) == null) return null;
var sumX = 0;
var sumX2 = 0;
for (i = 0; i < n; ++i) {
sumX += source.getValue(-i);
sumX2 += (source.getValue(-i) * source.getValue(-i))
}
var meanX = (sumX/n);
var stdev = Math.sqrt((sumX2/n) - (meanX*meanX));
return stdev;
}
function calcZ(c, m, s, n) {
if (c.getValue(0) == null || m.getValue(0) == null ||
s.getValue(0) == null) return null;
var z = (c.getValue(0) - m.getValue(0)) / (s.getValue(0) * n);
return z;
}
function verify() {
var b = false;
if (getBuildNumber() < 730) {
drawTextAbsolute(5, 35, "This study requires version 7.9.1 or later.",
Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
null, 13, "error");
drawTextAbsolute(5, 20, "Click HERE to upgrade.@URL=http://www.esignal.com/download/default.asp",
Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
null, 13, "upgrade");
return b;
} else {
b = true;
}
return b;
}
BBZOSC.efs
/***************************************
Provided By : eSignal (c) Copyright 2006
Description: Trading Trends with Bollinger Bands Z - by Jacinta Chan
Version 1.0 01/05/2006
Notes:
* March 2006 Issue of Stocks and Commodities Magazine
* This study is configured for Back Testing and real-time usage.
* This study uses the z-score indicator and plots as a non-price study.
* Study requires version 7.9.1 or higher.
Formula Parameters: Defaults:
Price Source Close
[Open, High, Low, Close, HL/2, HLC/3, OHLC/4]
Number of Periods 20
Number of Standard Deviations 1
***************************************/
function preMain() {
setStudyTitle("BBZ Oscillator");
setShowTitleParameters(false);
setCursorLabelName("BBZ", 0);
setDefaultBarThickness(2, 0);
setComputeOnClose();
setColorPriceBars(true);
setDefaultPriceBarColor(Color.grey);
setPlotType(PLOTTYPE_HISTOGRAM, 0);
addBand(0, PS_SOLID, 1, Color.black, "0");
addBand(1, PS_SOLID, 2, Color.red, "1");
addBand(-1, PS_SOLID, 2, Color.red, "-1");
var fp1 = new FunctionParameter("sPrice", FunctionParameter.STRING);
fp1.setName("Price Source");
fp1.addOption("Open");
fp1.addOption("High");
fp1.addOption("Low");
fp1.addOption("Close");
fp1.addOption("HL/2");
fp1.addOption("HLC/3");
fp1.addOption("OHLC/4");
fp1.setDefault("Close");
var fp2 = new FunctionParameter("nLength", FunctionParameter.NUMBER);
fp2.setName("Number of Periods");
fp2.setLowerLimit(1);
fp2.setDefault(20);
var fp3 = new FunctionParameter("nStdev", FunctionParameter.NUMBER);
fp3.setName("Number of Standard Deviations");
fp3.setLowerLimit(0);
fp3.setDefault(1);
}
var bVersion = null;
var bInit = false;
var xStdev = null; // Standard Deviation Series
var xPrice = null; // Price Source Series
var xMA = null; // Moving Average Series
var xZ = null; // Z-score Series
var nCntr = 0; // bar counter for shape tagIDs in doSignals()
var cLong = Color.green; // price bar color for long position
var cShort = Color.red; // price bar color for short position
var cFlat = Color.black; // price bar color for no position
var vColor = Color.grey; // current bar color
function main(sPrice, nLength, nStdev) {
if (bVersion == null) bVersion = verify();
if (bVersion == false) return;
if (bInit == false) {
xMA = sma(nLength);
switch (sPrice) {
case "Open" :
xPrice = open();
break;
case "High" :
xPrice = high();
break;
case "Low" :
xPrice = low();
break;
case "Close" :
xPrice = close();
break;
case "HL/2" :
xPrice = hl2();
break;
case "HLC/3" :
xPrice = hlc3();
break;
case "OHLC/4" :
xPrice = ohlc4();
break;
default: xPrice = close();
}
xStdev = efsInternal("Stdev", nLength, xPrice);
xZ = efsInternal("calcZ", xPrice, xMA, xStdev, nStdev)
bInit = true;
}
var nState = getBarState();
var Z = xZ.getValue(0);
var Z_1 = xZ.getValue(-1);
if (Z_1 == null) return;
if (nState == BARSTATE_NEWBAR) {
nCntr++;
bExit = false;
}
doSignals(Z, Z_1);
setPriceBarColor(vColor);
setBarFgColor(vColor);
if (getCurrentBarIndex() < 0) doBackTest(Z, Z_1);
return Z;
}
/***** Support Functions *****/
var bExit = false; // Flags an exit trade to prevent re-entry on
// the same bar.
function doBackTest(z, z_1) {
// long exit
if (Strategy.isLong()) {
if (z_1 >= 1 && z < 1) {
Strategy.doSell("Long Stop",
Strategy.CLOSE, Strategy.THISBAR);
bExit = true;
}
}
// short exit
if (Strategy.isShort()) {
if (z_1 <= -1 && z > -1) {
Strategy.doCover("Short Stop",
Strategy.CLOSE, Strategy.THISBAR);
bExit = true;
}
}
// long entry
if (!Strategy.isLong() && bExit == false) {
if (z_1 <= 1 && z > 1) Strategy.doLong("Long Entry",
Strategy.CLOSE, Strategy.THISBAR);
}
// short entry
if (!Strategy.isShort() && bExit == false) {
if (z_1 >= -1 && z < -1) Strategy.doShort("Short Entry",
Strategy.CLOSE, Strategy.THISBAR);
}
return;
}
function doSignals(z, z_1) {
// long entry
if (z_1 <= 1 && z > 1) {
drawShape(Shape.UPARROW, TopRow2, Color.green, "upEntry"+nCntr);
Alert.playSound("ding.wav");
vColor = cLong;
}
// short entry
if (z_1 >= -1 && z < -1) {
drawShape(Shape.DOWNARROW, BottomRow2, Color.green, "dnEntry"+nCntr);
Alert.playSound("ding.wav");
vColor = cShort;
}
// long exit
if (z_1 >= 1 && z < 1) {
drawShapeRelative(0, 1, Shape.DIAMOND, null,
Color.maroon, null, "upExit"+nCntr);
Alert.playSound("train.wav");
vColor = cFlat;
}
// short exit
if (z_1 <= -1 && z > -1) {
drawShapeRelative(0, -1, Shape.DIAMOND, null,
Color.maroon, null, "dnExit"+nCntr);
Alert.playSound("train.wav");
vColor = cFlat;
}
return;
}
function Stdev(n, source) {
if (source.getValue(-n) == null) return null;
var sumX = 0;
var sumX2 = 0;
for (i = 0; i < n; ++i) {
sumX += source.getValue(-i);
sumX2 += (source.getValue(-i) * source.getValue(-i))
}
var meanX = (sumX/n);
var stdev = Math.sqrt((sumX2/n) - (meanX*meanX));
return stdev;
}
function calcZ(c, m, s, n) {
if (c.getValue(0) == null || m.getValue(0) == null ||
s.getValue(0) == null) return null;
var z = (c.getValue(0) - m.getValue(0)) / (s.getValue(0) * n);
return z;
}
function verify() {
var b = false;
if (getBuildNumber() < 730) {
drawTextAbsolute(5, 35, "This study requires version 7.9.1 or later.",
Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
null, 13, "error");
drawTextAbsolute(5, 20, "Click HERE to upgrade.@URL=http://www.esignal.com/download/default.asp",
Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
null, 13, "upgrade");
return b;
} else {
b = true;
}
return b;
}
--Jason Keck
eSignal, a division of Interactive Data Corp.
800 815-8256, www.esignalcentral.com
GO BACK
WEALTH-LAB: TRADING TRENDS WITH THE BOLLINGER
BANDS Z-TEST (BBZ) SYSTEM
We employed the ChartScript Wizard to generate this month's WealthScript
code in just a few seconds. Using the Wizard, you can create complete trading
systems by simply matching entry and exit rules with their conditions (Figure
4).

FIGURE 4: WEALTH-LAB, BOLLINGER BANDS Z SYSTEM. Here
is the ChartScript Wizard in Wealth-Lab with the complete BBZ trading system.
Highlighting the conditions gives you the opportunity to edit their parameters.
The BBZ system appears to have merit in entering strong trends and
then exiting them without giving back too much of the profit. Nevertheless,
we didn't find the system particularly profitable for many securities --
certainly not for stocks, which, even when trending, seem to frequently
whipsaw around the one-standard-deviation Bollinger Bands.
WealthScript code:
{* The ChartScript Wizard automatically generated this code *}
var BBUp, BBUp1, BBDown, BBDown1: integer;
var Bar, p: integer;
BBUp := BBandUpperSeries( #Close, 20, 1 );
BBUp1 := BBandUpperSeries( #Close, 20, 1 );
BBDown := BBandLowerSeries( #Close, 20, 1 );
BBDown1 := BBandLowerSeries( #Close, 20, 1 );
PlotSeries( BBUp, 0, 559, #Thick );
PlotSeries( BBDown, 0, 559, #Thick );
for Bar := 20 to BarCount - 1 do
begin
if LastPositionActive then
begin
p := LastPosition;
if PositionLong( p ) then
begin
if CrossUnder( Bar, #Close, BBUp1 ) then
begin
SellAtMarket( Bar + 1, p, '' );
end;
end;
if PositionShort( p ) then
begin
if CrossOver( Bar, #Close, BBDown1 ) then
begin
CoverAtMarket( Bar + 1, p, '' );
end;
end;
end
else
begin
if not LastPositionActive then
begin
if CrossOver( Bar, #Close, BBUp ) then
begin
BuyAtMarket( Bar + 1, '0' );
end;
end;
if not LastPositionActive then
begin
if CrossUnder( Bar, #Close, BBDown ) then
begin
ShortAtMarket( Bar + 1, '4' );
end;
end;
end;
end;
--Robert Sucher
www.wealth-lab.com
GO BACK
AMIBROKER: TRADING TRENDS WITH BOLLINGER BANDS
Z-TEST (BBZ)
In "Trading Trends With The Bollinger Bands Z-Test," Jacinta Chan presents
a very simple trading system based on Bollinger Bands. The system originally
has been applied to futures but also can be applied to other kinds of instruments.
Ready-to-use code is provided in Listing 1. If you need to perform a
points-only test, you need to uncomment the last line of the formula, and
enable "Futures mode" in the settings. If you want to perform a test on
stocks, for example, leave the formula as it is.
LISTING 1
/* BBZ Trading system */
Buy = Close > BBandTop( Close, 20, 1 );
Sell = Close < BBandTop( Close, 20, 1 );
Short = Close < BBandBot( Close, 20, 1 );
Cover = Close > BBandBot( Close, 20, 1 );
// if you want point-only test (single contract trading)
// un-comment the line below
// PositionSize = MarginDeposit = 1;
--Tomasz Janeczko, AmiBroker.com
www.amibroker.com
GO BACK
AIQ SYSTEMS: TRADING TRENDS WITH BOLLINGER
BANDS Z-TEST (BBZ) SYSTEM
The AIQ code discussed here is for Jacinta Chan's trading system described
in her article in this issue, "Trading Trends With The Bollinger Bands
Z-Test."
Since the AIQ program is particularly well suited to test a trading
system on a portfolio of stocks, I decided to devise a system that would
trade the NASDAQ 100 list of stocks. I used the period 9/1/2000 to 1/6/2006
as the in-sample period to adjust the parameters. This period includes
bear, bull, and sideways market periods.
In contrast to futures trading systems, trend-following stock trading
systems that work well are rather difficult to construct due to the fact
that individual stocks do not tend to trend as much as futures and also
are more volatile. Generally, a trend-following system will require market
timing filters to avoid large drawdowns. In running a few tests, I found
that 40 days and 0.9 standard deviations were among the better parameter
sets for the in-sample period.
The results of the in-sample test when both the long and short side
were included were less than satisfactory without market timing filters.
The long side worked during the bullish periods but the short side did
not. Conversely, the short side worked during the bearish periods but the
long side did not.
I then added some trend-following market timing filters using the NASDAQ
index (NDX). The filters help prevent the system from taking short positions
on individual stocks when the NDX is trending upward and prevent the system
from taking long positions when the NDX is trending downward.
Once the market timing filters were added, the system performance drastically
improved. I also ran out-of-sample tests for the two systems during the
period 9/1/1995 to 9/1/2000. The results of the in-sample and out-of-sample
tests are summarized in the following table:

Figure 5 shows the equity curve compared to the NDX for the period
9/1/1995 to 1/06/2005 for the system using the market timing filters.

FIGURE 5: AIQ, BOLLINGER BANDS Z SYSTEM WITH TIMING FILTERS
ADDED. Here is the equity curve for the combined long and short BBZ
system with market timing filters trading the NASDAQ 100 stocks, compared
to the NASDAQ 100 index.
The AIQ code for this system can be downloaded from AIQ's website
at www.aiqsystems.com and also can be viewed or copied and pasted from
here.
!!! TRADING TRENDS WITH BOLLINGER BANDS Z (BBZ)
!! Author: Jacinta Chan, TASC February 2006
!! Coded by: Richard Denning 01/06/2006
! BOLLINGER BAND CODE
! Set parameters:
Define L 40.
Define Factor1 0.9.
! Standard Deviation is the square root of variance over length L:
Variance is Variance([close]-SMA,L).
StdDev is Sqrt(Variance).
! Middle Band
SMA is simpleavg([close],L).
! Upper Band
BBUpper is SMA + Factor1 * StdDev.
! Lower Band
BBLower is SMA - Factor1 * StdDev.
!! Plot the above three bands as single line indicators on chart.
! Z-SCORE CODE
Z is ([close] - SMA) / StdDev.
! TRADING SYSTEM RULES USING BOLLINGER BANDS
! Long position entry (LE1) and exit (LX1) rules:
LE1 if [close] > BBUpper and valrule([close] < BBUpper,1) and DF.
LX1 if [close] < BBUpper.
! Short position entry (SE1) and exit (SX1) rules:
SE1 if [close] < BBLower and valrule([close] > BBLower,1) and DF.
SX1 if [close] > BBLower.
! TRADING SYSTEM RULES USING Z-SCORE
! Long position entry (LE2) and exit (LX2) rules:
LE2 if Z > Factor1 and valrule(Z < Factor1,1) and DF.
LX2 if Z < Factor1.
! Short position entry (SE2) and exit (SX2) rules:
SE2 if Z < -Factor1 and valrule(Z > -Factor1,1) and DF.
SX2 if Z > -Factor1.
! MARKET TIMING RULES FOR TRADING NASDAQ 100
SMA20 is expavg([close],20).
SMA100 is expavg([close],100).
SMA200 is expavg([close],200).
LEn100 if TickerRule("NDX",Z > 1)
and TickerRule("NDX",slope2(SMA,5)>0).
LXn100 if TickerRule("NDX",Z < 0.1)
or TickerRule("NDX",slope2(SMA,5)<0).
SEn100 if TickerRule("NDX",Z < -0.1)
and TickerRule("NDX",slope2(SMA,5)<0)
and TickerRule("NDX",[close]<SMA100).
SXn100 if TickerRule("NDX",Z > -0.1)
or TickerRule("NDX",slope2(SMA,5)>0)
or TickerRule("NDX",[close]>SMA100).
! TRADING RULES INCLUDING MARKET TIMING FILTERS
LE3 if LE2 and LEn100.
LX3 if LX2.
SE3 if SE2 and SEn100.
SX3 if SX2 or SXn100.
!DATA FILTER FOR TRADING STOCKS
DF if [close] > 5 and HasDataFor(L+10) > L.
--Richard Denning, AIQ Systems
richard.denning@earthlink.net
www.AIQSystems.com
GO BACK
TRADING SOLUTIONS: TRADING TRENDS WITH BOLLINGER
BANDS Z-TEST (BBZ)
In "Trading Trends With The Bollinger Bands Z-Test," Jacinta Chan demonstrates
a trading system based on Bollinger Bands and the z-score indicator.
This system can be entered into TradingSolutions as described below.
It's also available as a function file that can be downloaded from the
TradingSolutions website (www.tradingsolutions.com) in the Solution Library
section.
System Name: Bollinger Bands Z System
Inputs: Price, Period (20), Width (1)
Enter Long: GT ( Price, BBandTop ( Price, Period, Width ) )
Exit Long: LT ( Price, BBandTop ( Price, Period, Width ) )
Enter Short: LT ( Price, BBandBottom ( Price, Period, Width ) )
Exit Short: GT ( Price, BBandBottom ( Price, Period, Width ) )
--Gary Geniesse, NeuroDimension, Inc.
800 634-3327, 352 377-5144
www.tradingsolutions.com
GO BACK
NEUROSHELL TRADER: TRADING TRENDS WITH BOLLINGER
BANDS Z-TEST (BBZ)
The Bollinger Band z system described by Jacinta Chan can be easily
implemented in NeuroShell Trader by combining a few of the NeuroShell Trader's
800+ indicators. A sample chart is shown in Figure 6. To recreate the breakout
system, select "New Trading Strategy ..." from the Insert menu and enter
the following entry and exit conditions in the appropriate locations of
the Trading Strategy Wizard:

FIGURE 6: NEUROSHELL, BOLLINGER BANDS Z SYSTEM. Here
is a sample NeuroShell chart demonstrating the Bollinger Band Z system
for determining trends.
Generate a buy long MARKET order if ALL of the following are true:
A>B ( Close, BollingerBandHigh ( Close, 20, 1.0 ) )
Generate a sell long MARKET order if ALL of the following are true:
A<B ( Close, BollingerBandHigh ( Close, 20, 1.0 ) )
Generate a sell short MARKET order if ALL of the following are true:
A<B ( Close, BollingerBandLow ( Close, 20, 1.0 ) )
Generate a cover short MARKET order if ALL of the following are true:
A>B ( Close, BollingerBandLow ( Close, 20, 1.0 ) )
If you have NeuroShell Trader Professional, you can also choose
whether the system parameters should be optimized. After backtesting the
trading strategy, use the "Detailed Analysis..." button to view the backtest
and trade-by-trade statistics for the Bollinger Band z trading system.
--Marge Sherald, Ward Systems Group, Inc.
301 662-7950, sales@wardsystems.com
www.neuroshell.com
GO BACK
NEOTICKER: TRADING TRENDS WITH BOLLINGER BANDS
Z-TEST (BBZ)
NeoTicker's Backtest EZ indicator is a perfect tool to implement the
ideas presented in "Trading Trends With The Bollinger Bands Z-Test" by
Jacinta Chan found in this issue.
Backtest EZ is a NeoTicker power indicator that produces backtesting
results. It requires users to enter long, short, entry, and exit rules
in formula format. This indicator has selection settings to allow users
to set trailing stops, stop losses, and target stop rules, along with different
price multiple and commission settings to fit different trading instruments.
To test the BBZ strategy using Backtest EZ in NeoTicker, first add a
data series to a chart. Next, add Backtest EZ. At the long, short, entry,
and exit fields, type in the BBZ trading rules (Listing 1). The result
is an equity curve plotted on the chart in a separate pane, along with
trades marked on the data series (Figure 7).

FIGURE 7: NEOTICKER, BOLLINGER BANDS Z SYSTEM. Here
is the equity curve for the BBZ strategy plotted in the bottom pane, with
trades marked on the data series in the upper pane.
NeoTicker's performance viewer can be used to view and analyze detailed
system performance results. The comparisons and analysis statistics shown
in the article can all be recreated in NeoTicker through the performance
report. To bring up the performance viewer, right-click on Backtest EZ
in the chart, then from the popup menu, select Trading System>Open performance
viewer.
The chart group with Backtest EZ will be available for download from
the TickQuest website.
LISTING 1
Long Entry: c > bbands3.Plot3(data1,20,1)
Long Exit: c < bbands3.Plot3(data1,20,1)
Short Entry: c < bbands3.Plot2(data1,20,1)
Short Exit: c > bbands3.Plot2(data1,20,1)
--Kenneth Yuen, TickQuest Inc.
www.tickquest.com
GO BACK
TRADE NAVIGATOR: TRADING TRENDS WITH BOLLINGER
BANDS Z-TEST (BBZ) IN TRADESENSE
In the Trade Navigator Platinum version, you can create a strategy and
backtest it to see its past performance record.
The functions needed to create the BBZ strategy are already provided
for you in Trade Navigator. Bollinger Bands (upper and lower) are already
included in the Trade Navigator program. To recreate the strategy for BBZ
in Trade Navigator, follow these steps.
First, we will open a new strategy:
1. Go to the Edit menu and click on Strategies. This will bring up the
Trader's Toolbox already set to the Strategies tab (Figure 8A).

FIGURE 8A: STRATEGIES TAB
2. Click on the New button. This will open a New Strategy window
(Figure 8B).
FIGURE 8B: NEW STRATEGY
Now you are ready to start creating rules for your strategy:
Bbz Enter Long Buy
(1) Click on the New Rule button.
(2) You will be asked if you would like to use the Condition Builder. In this case click No.
This will take you to the New Rule window.
(3) Type the formula IF Close > Bollinger Upper Band (Close , 20 , 1) into the Condition box.
(FIGURE 8C)
FIGURE 8C: TRADE NAVIGATOR, BOLLINGER BANDS Z SYSTEM, NEW RULE WINDOW
(4) Set the Order to place for Next Bar Action to Long Entry (BUY), and the Order Type to Market.
(5) Click the Verify button.
(6) Click the Save button and type Bbz Enter Long Buy for the name of the Rule then click Ok.
(7) Click the X in the upper right corner of the Rule editor window to return to the New Strategy
Window.
Bbz Exit Long Sell
(1) Click on the New Rule button.
(2) You will be asked if you would like to use the Condition Builder. In this case click No. This
will take you to the New Rule window.
(3) Type the formula IF Close < Bollinger Upper Band (Close , 20 , 1) into the Condition box.
(4) Set the Order to place for Next Bar Action to Long Exit (SELL), and the Order Type to Market.
(5) Click the Verify button.
(6) Click the Save button and type Bbz Exit Long Sell for the name of the Rule then click Ok.
(7) Click the X in the upper right corner of the Rule editor window to return to the New Strategy
Window.
Bbz Enter Short Sell
(1) Click on the New Rule button.
(2) You will be asked if you would like to use the Condition Builder. In this case click No. This
will take you to the New Rule window.
(3) Type the formula IF Close < Bollinger Lower Band (Close , 20 , 1) into the Condition box.
(4) Set the Order to place for Next Bar Action to Short Entry (SELL), and the Order Type to Market.
(5) Click the Verify button.
(6) Click the Save button and type Bbz Enter Short Sell for the name of the Rule then click Ok.
(7) Click the X in the upper right corner of the Rule editor window to return to the New Strategy
Window.
Bbz Exit Short Buy
(1) Click on the New Rule button.
(2) You will be asked if you would like to use the Condition Builder. In this case click No. This
will take you to the New Rule window.
(3) Type the formula IF Close > Bollinger Lower Band (Close , 20 , 1) into the Condition box.
(4) Set the Order to place for Next Bar Action to Short Exit (BUY), and the Order Type to Market.
(5) Click the Verify button.
(6) Click the Save button and type Bbz Exit Short Buy for the name of the Rule then click Ok.
(7) Click the X in the upper right corner of the Rule editor window to return to the New Strategy
Window.
After you have set up these buy and sell rules, click on the Data tab and
select the symbol that you wish to run the strategy on. (This can be changed
later to a different symbol.)
To save your new strategy, click the Save button and type "Bbz" for
the name of the strategy, then click the OK button.
Now that you have saved your new strategy, you can run the strategy
by clicking the Run button. This will bring up the Performance Reports
for this strategy. You will find the z-score displayed on the performance
report.
You can check to see if there is an order to place for the next bar
by clicking the Orders button. This will bring up the "Orders for next
bar" report.
Another way to use your new strategy in the Trade Navigator Platinum
version is to apply it to a chart to visually determine where the trades
were placed over the history of the chart. To do this:
1. Click on the chart.
2. Type the letter "A."
3. Click on the Strategies tab and doubleclick the name of the strategy
in the list.
You can also view the "Orders for next bar report" from a chart that the
strategy is applied to by clicking the "Orders for the next bar" button
on the toolbar.
For your convenience, Genesis has created a special file that you can
download through the Trade Navigator program that will add this strategy
to Trade Navigator for you. Simply download the free special file SC0106
using your Trade Navigator and follow the upgrade prompts.
--Michael Herman
Genesis Financial Technologies
http://www.GenesisFT.com
GO BACK
TECHNIFILTER PLUS: TRADING TRENDS WITH BOLLINGER
BANDS Z-TEST (BBZ) SYSTEM
Here are the TechniFilter Plus formulas based on Jacinta Chan's article
in this issue, "Trading Trends With The Bollinger Bands Z-Test." A sample
chart is shown in Figure 9.

FIGURE 9: TECHNIFILTER PLUS, BOLLINGER BANDS Z SYSTEM. Here
is the formula for the BBZ system in TechniFilter.
NAME: BBZ
TEST TYPE: equal
FORMULAS--------
[1] Date
[2] TopBand(20,1)
ca&1+&2*c|&1
[3] BottomBand(20,1)
ca&1-&2*c|&1
[4] Close
C
RULES--------
r1: EnterLong
buy long all on Next Open
at signal: EnterLong [4] > [2] & Shares = 0
r2: ExitLong
stop long all on Next Open
at signal: ExitLong [4] < [2]
r3: EnterShort
open short all on Next Open
at signal: EnterShort [4] < [3] & Shares = 0
r4: ExitShort
stop short all on Next Open
at signal: closeall [4] > [3]
Visit the TechniFilter Plus website at www.technifilter.com
to download this strategy.
--Benzie Pikoos, Brightspark
+61 8 9375-1178, sales@technifilter.com
www.technifilter.com
GO BACK
BIOCOMP DAKOTA: TRADING TRENDS WITH BOLLINGER
BANDS Z-TEST (BBZ) SYSTEM
The z-score Bollinger Bands trading system (BBZ) described by Jacinta
Chan in her article in this issue can be easily implemented in BioComp
Dakota by using ScriptBots and a few calls to built-in functions. Using
the ScriptBot's "CreateSignal" function, this Visual Basic ScriptBot code
shows how:
MAValue = Dakota.SMA(PriceHistory,20)
Stdev = Dakota.StdDev(PriceHistory,20)
If Stdev <> 0 Then
ZScore = (Prices(2) - MAValue) / Stdev
Else
ZScore = 0
End If
If ZScore > 1 Then
Signal = 1
ElseIf ZScore < 1 and ZScore > -1 Then
Signal = 0
Else
Signal = -1
End If
Running the bot with a fixed 20-period window on the Russell 2000 Index
over the last five years produces a rocky equity curve, as shown in Figure
10 (values are in points).

FIGURE 10: BIOCOMP, BOLLINGER BANDS Z SYSTEM (BBZ). Here
is the BBZ system on the Russell 2000 index using a fixed 20-period window
on the Russell 2000 Index over the last five years. This system produces
a rocky equity curve.
However, allowing Dakota to perform a bar-by-bar "walk-forward"
to adapt the moving average between 20 and 50 periods and making the z-score
thresholds adaptable between 0.5 and 1.5, the equity curve straightens
to beat buy & hold. These aren't exactly stellar results, but it's
certainly an improvement over buy & hold. The following code performs
this adaptive scheme:
MAValue = Dakota.SMA(PriceHistory,ParameterValue(1))
Stdev = Dakota.StdDev(PriceHistory,ParameterValue(1))
If Stdev <> 0 Then
ZScore = (Prices(2) - MAValue) / Stdev
Else
ZScore = 0
End If
If ZScore > ParameterValue(2) Then
Signal = 1
ElseIf ZScore < ParameterValue(2) and ZScore > -ParameterValue(2) Then
Signal = 0
Else
Signal = -1
End If
Figure 11 illustrates the advantage of Dakota's adaptive Swarm Technology
to enhance trading schemes -- in this case, by about 11-fold.

FIGURE 11: BIOCOMP, BOLLINGER BANDS Z SYSTEM (BBZ). Here
is the BBZ system on the Russell 2000 index using adaptive periods and
decision thresholds.
--Carl Cook, BioComp Systems, Inc.
952 746-5761
www.biocompsystems.com/profit
GO BACK
VT TRADER: TRADING TRENDS WITH BOLLINGER BANDS
Z-TEST (BBZ) SYSTEM
Jacinta Chan's article in this issue, "Trading Trends With The Bollinger
Bands Z-Test," introduces a mechanical trading system based on Bollinger
Bands and the z-score indicator (described in the online Working Money
article
at Working-Money.com, "Z-Score Indicator" by Veronique Valcu, October 2002).
The BBZ trading system defines an uptrend as closing prices being above
the +1 standard deviation band of its mean and a downtrend as being below
the -1 standard deviation band of its mean.
We'll be offering the BBZ trading system as a .vttrs trading system
file in our user forums. The VT Trader code and instructions for creating
this trading system are as follows (each input variable has been parameterized
to allow customization):
1. Navigator Window>Tools>Trading Systems Builder>[New] button
2. In the Indicator Bookmark, type the following text for each field:
Name: BBZ - Trading Trends with Bollinger Bands Z
Short Name: vt_BBZ_TS
Label Mask: BBZ - Trading Trends with Bollinger Bands (%pr%, %tPr%, %ma%, %D%)
3. In the Input Bookmark, create the following variables:
[New] button... Name: Pr , Display Name: Price , Type: price , Default: Close Price
[New] button... Name: tPr , Display Name: Periods , Type: integer , Default: 20
[New] button... Name: ma , Display Name: MA Type , Type: MA Type , Default: Simple
[New] button... Name: D , Display Name: Deviations , Type: Float , Default: 1.0
4. In the Formula Bookmark, copy and paste the following formula:
{Provided By: Visual Trading Systems, LLC (c) Copyright 2006}
{Description: Trend Trading with Bollinger Bands Z (BBZ) Trading System}
{Notes: March 2006 Issue - Trading Trends with Bollinger Bands Z (BBZ) by Jacinta Chan}
{vt_BBZ_TS Version 1.0}
{Bollinger Band Indicator}
MiddleBand:= Mov(Pr,tPr,ma);
UpperBand:= BLines(Pr,mov(Pr,tPr,ma),tPr,D,0);
LowerBand:= BLines(Pr,mov(Pr,tPr,ma),tPr,D,1);
{Z-Score Indicator}
Z:= (Pr - Mov(Pr,tPr,ma)) / stdev(Pr,tPr);
{Define Basic Long & Short Trade Conditions}
LongEntryCond:= Cross(Pr,UpperBand);
LongExitCond:= Cross(UpperBand,Pr);
ShortEntryCond:= Cross(LowerBand,Pr);
ShortExitCond:= Cross(Pr,LowerBand);
{Entry and Exit Trade Conditions}
LongEntrySignal:= (TradeCondition=0 AND LongEntryCond) OR (ShortExitSignal AND LongEntryCond);
LongExitSignal:= TradeCondition=1 AND LongExitCond;
ShortEntrySignal:= (TradeCondition=0 AND ShortEntryCond) OR (LongExitSignal AND ShortEntryCond);
ShortExitSignal:= TradeCondition=-1 AND ShortExitCond;
{Determination of Trade Condition and Direction}
TradeCondition:= if((ShortExitSignal AND LongEntrySignal) OR LongEntrySignal, 1,
if((LongExitSignal AND ShortEntrySignal) OR ShortEntrySignal, -1,
if(LongExitSignal OR ShortExitSignal, 0,
PREV)));
5. In the Output Bookmark, create the following variables:
[New] button...
Var Name: MiddleBand
Name: MiddleBand
Description: Middle Band of Bollinger Bands
* Checkmark: Indicator Output
Select Indicator Output Bookmark
Color: dark green
Line Width: thin line
Line Style: dashed line
Placement: Price Frame
[OK] button...
[New] button...
Var Name: UpperBand
Name: UpperBand
Description: Upper Band of Bollinger Bands
* Checkmark: Indicator Output
Select Indicator Output Bookmark
Color: dark green
Line Width: slightly thicker line
Line Style: solid line
Placement: Price Frame
[OK] button...
[New] button...
Var Name: LowerBand
Name: LowerBand
Description: Lower Band of Bollinger Bands
* Checkmark: Indicator Output
Select Indicator Output Bookmark
Color: dark green
Line Width: slightly thicker line
Line Style: solid line
Placement: Price Frame
[OK] button...
[New] button...
Var Name: Z
Name: Z-Score
Description: Z-Score Indicator
* Checkmark: Indicator Output
Select Indicator Output Bookmark
Color: pink
Line Width: slightly thicker line
Line Style: solid line
Placement: Additional Frame 1
[OK] button...
[New] button...
Var Name: LongEntrySignal
Name: LongEntrySignal
Description: Long Entry Signal Alert
* Checkmark: Graphic Enabled
* Checkmark: Alerts Enabled
Select Graphic Bookmark
Font [...]: Up Arrow
Size: Medium
Color: Blue
Symbol Position: Below price plot
Select Alerts Bookmark
Alerts Message: Long Entry Signal!
Choose sound for audible alert
[OK] button...
[New] button...
Var Name: LongExitSignal
Name: LongExitSignal
Description: Long Exit Signal Alert
* Checkmark: Graphic Enabled
* Checkmark: Alerts Enabled
Select Graphic Bookmark
Font [...]: Exit Sign
Size: Medium
Color: Blue
Symbol Position: Above price plot
Select Alerts Bookmark
Alerts Message: Long Exit Signal!
Choose sound for audible alert
[OK] button...
[New] button...
Var Name: ShortEntrySignal
Name: ShortEntrySignal
Description: Short Entry Signal Alert
* Checkmark: Graphic Enabled
* Checkmark: Alerts Enabled
Select Graphic Bookmark
Font [...]: Down Arrow
Size: Medium
Color: Red
Symbol Position: Above price plot
Select Alerts Bookmark
Alerts Message: Short Entry Signal!
Choose sound for audible alert
[OK] button...
[New] button...
Var Name: ShortExitSignal
Name: ShortExitSignal
Description: Short Exit Signal Alert
* Checkmark: Graphic Enabled
* Checkmark: Alerts Enabled
Select Graphic Bookmark
Font [...]: Exit Sign
Size: Medium
Color: Red
Symbol Position: Below price plot
Select Alerts Bookmark
Alerts Message: Short Exit Signal!
Choose sound for audible alert
[OK] button...
6. Click the "Save" icon to finish building the BBZ trading system.
A sample result is shown in Figure 12.

FIGURE 12: VT TRADER, BOLLINGER BANDS Z SYSTEM. Here
is a GBP/USD 10-minute candlestick chart demonstrating the BBZ trading
system. Shown below the price chart is the corresponding z-score indicator.
Long and short trade entries and exits shown on the chart as arrow and
exit sign graphics.
To attach the BBZ trading system to a chart, right-click the mouse
within the chart window, select "Add Trading System" -> "Bbz - Trading
Trends with Bollinger Bands Z" from the list. Users can then customize
the parameters by right-clicking over the displayed trading system label
and selecting "Edit Trading System Properties."
To learn more about VT Trader, visit www.cmsfx.com.
--Chris Skidmore
Visual Trading Systems, LLC (courtesy of CMS Forex)
Toll-free: (866) 51-CMSFX
trading@cmsfx.com
GO BACK
FINANCIAL DATA CALCULATOR: TRADING TRENDS WITH
BOLLINGER BANDS Z-TEST (BBZ)
The article "Trading Trends With The Bollinger Bands Z-Test" by Jacinta
Chan introduces a trend-trading strategy using Bollinger Bands with a variant
of the usual bandwidth.
Financial Data Calculator (FDC) contains a macro for Bollinger Bands
that computes and displays the upper, middle, and lower bands using any
desired parameters. The following variations (given for convenience) produce
the upper and lower bands separately.
For "upperbb," open the macro wizard in FDC, choose "New macro," and
enter the following code into the definition window:
A: Close #R
n m: #L
B: n movave A
C: m*(n movstdv A)
B + C
The syntax of use is: (n m) upperbb data, where m is the time period,
data is the dataset under consideration, with m standard deviations used.
Similarly, "lowerbb" can be defined as follows:
A: Close #R
n m: #L
B: n movave A
C: m*(n movstdv A)
B ? C
Now open the Trade Wizard, click "Create New Trade," and click on
the "Buy Entry" and "First Buy Entry" tabs. Check "Market on Close," and
in the first "Additional Conditions" line, enter the following phrase:
(Close #R) > 20 1 upperbb #R
In a similar way, enter the following expressions in the Buy Exit, Sell
Entry, and Sell Exit tabs:
(Close #R) < 20 1 upperbb #R
(Close #R) >20 1 lowerbb #R
(Close #R) >20 1 lowerbb #R
Then simply click "Process-Save New Trade," and choose "Bbz" as
a name.
The line BBZ dataset (where dataset is any dataset with an open, high,
low, or close) will simulate this trading strategy on that dataset.
--Robert C. Busby
Mathematical Investment Decisions, Inc.
856 857-9088, rbusby@mathinvestdecisions.com
www.financialdatacalculator.com
GO BACK
TRADECISION: TRADING TRENDS WITH BOLLINGER
BANDS Z-TEST (BBZ) SYSTEM
In "Trading Trends With The Bollinger Bands Z-Test," author Jacinta
Chan illustrates how to develop a trading system that yields high returns
with controlled risk. This BBZ trading system is based on Bollinger Bands.
With the Tradecision Strategy Builder, you can easily build the strategy
using the following rules:
Entry Long: return CLOSE > BBTop(CLOSE, 20, 1);
Exit Long: return CLOSE < BBTop(CLOSE, 20, 1);
Entry Short: return CLOSE < BBBot(CLOSE, 20, 1);
Exit Short: return CLOSE > BBBot(CLOSE, 20,1);
With the Simulation Manager, you can gain insight into your trading
strategies. This powerful report generator helps you in analyzing a strategy
by evaluating its suitability to your trading style and risk preferences.
Click "New" to create a new BBZ simulation. A sample chart is in Figure
13.

FIGURE 13: TRADECISION, BOLLINGER BANDS Z SYSTEM. Here
is an example of analyzing some statistics from the BBZ strategy using
the Tradecision Simulation Manager on a daily chart of Google (GOOG).
--Alex Grechanowski, Alyuda Research, Inc.
alex@alyuda.com, 347 416-6083
www.alyuda.com, www.tradecision.com
GO BACK
SMARTRADER: TRADING TRENDS WITH BOLLINGER BANDS
Z-TEST (BBZ) SYSTEM
Creating the modified Bollinger Bands and z-score formula from Jacinta
Chan's article, "Trading Trends With The Bollinger Bands Z-Test," is easy.
All that is required is the 20-period moving average and standard deviation
of the closing price and a few simple user formulas.
The specsheet for the BBZ system is shown in Figure 14. We begin by
adding the 20-period moving average, Mov_avg, to row 9. Then add the 20-period
standard deviation, Std_dv, in row 10. Next we calculate the upperBand
value in row 11 by adding Mov_avg to Std_dv in a user formula. The lowerBand,
row 12, is the converse: Mov_avg minus Std_dv.

FIGURE 14: SMARTRADER, BOLLINGER BANDS Z SYSTEM. Here
is the SmarTrader specsheet for implementing the Bollinger Bands z-test
(BBZ) system as introduced by Jacinta Chan.
The z-score, row 13, is a user formula dividing the difference of
Close-Mov_avg by Std_dv.
In row 14, "Buy" is a conditional where "Close greater than upperBand"
gives a "true" signal. In row 15, "Sell" is the opposite, with "Close less
than lowerBand" giving a "true" signal.
The remaining rows track the results of trading this system using "buy"
and "sell" as rules for a simple reversal system.
--Jim Ritter, Stratagem Software
800 779-7353 or 504 885-7353
info@stratagem1.com, www.stratagem1.com