TA_STOCH





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



Stochastic : This function is contained within the Momentum Indicators set of indicators.

Returns a 2-Column range.

outSlowK (Doubles).

outSlowD (Doubles).

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

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




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

    The 'High' Field name within the Historical DB that you wish to apply the analysis upon.
  6. LowField parameter

    The 'Low' Field name within the Historical DB that you wish to apply the analysis upon.
  7. CloseField parameter

    The 'Close' Field name within the Historical DB that you wish to apply the analysis upon.
  8. Fast_K_Period parameter

    Time period for building the Fast-K line (Default=5)
  9. Slow_K_Period parameter

    Smoothing for making the Slow-K line. Usually set to 3 (Default=3)
  10. Slow_K_MA parameter

    Type of Moving Average for Slow-K: 0=SMA, 1=EMA, 2=WMA, 3=DEMA, 4=TEMA, 5=TRIMA, 6=KAMA, 7=MAMA, 8=T3 (Default=SMA)
  11. Slow_D_Period parameter

    Smoothing for making the Slow-D line (Default=3)
  12. Slow_D_MA parameter

    Type of Moving Average for Slow-D: 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_STOCH( _
String Key, _
Boolean withHeaders, _
Boolean withDates, _
Boolean withData, _
String HighField, _
String LowField, _
String CloseField, _
Long Fast_K_Period, _
Long Slow_K_Period, _
Long Slow_K_MA, _
Long Slow_D_Period, _
Long Slow_D_MA)


Excel Spreadsheet Syntax


=CT.TA.STOCH(
Excel String Cell Key,
Excel Boolean Value Cell withHeaders,
Excel Boolean Value Cell withDates,
Excel Boolean Value Cell withData,
Excel String Cell HighField,
Excel String Cell LowField,
Excel String Cell CloseField,
Excel Numeric Cell Fast_K_Period,
Excel Numeric Cell Slow_K_Period,
Excel Numeric Cell Slow_K_MA,
Excel Numeric Cell Slow_D_Period,
Excel Numeric Cell Slow_D_MA)


C++ Syntax


static CTRangeDataCPP TA_STOCH(
std::string Key,
bool withHeaders,
bool withDates,
bool withData,
std::string HighField,
std::string LowField,
std::string CloseField,
long Fast_K_Period,
long Slow_K_Period,
long Slow_K_MA,
long Slow_D_Period,
long Slow_D_MA);


DotNET Syntax


CTRangeData CT_TA_MomIndSA.TA_STOCH(
System.String Key,
System.Boolean withHeaders,
System.Boolean withDates,
System.Boolean withData,
System.String HighField,
System.String LowField,
System.String CloseField,
System.Int32 Fast_K_Period,
System.Int32 Slow_K_Period,
System.Int32 Slow_K_MA,
System.Int32 Slow_D_Period,
System.Int32 Slow_D_MA);

Parameter data types

ArgNameArgTypeIsKey
KeyStringTRUE
withHeadersBooleanFALSE
withDatesBooleanFALSE
withDataBooleanFALSE
HighFieldStringFALSE
LowFieldStringFALSE
CloseFieldStringFALSE
Fast_K_PeriodLongFALSE
Slow_K_PeriodLongFALSE
Slow_K_MALongFALSE
Slow_D_PeriodLongFALSE
Slow_D_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
HighFieldFALSEHigh
LowFieldFALSELow
CloseFieldFALSEClose
Fast_K_PeriodTRUE5
Slow_K_PeriodTRUE3
Slow_K_MATRUE0
Slow_D_PeriodTRUE3
Slow_D_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_STOCH() 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_STOCH() function call


Example
DATEOPENHIGHLOWCLOSEVOLUMESlowKSlowD
3774629.37529.562528.812529.31252357000
3774729.330229.331529.321729.32693092000
3774829.322629.329829.321729.32622524200
3774929.314929.342929.312629.32693584500
3775029.351929.359829.30629.309713000
3775329.347229.347629.341929.3434702400
3775429.347829.387929.321129.34462201900
3775529.351729.36529.323629.32551406500
3775629.353929.354829.28629.34242318542.096249.9548
3775729.324829.343929.3129.32221086238.227642.3809
3776029.311829.367529.287929.3108564938.403739.5758
3776129.327129.354229.290329.32751218836.927637.853
3776229.343129.361729.287729.34122246247.662640.998
3776329.344629.36729.306729.34573854063.777349.4559
3776429.378729.382629.374629.37942339579.013363.4844
3776729.36729.371229.365629.36962722685.203775.9981
3776829.3729.380829.351729.35462462484.474982.8973
3776929.383729.399229.328829.39062139282.499884.0595
3777029.432929.438229.421429.4318675485.11684.0302
3777129.422629.439829.407429.41251247486.752784.7895
3777429.443429.456329.373229.38263228070.583880.8175
3777529.347229.367129.338129.3481028144.220167.1855
3777629.391429.395629.389829.39163231834.172449.6588
3777729.404629.428129.40229.41281368541.17339.8552
3777829.420729.44729.409929.44321621765.792447.046
3778129.413929.489729.394829.45891864077.266161.4105
3778229.464529.486829.428729.43013137869.646970.9018
3778329.469529.474629.469129.47313398767.510571.4745
3778429.500329.50529.48729.50391438673.9570.3692
3778529.50329.522929.472129.52091427493.316178.2589
3778829.508829.570529.491729.53023328989.673485.6465
3778929.532429.54329.507829.51741256072.550585.18
3779029.521729.548829.510329.53882963362.332574.8521
3779129.545429.55129.526429.52732490757.171764.0182
3779229.517829.572229.483829.4943257545.140254.8815
3779529.476129.4829.475629.47842205523.511541.9412
3779629.443229.444629.44329.444161885.0961424.5826
3779729.443129.47529.437129.440374722.0395210.2157
3779829.466429.485829.465929.47573979110.59715.91093
3779929.517229.525229.515929.52051976641.868418.1684
3780229.489629.51429.479229.48542489759.353537.273
3780329.532729.534129.525629.5295616881.582360.9348
3780429.563529.569929.545229.54893613276.629872.5219
3780529.543929.594529.531429.56772755583.940680.7176
3780629.550629.571929.545429.54741720671.904777.4917
3780929.516529.545829.512529.53723924755.342870.396
3781029.541329.576129.536229.5595679248.86358.7035
3781129.580129.599729.542129.5918551859.459854.5552
3781229.622229.624929.613329.61651289780.261462.8614
3781329.616829.634429.600529.60462956886.340375.3538
3781629.584429.593329.578829.58631807473.032979.8782



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