TA_MACDEXT





http://www.QuantTools.com
CapeTools Technical Analysis - Momentum Indicators function list

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

Key TAGs | Excel Index | API Index



MACD with controllable MA type : This function is contained within the Momentum Indicators set of indicators.

Returns a 3-Column range.

outMACD (Doubles).

outMACDSignal (Doubles).

outMACDHist (Doubles).

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

The Fast_Period and Slow_Period parameters determines the number of data points that the function will conduct it's analysis upon before moving on.

Thus if the value of the Fast_Period or Slow_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... Both the Fast_Period and Slow_Period parameters act as sliding windows, where the window size determines the amount of data that the analysis will be conducted upon.

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.MACDEXT




High level graphic of TA_MACDEXT() 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. Fast_Period parameter

    Number of period for the fast MA (Default=12)
  7. Fast_MA parameter

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

    Number of period for the slow MA (Default=26)
  9. Slow_MA parameter

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

    Smoothing for the signal line (nb of period) (Default=9)
  11. Signal_MA parameter

    Type of Moving Average for signal line: 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_MomInd.TA_MACDEXT( _
String Key, _
Boolean withHeaders, _
Boolean withDates, _
Boolean withData, _
String FieldName, _
Long Fast_Period, _
Long Fast_MA, _
Long Slow_Period, _
Long Slow_MA, _
Long Signal_Period, _
Long Signal_MA)


Excel Spreadsheet Syntax


=CT.TA.MACDEXT(
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 Fast_Period,
Excel Numeric Cell Fast_MA,
Excel Numeric Cell Slow_Period,
Excel Numeric Cell Slow_MA,
Excel Numeric Cell Signal_Period,
Excel Numeric Cell Signal_MA)


C++ Syntax


static CTRangeDataCPP TA_MACDEXT(
std::string Key,
bool withHeaders,
bool withDates,
bool withData,
std::string FieldName,
long Fast_Period,
long Fast_MA,
long Slow_Period,
long Slow_MA,
long Signal_Period,
long Signal_MA);


DotNET Syntax


CTRangeData CT_TA_MomIndSA.TA_MACDEXT(
System.String Key,
System.Boolean withHeaders,
System.Boolean withDates,
System.Boolean withData,
System.String FieldName,
System.Int32 Fast_Period,
System.Int32 Fast_MA,
System.Int32 Slow_Period,
System.Int32 Slow_MA,
System.Int32 Signal_Period,
System.Int32 Signal_MA);

Parameter data types

ArgNameArgTypeIsKey
KeyStringTRUE
withHeadersBooleanFALSE
withDatesBooleanFALSE
withDataBooleanFALSE
FieldNameStringFALSE
Fast_PeriodLongFALSE
Fast_MALongFALSE
Slow_PeriodLongFALSE
Slow_MALongFALSE
Signal_PeriodLongFALSE
Signal_MALongFALSE


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
Fast_PeriodTRUE12
Fast_MATRUE0
Slow_PeriodTRUE26
Slow_MATRUE0
Signal_PeriodTRUE9
Signal_MATRUE0


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_MACDEXT() 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_MACDEXT() function call


Example
DATEOPENHIGHLOWCLOSEVOLUMEMACDMACDSignalMACDHist
3774629.37529.562528.812529.312523570000
3774729.330229.331529.321729.326930920000
3774829.322629.329829.321729.326225242000
3774929.314929.342929.312629.326935845000
3775029.351929.359829.30629.3097130000
3775329.347229.347629.341929.34347024000
3775429.347829.387929.321129.344622019000
3775529.351729.36529.323629.325514065000
3775629.353929.354829.28629.342423185000
3775729.324829.343929.3129.322210862000
3776029.311829.367529.287929.31085649000
3776129.327129.354229.290329.327512188000
3776229.343129.361729.287729.341222462000
3776329.344629.36729.306729.345738540000
3776429.378729.382629.374629.379423395000
3776729.36729.371229.365629.369627226000
3776829.3729.380829.351729.354624624000
3776929.383729.399229.328829.390621392000
3777029.432929.438229.421429.43186754000
3777129.422629.439829.407429.412512474000
3777429.443429.456329.373229.382632280000
3777529.347229.367129.338129.34810281000
3777629.391429.395629.389829.391632318000
3777729.404629.428129.40229.412813685000
3777829.420729.44729.409929.443216217000
3778129.413929.489729.394829.458918640000
3778229.464529.486829.428729.430131378000
3778329.469529.474629.469129.473133987000
3778429.500329.50529.48729.503914386000
3778529.50329.522929.472129.520914274000
3778829.508829.570529.491729.530233289000
3778929.532429.54329.507829.517412560000
3779029.521729.548829.510329.538829633000
3779129.545429.55129.526429.5273249070.05659360.0434850.0131086
3779229.517829.572229.483829.494325750.06082310.04671520.0141078
3779529.476129.4829.475629.4784220550.06096220.0495490.0114132
3779629.443229.444629.44329.444161880.05778330.05167580.00610755
3779729.443129.47529.437129.440374720.05575510.05313010.002625
3779829.466429.485829.465929.4757397910.05117120.0537744-0.00260321
3779929.517229.525229.515929.5205197660.04850770.0540904-0.00558269
3780229.489629.51429.479229.4854248970.04335060.0536082-0.0102575
3780329.532729.534129.525629.529561680.03945260.052711-0.0132585
3780429.563529.569929.545229.5489361320.03656860.050486-0.0139175
3780529.543929.594529.531429.5677275550.03136540.047213-0.0158476
3780629.550629.571929.545429.5474172060.02924680.043689-0.0144422
3780929.516529.545829.512529.5372392470.02322690.0398494-0.0166225
3781029.541329.576129.536229.559567920.02141990.0360344-0.0146145
3781129.580129.599729.542129.591855180.02112880.0326964-0.0115675
3781229.622229.624929.613329.6165128970.02716860.0303254-0.00315677
3781329.616829.634429.600529.6046295680.03348210.02922880.00425321
3781629.584429.593329.578829.5863180740.03701920.02895850.00806075



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