Skip to content

Latest commit

 

History

History
66 lines (46 loc) · 2.44 KB

File metadata and controls

66 lines (46 loc) · 2.44 KB

Technical Indicators

MeridianAlgo ships more than forty technical indicators as plain functions on numpy and pandas. They run in the base install and need no extras. Each function takes a price pd.Series, and high, low, or volume where relevant, and returns a pd.Series or a tuple of series.

import meridianalgo as ma                              # ma.RSI, ma.MACD, and so on
from meridianalgo.signals.indicators import RSI         # source module

Quick example

import meridianalgo as ma

rsi = ma.RSI(prices, period=14)
macd_line, signal_line, histogram = ma.MACD(prices)
upper, middle, lower = ma.BollingerBands(prices, period=20)
atr = ma.ATR(high, low, close, period=14)
sma_20 = ma.SMA(prices, period=20)
ema_12 = ma.EMA(prices, period=12)

Available indicators

Trend and moving averages SMA, EMA, WMA, MACD, ADX, Aroon, ParabolicSAR, Ichimoku

Momentum RSI, Stochastic, WilliamsR, CCI, ROC

Volatility BollingerBands, ATR, KeltnerChannels, DonchianChannels

Volume OBV, MFI, AccumulationDistribution, ChaikinMoneyFlow, VWAP

See meridianalgo/signals/indicators.py for the full list and signatures.

Signatures, selected

Indicator Call Returns
RSI ma.RSI(prices, period=14) Series
MACD ma.MACD(prices, fast=12, slow=26, signal=9) (macd, signal, hist)
Bollinger Bands ma.BollingerBands(prices, period=20, std_dev=2) (upper, middle, lower)
ATR ma.ATR(high, low, close, period=14) Series
Stochastic ma.Stochastic(high, low, close, k_period=14, d_period=3) (%K, %D)
OBV ma.OBV(close, volume) Series
MFI ma.MFI(high, low, close, volume, period=14) Series

A note on the VWAP name

VWAP exists twice in the library, once as an execution scheduler and once as a volume indicator. The top level from meridianalgo import VWAP resolves to the execution scheduler. The indicator stays reachable as meridianalgo.signals.indicators.VWAP.

Statistical arbitrage z score

The rolling z score helper builds on the same base install.

import meridianalgo as ma

stat_arb = ma.StatisticalArbitrage(prices)
zscore = stat_arb.calculate_zscore(window=21)

The cointegration test, calculate_cointegration, relies on statsmodels, so install the ml extra to use it.