You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
classStochasticOscillator(IndicatorMixin):
"""Stochastic Oscillator Developed in the late 1950s by George Lane. The stochastic oscillator presents the location of the closing price of a stock in relation to the high and low range of the price of a stock over a period of time, typically a 14-day period. https://school.stockcharts.com/doku.php?id=technical_indicators:stochastic_oscillator_fast_slow_and_full Args: close(pandas.Series): dataset 'Close' column. high(pandas.Series): dataset 'High' column. low(pandas.Series): dataset 'Low' column. window(int): n period. smooth_window(int): sma period over stoch_k. fillna(bool): if True, fill nan values. """def__init__(
self,
high: pd.Series,
low: pd.Series,
close: pd.Series,
window: int=14,
smooth_window: int=3,
fillna: bool=False,
):
self._close=closeself._high=highself._low=lowself._window=windowself._smooth_window=smooth_windowself._fillna=fillnaself._run()
def_run(self):
min_periods=0ifself._fillnaelseself._windowsmin=self._low.rolling(self._window, min_periods=min_periods).min()
smax=self._high.rolling(self._window, min_periods=min_periods).max()
self._stoch_k=100* (self._close-smin) / (smax-smin)
k = stoch_k.rolling(3).mean()
d = k.rolling(3).mean()
14/3/3
The text was updated successfully, but these errors were encountered:
k = stoch_k.rolling(3).mean()
d = k.rolling(3).mean()
14/3/3
The text was updated successfully, but these errors were encountered: