diff --git a/README.md b/README.md index ff1aed873..f3c3233db 100644 --- a/README.md +++ b/README.md @@ -401,6 +401,11 @@ parameters, unless specified as keyword arguments. Typically, these functions will have an initial "lookback" period (a required number of observations before an output is generated) set to `NaN`. +The lookback is function-specific and does not always match the value passed +to `timeperiod`. For example, `RSI(timeperiod=14)` needs 15 price observations +because the first RSI value depends on 14 price changes between consecutive +bars, not just 14 raw prices. + For convenience, the Function API supports both `numpy.ndarray` and `pandas.Series` and `polars.Series` inputs. @@ -433,6 +438,10 @@ Calculating momentum of the close prices, with a time period of 5: output = talib.MOM(close, timeperiod=5) ``` +Functions marked in the docs as having an unstable period start with that +extra unstable-period setting at `0`. In other words, `get_unstable_period()` +returns `0` until you explicitly change it with `set_unstable_period()`. + ### NaN's The underlying TA-Lib C library handles NaN's in a sometimes surprising manner diff --git a/docs/func.md b/docs/func.md index 11d4efc09..0e25d7bda 100644 --- a/docs/func.md +++ b/docs/func.md @@ -8,6 +8,10 @@ parameters, unless specified as keyword arguments. Typically, these functions will have an initial "lookback" period (a required number of observations before an output is generated) set to ``NaN``. +The lookback is function-specific and may be larger than the `timeperiod` +parameter. For example, ``RSI(timeperiod=14)`` needs 15 price observations, +because the first RSI value is derived from 14 consecutive price changes. + All of the following examples use the function API: ```python @@ -37,6 +41,10 @@ Calculating momentum of the close prices, with a time period of 5: output = talib.MOM(close, timeperiod=5) ``` +Functions documented as having an unstable period start with that extra +unstable-period setting at ``0``. ``get_unstable_period()`` only returns a +non-zero value after you set one explicitly with ``set_unstable_period()``. + Documentation for all functions: * [Overlap Studies](func_groups/overlap_studies.md) diff --git a/docs/index.md b/docs/index.md index efe01ac12..2f192de02 100644 --- a/docs/index.md +++ b/docs/index.md @@ -28,6 +28,10 @@ parameters, unless specified as keyword arguments. Typically, these functions will have an initial "lookback" period (a required number of observations before an output is generated) set to ``NaN``. +The lookback is function-specific and may be larger than the `timeperiod` +parameter. For example, ``RSI(timeperiod=14)`` needs 15 price observations, +because the first RSI value is based on 14 consecutive price changes. + All of the following examples use the function API: ```python @@ -57,6 +61,10 @@ Calculating momentum of the close prices, with a time period of 5: output = talib.MOM(close, timeperiod=5) ``` +Functions documented as having an unstable period start with that extra +unstable-period setting at ``0``. ``get_unstable_period()`` only reports a +non-zero value after you call ``set_unstable_period()`` yourself. + ## Abstract API Quick Start If you're already familiar with using the function API, you should feel right