# XTRADE.STOCHASTIC

**AXCEL.XTRADE.STOCHASTIC function**

This function is part of XTRADE functions group which is a collection of several technical indicators for creating technical trading rules. XTRADE.STOCHASTIC produces a Stochastic Oscillator Indicator developed by George C. Lane. This indicator relates the location of each day’s close relative to the high/low range over the past `n`

periods.

Disclaimer:

Due to many factors, over which we have no control, performance and/or outcomes may differ substantially from any estimates, projections or predictions that have been made by our services or functions. We use several software and services from sources believed to be reliable, however accuracy and completeness cannot be guaranteed. Loss of all or part of the original capital invested in an investment or investment strategy derived by these functions and/or services may occur. Any investments and/or transactions implied by our services or functions are done at your own risk.

**Syntax**

AXCEL.XTRADE.STOCHASTIC(stockprice, [nFastK], [nFastD], [nSlowD], [dateFormat], [plot])

The AXCEL.XTRADE.STOCHASTIC function syntax has the following arguments:

**stockprice** Required. This is a table of stock prices. The format must be a table of two columns, the first column for time/date index, and the second column. Here is an example:

Date | Price |

08/24/2020 | 120.10 |

08/25/2020 | 121.65 |

08/26/2020 | 119.88 |

… | … |

… | … |

Or, it could be a table of five or six columns, including time/date, Open, High, Low, Close and Volume (optional), respectively. Here is an example:

Date | Open | High | Low | Close | Volume (optional) |

08/24/2020 | 120.22 | 121.10 | 119.98 | 120.10 | 137097800 |

08/25/2020 | 121.88 | 122.54 | 121.33 | 121.65 | 95822300 |

08/26/2020 | 121.45 | 121.78 | 119.66 | 119.68 | 105196700 |

… | … | … | … | … | … |

… | … | … | … | … | … |

If a High-Low-Close series is provided, the indicator is calculated using the high/low values. If a single series is provided, the calculation only uses that series. This allows stochastics to be calculated for series that have no HLC definition (e.g. foreign exchange), and for stochastic indicators. Open and Volume are not considered in calculations and will be used for visualization only. For both cases, the name of the columns is not restricted. However, the user must provide data columns in the same order presented before.

**nFastK** Optional. The number of periods for fast %K (i.e. the number of past periods to use). The default value is 14.

**nFastD** Optional. The number of periods for fast %D (i.e. the number smoothing periods to apply to fast %K). The default is 3.

**nSlowD** Optional. The number of periods for slow %D (i.e. the number smoothing periods to apply to fast %D). The default is 3.

**dateFormat** Optional. If the date in Date columns is Excel standard date format, you do not need to provide any format, and Axcel will automatically identify the date format and applies the conversion. However, if the date is provided in TEXT format, you should define the dateFormat for appropriate conversion. Here are the elements of the date format:

/ or - : Separators %d: day %m: month %y: 2-digit year (for example 98 or 07) %Y: 4-digit year (for example 1998 or 2007)

Here are some examples of date format:

for "08/22/2019" : "%m/%d/%Y" for "19/08/22" : "%y/%m/%d" for "2019-08-22" : "%Y-%m-%d"

**plot** Optional. The default is FALSE. If you set it TRUE, Axcel provides you an advanced interactive visualization showing a candlestick chart (if you provide HLC data as explained above) and stochastic indicators.

Here is an example without Volume:

and if you provide Volume column, it will be included in your graph as example below:

when you type =AXCEL.XTRADE.STOCHASTIC the Intellisense guides you through required and optional (shown in brackets []) entries as shown below:

In this example, we have:

=AXCEL.XTRADE.STOCHASTIC(A1:E300, 14, 3, 3,, TRUE)

which means that our data is located at cells from A1 to E300, we set the number of periods for fast %K at 14, for the number of smoothing periods for fast %K and fast %D at 3 days, respectively. Also, since we use Excel standard date format, we skipped the date format entry and we would like to have visualization by setting the plot to TRUE. Here is the outcome:

As presented above, Axcel generates stochastic index and reports them in columns *FastK* (stochastic Fast %K), *FastD* (stochastic Fast %D), and *slowD* (stochastic Slow %D). Also, the outcome is visualized in the task pane and ready to be expanded in your browser. In this example, since this function needs a minimum of 14 days of historical records for calculation (we set nFastK to 14), the first 13, 15, and 17 records of the reported columns show *NA* after execution.

See also: All other *AXCEL.XTRADE* functions.