.\pandas-ta\pandas_ta\momentum\__init__.py
from .ao import ao
from .apo import apo
from .bias import bias
from .bop import bop
from .brar import brar
from .cci import cci
from .cfo import cfo
from .cg import cg
from .cmo import cmo
from .coppock import coppock
from .cti import cti
from .dm import dm
from .er import er
from .eri import eri
from .fisher import fisher
from .inertia import inertia
from .kdj import kdj
from .kst import kst
from .macd import macd
from .mom import mom
from .pgo import pgo
from .ppo import ppo
from .psl import psl
from .pvo import pvo
from .qqe import qqe
from .roc import roc
from .rsi import rsi
from .rsx import rsx
from .rvgi import rvgi
from .slope import slope
from .smi import smi
from .squeeze import squeeze
from .squeeze_pro import squeeze_pro
from .stc import stc
from .stoch import stoch
from .stochrsi import stochrsi
from .td_seq import td_seq
from .trix import trix
from .tsi import tsi
from .uo import uo
from .willr import willr
.\pandas-ta\pandas_ta\overlap\alma.py
from numpy import exp as npExp
from numpy import nan as npNaN
from pandas import Series
from pandas_ta.utils import get_offset, verify_series
def alma(close, length=None, sigma=None, distribution_offset=None, offset=None, **kwargs):
"""Indicator: Arnaud Legoux Moving Average (ALMA)"""
length = int(length) if length and length > 0 else 10
sigma = float(sigma) if sigma and sigma > 0 else 6.0
distribution_offset = float(distribution_offset) if distribution_offset and distribution_offset > 0 else 0.85
close = verify_series(close, length)
offset = get_offset(offset)
if close is None: return
m = distribution_offset * (length - 1)
s = length / sigma
wtd = list(range(length))
for i in range(0, length):
wtd[i] = npExp(-1 * ((i - m) * (i - m)) / (2 * s * s))
result = [npNaN for _ in range(0, length - 1)] + [0]
for i in range(length, close.size):
window_sum = 0
cum_sum = 0
for j in range(0, length):
window_sum = window_sum + wtd[j] * close.iloc[i - j]
cum_sum = cum_sum + wtd[j]
almean = window_sum / cum_sum
result.append(npNaN) if i == length else result.append(almean)
alma = Series(result, index=close.index)
if offset != 0:
alma = alma.shift(offset)
if "fillna" in kwargs:
alma.fillna(kwargs["fillna"], inplace=True)
if "fill_method" in kwargs:
alma.fillna(method=kwargs["fill_method"], inplace=True)
alma.name = f"ALMA_{length}_{sigma}_{distribution_offset}"
alma.category = "overlap"
return alma
alma.__doc__ = \
"""Arnaud Legoux Moving Average (ALMA)
The ALMA moving average uses the curve of the Normal (Gauss) distribution, which
can be shifted from 0 to 1. This allows regulating the smoothness and high
sensitivity of the indicator. Sigma is another parameter that is responsible for
the shape of the curve coefficients. This moving average reduces lag of the data
in conjunction with smoothing to reduce noise.
Implemented for Pandas TA by rengel8 based on the source provided below.
Sources:
https://www.prorealcode.com/prorealtime-indicators/alma-arnaud-legoux-moving-average/
Calculation:
refer to provided source
Args:
close (pd.Series): Series of 'close's
length (int): It's period, window size. Default: 10
sigma (float): Smoothing value. Default 6.0
distribution_offset (float): Value to offset the distribution min 0
(smoother), max 1 (more responsive). Default 0.85
offset (int): How many periods to offset the result. Default: 0
Kwargs:
fillna (value, optional): pd.DataFrame.fillna(value)
fill_method (value, optional): Type of fill method
Returns:
"""
.\pandas-ta\pandas_ta\overlap\dema.py
from .ema import ema
from pandas_ta import Imports
from pandas_ta.utils import get_offset, verify_series
def dema(close, length=None, talib=None, offset=None, **kwargs):
"""Indicator: Double Exponential Moving Average (DEMA)"""
length = int(length) if length and length > 0 else 10
close = verify_series(close, length)
offset = get_offset(offset)
mode_tal = bool(talib) if isinstance(talib, bool) else True
if close is None: return
if Imports["talib"] and mode_tal:
from talib import DEMA
dema = DEMA(close, length)
else:
ema1 = ema(close=close, length=length)
ema2 = ema(close=ema1, length=length)
dema = 2 * ema1 - ema2
if offset != 0:
dema = dema.shift(offset)
if "fillna" in kwargs:
dema.fillna(kwargs["fillna"], inplace=True)
if "fill_method" in kwargs:
dema.fillna(method=kwargs["fill_method"], inplace=True)
dema.name = f"DEMA_{length}"
dema.category = "overlap"
return dema
dema.__doc__ = \
"""Double Exponential Moving Average (DEMA)
The Double Exponential Moving Average attempts to a smoother average with less
lag than the normal Exponential Moving Average (EMA).
Sources:
https://www.tradingtechnologies.com/help/x-study/technical-indicator-definitions/double-exponential-moving-average-dema/
Calculation:
Default Inputs:
length=10
EMA = Exponential Moving Average
ema1 = EMA(close, length)
ema2 = EMA(ema1, length)
DEMA = 2 * ema1 - ema2
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 10
talib (bool): If TA Lib is installed and talib is True, Returns the TA Lib
version. Default: True
offset (int): How many periods to offset the result. Default: 0
Kwargs:
fillna (value, optional): pd.DataFrame.fillna(value)
fill_method (value, optional): Type of fill method
Returns:
pd.Series: New feature generated.
"""
.\pandas-ta\pandas_ta\overlap\ema.py
from numpy import nan as npNaN
from pandas_ta import Imports
from pandas_ta.utils import get_offset, verify_series
def ema(close, length=None, talib=None, offset=None, **kwargs):
"""Indicator: Exponential Moving Average (EMA)"""
length = int(length) if length and length > 0 else 10
adjust = kwargs.pop("adjust", False)
sma = kwargs.pop("sma", True)
close = verify_series(close, length)
offset = get_offset(offset)
mode_tal = bool(talib) if isinstance(talib, bool) else True
if close is None: return
if Imports["talib"] and mode_tal:
from talib import EMA
ema = EMA(close, length)
else:
if sma:
close = close.copy()
sma_nth = close[0:length].mean()
close[:length - 1] = npNaN
close.iloc[length - 1] = sma_nth
ema = close.ewm(span=length, adjust=adjust).mean()
if offset != 0:
ema = ema.shift(offset)
if "fillna" in kwargs:
ema.fillna(kwargs["fillna"], inplace=True)
if "fill_method" in kwargs:
ema.fillna(method=kwargs["fill_method"], inplace=True)
ema.name = f"EMA_{length}"
ema.category = "overlap"
return ema
ema.__doc__ = \
"""Exponential Moving Average (EMA)
指数移动平均是对比简单移动平均(SMA)更具响应性的移动平均。其权重由 alpha 决定,与其长度成正比。有几种不同的计算 EMA 的方法。一种方法仅使用标准的 EMA 定义,另一种方法使用 SMA 生成其余计算的初始值。
来源:
https://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:moving_averages
https://www.investopedia.com/ask/answers/122314/what-exponential-moving-average-ema-formula-and-how-ema-calculated.asp
计算:
默认参数:
length=10, adjust=False, sma=True
如果 sma 为 True:
sma_nth = close[0:length].sum() / length
close[:length - 1] = np.NaN
close.iloc[length - 1] = sma_nth
EMA = close.ewm(span=length, adjust=adjust).mean()
参数:
close (pd.Series): 'close' 数据的序列
length (int): 周期。默认为 10
talib (bool): 如果安装了 TA Lib 并且 talib 为 True,则返回 TA Lib 版本。默认为 True
offset (int): 结果的偏移周期数。默认为 0
可选参数:
adjust (bool, optional): 默认为 False
sma (bool, optional): 如果为 True,则使用 SMA 作为初始值。默认为 True
fillna (value, optional): pd.DataFrame.fillna(value)
fill_method (value, optional): 填充方法的类型
返回:
pd.Series: 生成的新特征。
"""
.\pandas-ta\pandas_ta\overlap\fwma.py
from pandas_ta.utils import fibonacci, get_offset, verify_series, weights
def fwma(close, length=None, asc=None, offset=None, **kwargs):
"""Indicator: Fibonacci's Weighted Moving Average (FWMA)"""
length = int(length) if length and length > 0 else 10
asc = asc if asc else True
close = verify_series(close, length)
offset = get_offset(offset)
if close is None: return
fibs = fibonacci(n=length, weighted=True)
fwma = close.rolling(length, min_periods=length).apply(weights(fibs), raw=True)
if offset != 0:
fwma = fwma.shift(offset)
if "fillna" in kwargs:
fwma.fillna(kwargs["fillna"], inplace=True)
if "fill_method" in kwargs:
fwma.fillna(method=kwargs["fill_method"], inplace=True)
fwma.name = f"FWMA_{length}"
fwma.category = "overlap"
return fwma
fwma.__doc__ = \
"""Fibonacci's Weighted Moving Average (FWMA)
Fibonacci's Weighted Moving Average is similar to a Weighted Moving Average
(WMA) where the weights are based on the Fibonacci Sequence.
Source: Kevin Johnson
Calculation:
Default Inputs:
length=10,
def weights(w):
def _compute(x):
return np.dot(w * x)
return _compute
fibs = utils.fibonacci(length - 1)
FWMA = close.rolling(length)_.apply(weights(fibs), raw=True)
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 10
asc (bool): Recent values weigh more. Default: True
offset (int): How many periods to offset the result. Default: 0
Kwargs:
fillna (value, optional): pd.DataFrame.fillna(value)
fill_method (value, optional): Type of fill method
Returns:
pd.Series: New feature generated.
"""
.\pandas-ta\pandas_ta\overlap\hilo.py
from numpy import nan as npNaN
from pandas import DataFrame, Series
from .ma import ma
from pandas_ta.utils import get_offset, verify_series
def hilo(high, low, close, high_length=None, low_length=None, mamode=None, offset=None, **kwargs):
"""Indicator: Gann HiLo (HiLo)"""
high_length = int(high_length) if high_length and high_length > 0 else 13
low_length = int(low_length) if low_length and low_length > 0 else 21
mamode = mamode.lower() if isinstance(mamode, str) else "sma"
_length = max(high_length, low_length)
high = verify_series(high, _length)
low = verify_series(low, _length)
close = verify_series(close, _length)
offset = get_offset(offset)
if high is None or low is None or close is None: return
m = close.size
hilo = Series(npNaN, index=close.index)
long = Series(npNaN, index=close.index)
short = Series(npNaN, index=close.index)
high_ma = ma(mamode, high, length=high_length)
low_ma = ma(mamode, low, length=low_length)
for i in range(1, m):
if close.iloc[i] > high_ma.iloc[i - 1]:
hilo.iloc[i] = long.iloc[i] = low_ma.iloc[i]
elif close.iloc[i] < low_ma.iloc[i - 1]:
hilo.iloc[i] = short.iloc[i] = high_ma.iloc[i]
else:
hilo.iloc[i] = hilo.iloc[i - 1]
long.iloc[i] = short.iloc[i] = hilo.iloc[i - 1]
if offset != 0:
hilo = hilo.shift(offset)
long = long.shift(offset)
short = short.shift(offset)
if "fillna" in kwargs:
hilo.fillna(kwargs["fillna"], inplace=True)
long.fillna(kwargs["fillna"], inplace=True)
short.fillna(kwargs["fillna"], inplace=True)
if "fill_method" in kwargs:
hilo.fillna(method=kwargs["fill_method"], inplace=True)
long.fillna(method=kwargs["fill_method"], inplace=True)
short.fillna(method=kwargs["fill_method"], inplace=True)
_props = f"_{high_length}_{low_length}"
data = {f"HILO{_props}": hilo, f"HILOl{_props}": long, f"HILOs{_props}": short}
df = DataFrame(data, index=close.index)
df.name = f"HILO{_props}"
df.category = "overlap"
return df
hilo.__doc__ = \
"""Gann HiLo Activator(HiLo)
The Gann High Low Activator Indicator was created by Robert Krausz in a 1998
issue of Stocks & Commodities Magazine. It is a moving average based trend
indicator consisting of two different simple moving averages.
The indicator tracks both curves (of the highs and the lows). The close of the
bar defines which of the two gets plotted.
Increasing high_length and decreasing low_length better for short trades,
vice versa for long positions.
Sources:
https://www.sierrachart.com/index.php?page=doc/StudiesReference.php&ID=447&Name=Gann_HiLo_Activator
https://www.tradingtechnologies.com/help/x-study/technical-indicator-definitions/simple-moving-average-sma/
"""
https://www.tradingview.com/script/XNQSLIYb-Gann-High-Low/
Calculation:
Default Inputs:
high_length=13, low_length=21, mamode="sma"
EMA = Exponential Moving Average
HMA = Hull Moving Average
if "ema":
high_ma = EMA(high, high_length)
low_ma = EMA(low, low_length)
elif "hma":
high_ma = HMA(high, high_length)
low_ma = HMA(low, low_length)
else:
high_ma = SMA(high, high_length)
low_ma = SMA(low, low_length)
hilo = Series(npNaN, index=close.index)
for i in range(1, m):
if close.iloc[i] > high_ma.iloc[i - 1]:
hilo.iloc[i] = low_ma.iloc[i]
elif close.iloc[i] < low_ma.iloc[i - 1]:
hilo.iloc[i] = high_ma.iloc[i]
else:
hilo.iloc[i] = hilo.iloc[i - 1]
Args:
high (pd.Series): Series of 'high's
low (pd.Series): Series of 'low's
close (pd.Series): Series of 'close's
high_length (int): It's period. Default: 13
low_length (int): It's period. Default: 21
mamode (str): See ```help(ta.ma)```py. Default: 'sma'
offset (int): How many periods to offset the result. Default: 0
Kwargs:
adjust (bool): Default: True
presma (bool, optional): If True, uses SMA for initial value.
fillna (value, optional): pd.DataFrame.fillna(value)
fill_method (value, optional): Type of fill method
Returns:
pd.DataFrame: HILO (line), HILOl (long), HILOs (short) columns.
.\pandas-ta\pandas_ta\overlap\hl2.py
from pandas_ta.utils import get_offset, verify_series
def hl2(high, low, offset=None, **kwargs):
"""Indicator: HL2 """
high = verify_series(high)
low = verify_series(low)
offset = get_offset(offset)
hl2 = 0.5 * (high + low)
if offset != 0:
hl2 = hl2.shift(offset)
hl2.name = "HL2"
hl2.category = "overlap"
return hl2
.\pandas-ta\pandas_ta\overlap\hlc3.py
from pandas_ta import Imports
from pandas_ta.utils import get_offset, verify_series
def hlc3(high, low, close, talib=None, offset=None, **kwargs):
"""Indicator: HLC3"""
high = verify_series(high)
low = verify_series(low)
close = verify_series(close)
offset = get_offset(offset)
mode_tal = bool(talib) if isinstance(talib, bool) else True
if Imports["talib"] and mode_tal:
from talib import TYPPRICE
hlc3 = TYPPRICE(high, low, close)
else:
hlc3 = (high + low + close) / 3.0
if offset != 0:
hlc3 = hlc3.shift(offset)
hlc3.name = "HLC3"
hlc3.category = "overlap"
return hlc3
.\pandas-ta\pandas_ta\overlap\hma.py
from numpy import sqrt as npSqrt
from .wma import wma
from pandas_ta.utils import get_offset, verify_series
def hma(close, length=None, offset=None, **kwargs):
"""Indicator: Hull Moving Average (HMA)"""
length = int(length) if length and length > 0 else 10
close = verify_series(close, length)
offset = get_offset(offset)
if close is None: return
half_length = int(length / 2)
sqrt_length = int(npSqrt(length))
wmaf = wma(close=close, length=half_length)
wmas = wma(close=close, length=length)
hma = wma(close=2 * wmaf - wmas, length=sqrt_length)
if offset != 0:
hma = hma.shift(offset)
if "fillna" in kwargs:
hma.fillna(kwargs["fillna"], inplace=True)
if "fill_method" in kwargs:
hma.fillna(method=kwargs["fill_method"], inplace=True)
hma.name = f"HMA_{length}"
hma.category = "overlap"
return hma
hma.__doc__ = \
"""Hull Moving Average (HMA)
The Hull Exponential Moving Average attempts to reduce or remove lag in moving
averages.
Sources:
https://alanhull.com/hull-moving-average
Calculation:
Default Inputs:
length=10
WMA = Weighted Moving Average
half_length = int(0.5 * length)
sqrt_length = int(sqrt(length))
wmaf = WMA(close, half_length)
wmas = WMA(close, length)
HMA = WMA(2 * wmaf - wmas, sqrt_length)
Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 10
offset (int): How many periods to offset the result. Default: 0
Kwargs:
fillna (value, optional): pd.DataFrame.fillna(value)
fill_method (value, optional): Type of fill method
Returns:
pd.Series: New feature generated.
"""
.\pandas-ta\pandas_ta\overlap\hwma.py
from pandas import Series
from pandas_ta.utils import get_offset, verify_series
def hwma(close, na=None, nb=None, nc=None, offset=None, **kwargs):
"""Indicator: Holt-Winter Moving Average"""
na = float(na) if na and na > 0 and na < 1 else 0.2
nb = float(nb) if nb and nb > 0 and nb < 1 else 0.1
nc = float(nc) if nc and nc > 0 and nc < 1 else 0.1
close = verify_series(close)
offset = get_offset(offset)
last_a = last_v = 0
last_f = close.iloc[0]
result = []
m = close.size
for i in range(m):
F = (1.0 - na) * (last_f + last_v + 0.5 * last_a) + na * close.iloc[i]
V = (1.0 - nb) * (last_v + last_a) + nb * (F - last_f)
A = (1.0 - nc) * last_a + nc * (V - last_v)
result.append((F + V + 0.5 * A))
last_a, last_f, last_v = A, F, V
hwma = Series(result, index=close.index)
if offset != 0:
hwma = hwma.shift(offset)
if "fillna" in kwargs:
hwma.fillna(kwargs["fillna"], inplace=True)
if "fill_method" in kwargs:
hwma.fillna(method=kwargs["fill_method"], inplace=True)
suffix = f"{na}_{nb}_{nc}"
hwma.name = f"HWMA_{suffix}"
hwma.category = "overlap"
return hwma
hwma.__doc__ = \
"""HWMA (Holt-Winter Moving Average)
Indicator HWMA (Holt-Winter Moving Average) is a three-parameter moving average
by the Holt-Winter method; the three parameters should be selected to obtain a
forecast.
This version has been implemented for Pandas TA by rengel8 based
on a publication for MetaTrader 5.
Sources:
https://www.mql5.com/en/code/20856
Calculation:
HWMA[i] = F[i] + V[i] + 0.5 * A[i]
where..
F[i] = (1-na) * (F[i-1] + V[i-1] + 0.5 * A[i-1]) + na * Price[i]
V[i] = (1-nb) * (V[i-1] + A[i-1]) + nb * (F[i] - F[i-1])
A[i] = (1-nc) * A[i-1] + nc * (V[i] - V[i-1])
Args:
close (pd.Series): Series of 'close's
na (float): Smoothed series parameter (from 0 to 1). Default: 0.2
nb (float): Trend parameter (from 0 to 1). Default: 0.1
nc (float): Seasonality parameter (from 0 to 1). Default: 0.1
close (pd.Series): Series of 'close's
Kwargs:
fillna (value, optional): pd.DataFrame.fillna(value)
fill_method (value, optional): Type of fill method
Returns:
pd.Series: hwma
"""
.\pandas-ta\pandas_ta\overlap\ichimoku.py
from pandas import date_range, DataFrame, RangeIndex, Timedelta
from .midprice import midprice
from pandas_ta.utils import get_offset, verify_series
def ichimoku(high, low, close, tenkan=None, kijun=None, senkou=None, include_chikou=True, offset=None, **kwargs):
"""Indicator: Ichimoku Kinkō Hyō (Ichimoku)"""
tenkan = int(tenkan) if tenkan and tenkan > 0 else 9
kijun = int(kijun) if kijun and kijun > 0 else 26
senkou = int(senkou) if senkou and senkou > 0 else 52
_length = max(tenkan, kijun, senkou)
high = verify_series(high, _length)
low = verify_series(low, _length)
close = verify_series(close, _length)
offset = get_offset(offset)
if not kwargs.get("lookahead", True):
include_chikou = False
if high is None or low is None or close is None: return None, None
tenkan_sen = midprice(high=high, low=low, length=tenkan)
kijun_sen = midprice(high=high, low=low, length=kijun)
span_a = 0.5 * (tenkan_sen + kijun_sen)
span_b = midprice(high=high, low=low, length=senkou)
_span_a = span_a[-kijun:].copy()
_span_b = span_b[-kijun:].copy()
span_a = span_a.shift(kijun)
span_b = span_b.shift(kijun)
chikou_span = close.shift(-kijun)
if offset != 0:
tenkan_sen = tenkan_sen.shift(offset)
kijun_sen = kijun_sen.shift(offset)
span_a = span_a.shift(offset)
span_b = span_b.shift(offset)
chikou_span = chikou_span.shift(offset)
if "fillna" in kwargs:
span_a.fillna(kwargs["fillna"], inplace=True)
span_b.fillna(kwargs["fillna"], inplace=True)
chikou_span.fillna(kwargs["fillna"], inplace=True)
if "fill_method" in kwargs:
span_a.fillna(method=kwargs["fill_method"], inplace=True)
span_b.fillna(method=kwargs["fill_method"], inplace=True)
chikou_span.fillna(method=kwargs["fill_method"], inplace=True)
span_a.name = f"ISA_{tenkan}"
span_b.name = f"ISB_{kijun}"
tenkan_sen.name = f"ITS_{tenkan}"
kijun_sen.name = f"IKS_{kijun}"
chikou_span.name = f"ICS_{kijun}"
chikou_span.category = kijun_sen.category = tenkan_sen.category = "trend"
span_b.category = span_a.category = chikou_span
data = {
span_a.name: span_a,
span_b.name: span_b,
tenkan_sen.name: tenkan_sen,
kijun_sen.name: kijun_sen,
}
if include_chikou:
data[chikou_span.name] = chikou_span
ichimokudf = DataFrame(data)
ichimokudf.name = f"ICHIMOKU_{tenkan}_{kijun}_{senkou}"
ichimokudf.category = "overlap"
last = close.index[-1]
if close.index.dtype == "int64":
ext_index = RangeIndex(start=last + 1, stop=last + kijun + 1)
spandf = DataFrame(index=ext_index, columns=[span_a.name, span_b.name])
_span_a.index = _span_b.index = ext_index
else:
df_freq = close.index.value_counts().mode()[0]
tdelta = Timedelta(df_freq, unit="d")
new_dt = date_range(start=last + tdelta, periods=kijun, freq="B")
spandf = DataFrame(index=new_dt, columns=[span_a.name, span_b.name])
spandf[span_a.name] = _span_a
spandf[span_b.name] = _span_b
spandf.name = f"ICHISPAN_{tenkan}_{kijun}"
spandf.category = "overlap"
return ichimokudf, spandf
ichimoku.__doc__ = \
"""Ichimoku Kinkō Hyō (ichimoku)
Developed Pre WWII as a forecasting model for financial markets.
Sources:
https://www.tradingtechnologies.com/help/x-study/technical-indicator-definitions/ichimoku-ich/
Calculation:
Default Inputs:
tenkan=9, kijun=26, senkou=52
MIDPRICE = Midprice
TENKAN_SEN = MIDPRICE(high, low, close, length=tenkan)
KIJUN_SEN = MIDPRICE(high, low, close, length=kijun)
CHIKOU_SPAN = close.shift(-kijun)
SPAN_A = 0.5 * (TENKAN_SEN + KIJUN_SEN)
SPAN_A = SPAN_A.shift(kijun)
SPAN_B = MIDPRICE(high, low, close, length=senkou)
SPAN_B = SPAN_B.shift(kijun)
Args:
high (pd.Series): Series of 'high's # high 数据序列
low (pd.Series): Series of 'low's # low 数据序列
close (pd.Series): Series of 'close's # close 数据序列
tenkan (int): Tenkan period. Default: 9 # Tenkan 周期,默认为 9
kijun (int): Kijun period. Default: 26 # Kijun 周期,默认为 26
senkou (int): Senkou period. Default: 52 # Senkou 周期,默认为 52
include_chikou (bool): Whether to include chikou component. Default: True # 是否包含 chikou 组件,默认为 True
offset (int): How many periods to offset the result. Default: 0 # 结果偏移的周期数,默认为 0
Kwargs:
fillna (value, optional): pd.DataFrame.fillna(value) # fillna 方法的参数,用于填充缺失值
fill_method (value, optional): Type of fill method # 填充方法的类型
Returns:
pd.DataFrame: Two DataFrames. # 返回两个 DataFrame
For the visible period: spanA, spanB, tenkan_sen, kijun_sen, # 可见期间的 DataFrame,包含 spanA、spanB、tenkan_sen、kijun_sen
and chikou_span columns # 以及 chikou_span 列
For the forward looking period: spanA and spanB columns # 未来观察期间的 DataFrame,包含 spanA 和 spanB 列
"""