Technical indicators

Technical indicators#

sigtech.framework.signal.library.technical_indicators.adx(high: Series, low: Series, close: Series, window: int, atr_window: Optional[int] = None, ewma: bool = True)

Average Direction Index (ADX) Indicator measures the strength of a trend, not the direction. See https://en.wikipedia.org/wiki/Average_directional_movement_index

Note: close, high and low arguments can be replaced by passing df=prices_df, where prices_df contains columns of 'close', 'high' and 'low' (case-insensitive).

Parameters:
  • close – Timeseries of close prices.

  • high – Timeseries of high prices.

  • low – Timeseries of low prices.

  • window – Lookback window size.

  • atr_window – Lookback window for the average_true_range calculation. Defaults to window if not supplied.

  • ewma – Whether to use an exponentially weighted moving window or simple square window (default).

Returns:

Timeseries of WR.

sigtech.framework.signal.library.technical_indicators.average_true_range(high: Series, low: Series, close: Series, window: int) Series

Find the average true range for the supplied prices. See https://en.wikipedia.org/wiki/Average_true_range. ATR is the EWMA of the true range:

\[ATR = max(high_t, close_{t-1}) - min(low_t, close_{t-1}).\]

Note: close, high and low arguments can be replaced by passing df=prices_df, where prices_df contains columns of 'close', 'high' and 'low' (case-insensitive).

Parameters:
  • close – Timeseries of close prices.

  • high – Timeseries of high prices.

  • low – Timeseries of low prices.

  • window – Lookback window size.

Returns:

Timeseries of average true range.

sigtech.framework.signal.library.technical_indicators.boll(close: Series, high: Series, low: Series, window: int, ewma: bool = False) Series

BOLL Indicator, i.e. the percentage position of the close price inside the bollinger band.

Note: close, high and low arguments can be replaced by passing df=prices_df, where prices_df contains columns of 'close', 'high' and 'low' (case-insensitive).

Parameters:
  • close – Timeseries of close prices.

  • high – Timeseries of high prices.

  • low – Timeseries of low prices.

  • window – Lookback window size.

  • ewma – Whether to use an exponentially weighted moving window or simple square window (default).

Returns:

Timeseries of BOLL.

sigtech.framework.signal.library.technical_indicators.kdj(close: Series, high: Series, low: Series, window: int, k_smooth: int = 1, d_smooth: int = 1, j_smooth: int = 1) DataFrame

KDJ Indicator. See https://www.learnforexc.com/what-is-the-kdj-stochastic-oscillator-and-the-calculation-method-of-the-kdj-indicator/

Note: close, high and low arguments can be replaced by passing df=prices_df, where prices_df contains columns of 'close', 'high' and 'low' (case-insensitive).

Parameters:
  • close – Timeseries of close prices.

  • high – Timeseries of high prices.

  • low – Timeseries of low prices.

  • window – Lookback window for taking high/low prices.

  • k_smooth – Smoothing parameter for %K timeseries. Uses EWMA smoothing via the pandas span parameter. Please note: Smoothing is done after the calculation of %K, %D, and %J.

  • d_smooth – Similar to k_smooth for %D.

  • j_smooth – Similar to k_smooth for %J.

Returns:

DataFrame of K,D and J values.

sigtech.framework.signal.library.technical_indicators.kdj_plot(*args, **kwargs)

Display a plot of the KDJ indicator.

Please see kdj() for more details.

Parameters:
  • args – Passed to kdj function.

  • kwargs – Passed to kdj function.

sigtech.framework.signal.library.technical_indicators.macd(close: Series, short_window: int = 12, long_window: int = 26) DataFrame

Moving Average Convergence Divergence Indicator.

Parameters:
  • close – Close price timeseries.

  • short_window – Short moving average periods.

  • long_window – Long moving average periods.

Returns:

DataFrame of moving averages and indicator value.

sigtech.framework.signal.library.technical_indicators.macd_plot(ts, *args, **kwargs)

Create a Moving Average Convergence divergence indicator plot from the supplied timeseries of prices.

See macd() for argument details.

sigtech.framework.signal.library.technical_indicators.wr(close: Series, high: Series, low: Series, window: int, ewma: bool = False) Series

WR Indicator. Williams %R indicator is a momentum indicator of values between 0 and negative 100. Readings closer to -100 are considered oversold, those closer to 0 and considered overbought.

Note: close, high and low arguments can be replaced by passing df=prices_df, where prices_df contains columns of 'close', 'high' and 'low' (case-insensitive).

Parameters:
  • close – Timeseries of close prices.

  • high – Timeseries of high prices.

  • low – Timeseries of low prices.

  • window – Lookback window size.

  • ewma – Whether to use an exponentially weighted moving window or simple square window (default).

Returns:

Timeseries of WR.