fta

package module
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2023 License: MIT Imports: 8 Imported by: 1

README

FTA

logo

Go Report Card Go Reference

Financial technical indicators implemented in Go.

Port of Python library peerchemist/finta

Drawing plots

Compatable with gonum's plot interfaces. You can check these plotters:

Implemented indicators

  • SMA (Simple moving average)
  • SMM (Simple moving median)
  • SSMA (Smoothed simple moving average)
  • EMA (Exponential Weighted Moving Average)
  • WMA (Weighted moving average)
  • HMA (Hull Moving Average)
  • ROC (The Rate-of-Change)
  • KST (Know Sure Thing)
  • FISH (Fisher Transform)
  • MACD (Moving Average Convergence Divergence)
  • BBANDS (Bollinger Bands)
  • PercentB (Percent B)
  • RSI (Relative Strength Index)
  • CRSI (Connors RSI)
  • STOCH (Stochastic Oscillator %K)
  • STOCHD (Stochastic Oscillator %D)
  • StochRSI (Stochastic RSI)
  • ADL (Accumulation/Distribution Line)
  • CHAIKIN (Chaikin Oscillator)
  • VZO (Volume Zone Oscillator)
  • PSAR (Parabolic Stop and Reverse)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ADL added in v0.3.1

func ADL(high, low, close series.Data) (adl series.Data)

The accumulation/distribution line was created by Marc Chaikin to determine the flow of money into or out of a security. It should not be confused with the advance/decline line. While their initials might be the same, these are entirely different indicators, and their uses are different as well. Whereas the advance/decline line can provide insight into market movements, the accumulation/distribution line is of use to traders looking to measure buy/sell pressure on a security or confirm the strength of a trend.

func BBANDS

func BBANDS(column series.Data, ma series.Data, period int, stdMultiplier float64) (upper, lower series.Data)

Developed by John Bollinger, Bollinger Bands® are volatility bands placed above and below a moving average. Volatility is based on the standard deviation, which changes as volatility increases and decreases. The bands automatically widen when volatility increases and narrow when volatility decreases.

func CHAIKIN added in v0.3.1

func CHAIKIN(high, low, close series.Data, adjust bool) (chaikin series.Data)

Chaikin Oscillator, named after its creator, Marc Chaikin, the Chaikin oscillator is an oscillator that measures the accumulation/distribution line of the moving average convergence divergence (MACD). The Chaikin oscillator is calculated by subtracting a 10-day exponential moving average (EMA) of the accumulation/distribution line from a three-day EMA of the accumulation/distribution line, and highlights the momentum implied by the accumulation/distribution line.

func CRSI

func CRSI(close series.Data, period int, periodUpDown int, periodrRoc int, adjust bool) (crsi series.Data)

Connors RSI (CRSI) is a technical analysis indicator created by Larry Connors that is actually a composite of three separate components. The Relative Strength Index (RSI), developed by J. Welles Wilder, plays an integral role in Connors RSI. Connors RSI outputs a value between 0 and 100, which is then used to identify short-term overbought and oversold conditions.

func EMA added in v0.1.2

func EMA(column series.Data, period int, adjust bool) (ema series.Data)

Exponential Weighted Moving Average - Like all moving average indicators, they are much better suited for trending markets. When the market is in a strong and sustained uptrend, the EMA indicator line will also show an uptrend and vice-versa for a down trend. EMAs are commonly used in conjunction with other indicators to confirm significant market moves and to gauge their validity.

func FISH

func FISH(low, high series.Data, period int, adjust bool) (fish series.Data)

Fisher Transform was presented by John Ehlers. It assumes that price distributions behave like square waves.

func HMA added in v0.1.3

func HMA(column series.Data, period int) (hma series.Data)

HMA indicator is a common abbreviation of Hull Moving Average. The average was developed by Allan Hull and is used mainly to identify the current market trend. Unlike SMA (simple moving average) the curve of Hull moving average is considerably smoother. Moreover, because its aim is to minimize the lag between HMA and price it does follow the price activity much closer. It is used especially for middle-term and long-term trading.

func KST

func KST(column series.Data, r1, r2, r3, r4 int) (k, signal series.Data)

Know Sure Thing (KST) is a momentum oscillator based on the smoothed rate-of-change for four different time frames. KST measures price momentum for four different price cycles. It can be used just like any momentum oscillator. Chartists can look for divergences, overbought/oversold readings, signal line crossovers and centerline crossovers.

func MACD

func MACD(column series.Data, periodFast float64, periodSlow float64, signal float64, adjust bool) (macd, macdSignal series.Data)

MACD, MACD Signal and MACD difference. The MACD Line oscillates above and below the zero line, which is also known as the centerline. These crossovers signal that the 12-day EMA has crossed the 26-day EMA. The direction, of course, depends on the direction of the moving average cross. Positive MACD indicates that the 12-day EMA is above the 26-day EMA. Positive values increase as the shorter EMA diverges further from the longer EMA. This means upside momentum is increasing. Negative MACD values indicates that the 12-day EMA is below the 26-day EMA.

Negative values increase as the shorter EMA diverges further below the longer EMA. This means downside momentum is increasing. Signal line crossovers are the most common MACD signals. The signal line is a 9-day EMA of the MACD Line. As a moving average of the indicator, it trails the MACD and makes it easier to spot MACD turns. A bullish crossover occurs when the MACD turns up and crosses above the signal line. A bearish crossover occurs when the MACD turns down and crosses below the signal line.

func PSAR added in v0.5.0

func PSAR(high, low, close series.Data, iaf float64, maxaf float64) (psarSeries, bullSeries, bearSeries series.Data)

