TA_BBANDS





http://www.QuantTools.com
CapeTools Technical Analysis - Overlap Studies function list

Welcome | Documentation format | QuantTools Groups | QuantTools Categories | Licence

Key TAGs | Excel Index | API Index



Bollinger Bands : This function is contained within the Overlap Studies set of indicators.

Returns a 3-Column range.

outRealUpperBand (Doubles).

outRealMiddleBand (Doubles).

outRealLowerBand (Doubles).

(Reference - http://www.tadoc.org, http://www.ta-lib.org).

The Time_Period parameter determines the number of data points that the function will conduct it's analysis upon before moving on.

Thus if the value of the Time_Period parameter is 30, the first 30 points will be read, the analysis performed, then the 1st point is dropped and the 31st point added, analysis performed once again, then the 2nd point dropped and the 32nd point added, analysis performed etc... The Time_Period parameter almost acts as a sliding window, where the window size determines the amount of data that the analysis will be conducted upon.

The returned range will always be the size of the original range, minus the size of the Time_Period (the window).

This function requires the input of a Technical Analysis memory data table object key, which must have been produced via a call to MakeHistoricalDB(). This function would have returned a string 'KEY' which is to be passed to the 'Key' parameter of this function.



Note: Within Excel, the function is named - CT.TA.BBANDS




High level graphic of TA_BBANDS() function with parameters. Blue square node is the actual function with the parameters ordered.



Parameter Description


  1. Key parameter

    Key to an already created HistoricalDB object
  2. withHeaders parameter

    Display header information with the output range?
  3. withDates parameter

    Display the Dates column along with the output range?
  4. withData parameter

    Display the 'Open', 'High', 'Low', 'Close' and 'Volume' columns along with the output range?
  5. FieldName parameter

    The FieldName within the Historical DB that you wish to apply the analysis upon.
  6. Time_Period parameter

    Number of period (Default=5)
  7. Deviations_up parameter

    Deviation multiplier for upper band (Default=2)
  8. Deviations_down parameter

    Deviation multiplier for lower band (Default=2)
  9. MA_Type parameter

    Type of Moving Average: 0=SMA, 1=EMA, 2=WMA, 3=DEMA, 4=TEMA, 5=TRIMA, 6=KAMA, 7=MAMA, 8=T3 (Default=SMA)


Extended information

Function Syntax

VB Syntax


Variant CT_TA_Overlap.TA_BBANDS( _
String Key, _
Boolean withHeaders, _
Boolean withDates, _
Boolean withData, _
String FieldName, _
Long Time_Period, _
Double Deviations_up, _
Double Deviations_down, _
Long MA_Type)


Excel Spreadsheet Syntax


=CT.TA.BBANDS(
Excel String Cell Key,
Excel Boolean Value Cell withHeaders,
Excel Boolean Value Cell withDates,
Excel Boolean Value Cell withData,
Excel String Cell FieldName,
Excel Numeric Cell Time_Period,
Excel Numeric Cell Deviations_up,
Excel Numeric Cell Deviations_down,
Excel Numeric Cell MA_Type)


C++ Syntax


static CTRangeDataCPP TA_BBANDS(
std::string Key,
bool withHeaders,
bool withDates,
bool withData,
std::string FieldName,
long Time_Period,
double Deviations_up,
double Deviations_down,
long MA_Type);


DotNET Syntax


CTRangeData CT_TA_OverlapSA.TA_BBANDS(
System.String Key,
System.Boolean withHeaders,
System.Boolean withDates,
System.Boolean withData,
System.String FieldName,
System.Int32 Time_Period,
System.Double Deviations_up,
System.Double Deviations_down,
System.Int32 MA_Type);

Parameter data types

ArgNameArgTypeIsKey
KeyStringTRUE
withHeadersBooleanFALSE
withDatesBooleanFALSE
withDataBooleanFALSE
FieldNameStringFALSE
Time_PeriodLongFALSE
Deviations_upDoubleFALSE
Deviations_downDoubleFALSE
MA_TypeLongFALSE


Example Inputs

The first column represents the name of the parameters. The second column specifies whether the parameters are optional or not. Finally the last column provides some sample input data.
Function call input string-keys are always in the format : "NAME.EXTTAG.TICKER" The "EXTTAG.TICKER" part is determined from the output of other, capetools, object creation functions.


ArgNameIsOptional (Excel only)Example
KeyFALSEKeyNAME.EXTTAG.TICKER (from a function call)
withHeadersFALSEtrue
withDatesFALSEtrue
withDataFALSEtrue
FieldNameFALSEOpen
Time_PeriodTRUE5
Deviations_upTRUE2
Deviations_downTRUE2
MA_TypeTRUE0


Example function usage


The C# example below contains all the sub-function calls leading up to this function call. As a result, the example can contain a lot of code.

The VB.NET, J#, C++.NET, Java, Excel VBA, Visual Basic 6 (via COM) and C++ examples below contain function code stubs for the calls leading up to this function call. However, the function call for this function is displayed.
You can easily reproduce the stub functions code from the C# example.


If you are accessing this functrion via the MiniXL libraries, this function is present within the CT.QL.TechnicalAnalysis20 MiniXL Excel Addin.

Within our Excel Example Addin Generator, we have used the following QuantTools sub-functions in order to prepare the arguments needed to call the TA_BBANDS() function. If you are executing this function via the MiniXL libraries, the module addin name, (in brackets, to the right of the sub-functions listed below), indicates the MiniXL library in which the sub-function is held. You will need to load this library into your Excel session (along with any other libraries that the sub-function call within the addin requires (ie - CT.QT.Utils20 addin in almost all cases) in order for the example to compute successfully.

These are the financial QuantTools sub-function calls that are used within the examples :





The objects generated by these sub-functions are inter-connected in the following way :




The following four examples demostrate calling this function within a Microsoft .NET environment

The following four examples demostrate calling this function within a non .NET environment

The following is a sample output from executing the TA_BBANDS() function call


Example
DATEOPENHIGHLOWCLOSEVOLUMEUpperBandMiddleBandLowerBand
3774629.37529.562528.812529.312523570000
3774729.330229.331529.321729.326930920000
3774829.322629.329829.321729.326225242000
3774929.314929.342929.312629.326935845000
3775029.351929.359829.30629.309713029.382629.338929.2952
3775329.347229.347629.341929.3434702429.361729.333429.3051
3775429.347829.387929.321129.34462201929.367129.336929.3067
3775529.351729.36529.323629.32551406529.370829.342729.3146
3775629.353929.354829.28629.34242318529.355629.350529.3454
3775729.324829.343929.3129.32221086229.36629.345129.3242
3776029.311829.367529.287929.3108564929.371429.33829.3046
3776129.327129.354229.290329.32751218829.366529.333929.3012
3776229.343129.361729.287729.34122246229.361629.332129.3027
3776329.344629.36729.306729.34573854029.354829.330329.3058
3776429.378729.382629.374629.37942339529.385629.341129.2965
3776729.36729.371229.365629.36962722629.388929.352129.3153
3776829.3729.380829.351729.35462462429.389229.360729.3321
3776929.383729.399229.328829.39062139229.395829.368829.3418
3777029.432929.438229.421429.4318675429.434429.386529.3385
3777129.422629.439829.407429.41251247429.449929.395229.3406
3777429.443429.456329.373229.38263228029.467729.410529.3533
3777529.347229.367129.338129.3481028129.477229.40629.3347
3777629.391429.395629.389829.39163231829.477129.407529.3379
3777729.404629.428129.40229.41281368529.466729.401829.337
3777829.420729.44729.409929.44321621729.465929.401529.3371
3778129.413929.489729.394829.45891864029.447829.395629.3434
3778229.464529.486829.428729.43013137829.468629.41929.3695
3778329.469529.474629.469129.47313398729.488629.434629.3807
3778429.500329.50529.48729.50391438629.518329.453829.3892
3778529.50329.522929.472129.52091427429.534629.470229.4058
3778829.508829.570529.491729.53023328929.526129.489229.4524
3778929.532429.54329.507829.51741256029.543129.502829.4625
3779029.521729.548829.510329.53882963329.537429.513229.4891
3779129.545429.55129.526429.52732490729.553129.522329.4914
3779229.517829.572229.483829.4943257529.550529.525229.5
3779529.476129.4829.475629.47842205529.565429.518729.472
3779629.443229.444629.44329.4441618829.573729.500829.4279
3779729.443129.47529.437129.4403747229.566629.485129.4036
3779829.466429.485829.465929.47573979129.524329.469329.4144
3779929.517229.525229.515929.52051976629.523729.469229.4147
3780229.489629.51429.479229.48542489729.528829.471929.415
3780329.532729.534129.525629.5295616829.55529.489829.4246
3780429.563529.569929.545229.54893613229.581229.513929.4465
3780529.543929.594529.531429.56772755529.579329.529429.4794
3780629.550629.571929.545429.54741720629.586629.536129.4855
3780929.516529.545829.512529.53723924729.573429.541429.5095
3781029.541329.576129.536229.5595679229.573929.543229.5124
3781129.580129.599729.542129.5918551829.587329.546529.5057
3781229.622229.624929.613329.61651289729.634729.562129.4896
3781329.616829.634429.600529.60462956829.658129.575429.4926
3781629.584429.593329.578829.58631807429.647329.58929.5306



Copyright (c) 2003-2007 CapeTools - All Rights Reserved.