Skip to content

Commit f69d740

Browse files
Whning0513mrjbq7
authored andcommitted
Clarify RSI lookback and unstable-period defaults in the docs
1 parent 2384b72 commit f69d740

3 files changed

Lines changed: 25 additions & 0 deletions

File tree

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,11 @@ parameters, unless specified as keyword arguments. Typically, these functions
401401
will have an initial "lookback" period (a required number of observations
402402
before an output is generated) set to `NaN`.
403403
404+
The lookback is function-specific and does not always match the value passed
405+
to `timeperiod`. For example, `RSI(timeperiod=14)` needs 15 price observations
406+
because the first RSI value depends on 14 price changes between consecutive
407+
bars, not just 14 raw prices.
408+
404409
For convenience, the Function API supports both `numpy.ndarray` and
405410
`pandas.Series` and `polars.Series` inputs.
406411
@@ -433,6 +438,10 @@ Calculating momentum of the close prices, with a time period of 5:
433438
output = talib.MOM(close, timeperiod=5)
434439
```
435440
441+
Functions marked in the docs as having an unstable period start with that
442+
extra unstable-period setting at `0`. In other words, `get_unstable_period()`
443+
returns `0` until you explicitly change it with `set_unstable_period()`.
444+
436445
### NaN's
437446
438447
The underlying TA-Lib C library handles NaN's in a sometimes surprising manner

docs/func.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ parameters, unless specified as keyword arguments. Typically, these functions
88
will have an initial "lookback" period (a required number of observations
99
before an output is generated) set to ``NaN``.
1010

11+
The lookback is function-specific and may be larger than the `timeperiod`
12+
parameter. For example, ``RSI(timeperiod=14)`` needs 15 price observations,
13+
because the first RSI value is derived from 14 consecutive price changes.
14+
1115
All of the following examples use the function API:
1216

1317
```python
@@ -37,6 +41,10 @@ Calculating momentum of the close prices, with a time period of 5:
3741
output = talib.MOM(close, timeperiod=5)
3842
```
3943

44+
Functions documented as having an unstable period start with that extra
45+
unstable-period setting at ``0``. ``get_unstable_period()`` only returns a
46+
non-zero value after you set one explicitly with ``set_unstable_period()``.
47+
4048
Documentation for all functions:
4149

4250
* [Overlap Studies](func_groups/overlap_studies.md)

docs/index.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ parameters, unless specified as keyword arguments. Typically, these functions
2828
will have an initial "lookback" period (a required number of observations
2929
before an output is generated) set to ``NaN``.
3030

31+
The lookback is function-specific and may be larger than the `timeperiod`
32+
parameter. For example, ``RSI(timeperiod=14)`` needs 15 price observations,
33+
because the first RSI value is based on 14 consecutive price changes.
34+
3135
All of the following examples use the function API:
3236

3337
```python
@@ -57,6 +61,10 @@ Calculating momentum of the close prices, with a time period of 5:
5761
output = talib.MOM(close, timeperiod=5)
5862
```
5963

64+
Functions documented as having an unstable period start with that extra
65+
unstable-period setting at ``0``. ``get_unstable_period()`` only reports a
66+
non-zero value after you call ``set_unstable_period()`` yourself.
67+
6068
## Abstract API Quick Start
6169

6270
If you're already familiar with using the function API, you should feel right

0 commit comments

Comments
 (0)