The parabolic SAR indicator, developed by J. Wells Wilder, is used by traders to determine trend direction and potential reversals in price. The indicator uses a trailing stop and reverse method called "SAR," or stop and reverse, to identify suitable exit and entry points. Traders also refer to the indicator as the parabolic stop and reverse, parabolic SAR, or PSAR. https://www.investopedia.com/terms/p/parabolicindicator.asp https://virtualizedfrog.wordpress.com/2014/12/09/parabolic-sar-implementation-in-python/

func PercentB

func PercentB(column series.Data, ma series.Data, period int, stdMultiplier float64) (percentB series.Data)

%b (pronounced 'percent b') is derived from the formula for Stochastics and shows where price is in relation to the bands. %b equals 1 at the upper band and 0 at the lower band.

func ROC

func ROC(column series.Data, period int) (roc series.Data)

The Rate-of-Change (ROC) indicator, which is also referred to as simply Momentum, is a pure momentum oscillator that measures the percent change in price from one period to the next. The ROC calculation compares the current price with the price “n” periods ago.

func RSI

func RSI(column series.Data, period int, adjust bool) (rsi series.Data)

Relative Strength Index (RSI) is a momentum oscillator that measures the speed and change of price movements. RSI oscillates between zero and 100. Traditionally, and according to Wilder, RSI is considered overbought when above 70 and oversold when below 30. Signals can also be generated by looking for divergences, failure swings and centerline crossovers. RSI can also be used to identify the general trend.

func SMA

func SMA(column series.Data, period int) (sma series.Data)

Simple moving average - rolling mean in pandas lingo. Also known as 'MA'. The simple moving average (SMA) is the most basic of the moving averages used for trading.

func SMM added in v0.1.2

func SMM(column series.Data, period int) (smm series.Data)

Simple moving median, an alternative to moving average. SMA, when used to estimate the underlying trend in a time series, is susceptible to rare events such as rapid shocks or other anomalies. A more robust estimate of the trend is the simple moving median over n time periods.

func SSMA added in v0.1.2

func SSMA(column series.Data, period int, adjust bool) (ssma series.Data)

Smoothed simple moving average.

func STOCH added in v0.2.1

func STOCH(high, low, close series.Data, period int) (stoch series.Data)

Stochastic oscillator %K The stochastic oscillator is a momentum indicator comparing the closing price of a security to the range of its prices over a certain period of time. The sensitivity of the oscillator to market movements is reducible by adjusting that time period or by taking a moving average of the result.

func STOCHD added in v0.2.1

func STOCHD(high, low, close series.Data, period int) (stochd series.Data)

Stochastic oscillator %D STOCH%D is a 3 period simple moving average of %K.

func StochRSI added in v0.2.1

func StochRSI(price series.Data, rsiPeriod, stochPeriod int, adjust bool) (stochRSI series.Data)

StochRSI is an oscillator that measures the level of RSI relative to its high-low range over a set time period. StochRSI applies the Stochastics formula to RSI values, instead of price values. This makes it an indicator of an indicator. The result is an oscillator that fluctuates between 0 and 1.

func VZO added in v0.2.1

func VZO(price, volume series.Data, period int, adjust bool) (vzo series.Data)

VZO uses price, previous price and moving averages to compute its oscillating value. It is a leading indicator that calculates buy and sell signals based on oversold / overbought conditions. Oscillations between the 5% and 40% levels mark a bullish trend zone, while oscillations between -40% and 5% mark a bearish trend zone. Meanwhile, readings above 40% signal an overbought condition, while readings above 60% signal an extremely overbought condition. Alternatively, readings below -40% indicate an oversold condition, which becomes extremely oversold below -60%.

func WMA added in v0.1.3

func WMA(column series.Data, period int) (wma series.Data)

WMA stands for weighted moving average. It helps to smooth the price curve for better trend identification. It places even greater importance on recent data than the EMA does.

Types

type DType added in v0.1.1

type DType = series.DType

type OHLCV added in v0.3.0

type OHLCV struct{ Open, High, Low, Close, Volume series.Data }

OHLCV is a data frame of open, high, close, volume columns. Implements github.com/pplcc/plotext.TOHLCVer interface.

func ReadCSV added in v0.3.0

func ReadCSV(reader *csv.Reader, freq int64, unixTime UnixTime) (ohlcv OHLCV, err error)

ReadCSV parses ohlcv from csv reader. The columns are read at this order: Time Open High Low Close Volume. freq is a sample size, usually it's time.Second or time.Millisecond.

func (OHLCV) Clone added in v0.3.0

func (ohlcv OHLCV) Clone() OHLCV

Clone returns full copy of ohlcv.

func (OHLCV) Len added in v0.4.0

func (ohlcv OHLCV) Len() int

Len returns the number of time, open, high, low, close, volume tuples.

func (OHLCV) Resample added in v0.3.0

func (ohlcv OHLCV) Resample(interval int64) OHLCV

Resample returns resampled copy of ohlcv. Interval is the length of one sample in seconds.

func (OHLCV) Slice added in v0.4.2

func (ohlcv OHLCV) Slice(begin, end int) OHLCV

Slice slices ohlcv frame.

func (OHLCV) TOHLCV added in v0.4.0

func (ohlcv OHLCV) TOHLCV(i int) (t float64, o float64, h float64, l float64, c float64, v float64)

TOHLCV returns an time, open, high, low, close, volume tuple.

type UnixTime added in v0.4.3

type UnixTime int
const (
	Seconds UnixTime = iota
	Milliseconds
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL