Skip to content

Commit

Permalink
doc: add description about indicators generated by chatgpt
Browse files Browse the repository at this point in the history
  • Loading branch information
zenixls2 committed Dec 22, 2022
1 parent 3846116 commit 2b62616
Show file tree
Hide file tree
Showing 23 changed files with 293 additions and 38 deletions.
14 changes: 11 additions & 3 deletions pkg/indicator/alma.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ import (
// Refer: Arnaud Legoux Moving Average
// Refer: https://capital.com/arnaud-legoux-moving-average
// Also check https://github.com/DaveSkender/Stock.Indicators/blob/main/src/a-d/Alma/Alma.cs
//
// The Arnaud Legoux Moving Average (ALMA) is a technical analysis indicator that is used to smooth price data and reduce the lag associated
// with traditional moving averages. It was developed by Arnaud Legoux and is based on the weighted moving average, with the weighting factors
// determined using a Gaussian function. The ALMA is calculated by taking the weighted moving average of the input data using weighting factors
// that are based on the standard deviation of the data and the specified length of the moving average. This resulting average is then plotted
// on the price chart as a line, which can be used to make predictions about future price movements. The ALMA is typically more responsive to
// changes in the underlying data than a simple moving average, but may be less reliable in trending markets.
//
// @param offset: Gaussian applied to the combo line. 1->ema, 0->sma
// @param sigma: the standard deviation applied to the combo line. This makes the combo line sharper
//go:generate callbackgen -type ALMA
Expand All @@ -20,9 +28,9 @@ type ALMA struct {
Sigma int // required: recommend to be 5
weight []float64
sum float64
input []float64
Values floats.Slice
UpdateCallbacks []func(value float64)
input []float64
Values floats.Slice
UpdateCallbacks []func(value float64)
}

const MaxNumOfALMA = 5_000
Expand Down
8 changes: 8 additions & 0 deletions pkg/indicator/atrp.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ import (
// ATRP is the average true range percentage
// See also https://www.fidelity.com/learning-center/trading-investing/technical-analysis/technical-indicator-guide/atrp
//
// The Average True Range Percentage (ATRP) is a technical analysis indicator that measures the volatility of a security's price. It is
// calculated by dividing the Average True Range (ATR) of the security by its closing price, and then multiplying the result by 100 to convert
// it to a percentage. The ATR is a measure of the range of a security's price, taking into account gaps between trading periods and any limit
// moves (sharp price movements that are allowed under certain exchange rules). The ATR is typically smoothed using a moving average to make it
// more responsive to changes in the underlying price data. The ATRP is a useful indicator for traders because it provides a way to compare the
// volatility of different securities, regardless of their individual prices. It can also be used to identify potential entry and exit points
// for trades based on changes in the security's volatility.
//
// Calculation:
//
// ATRP = (Average True Range / Close) * 100
Expand Down
9 changes: 9 additions & 0 deletions pkg/indicator/cci.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ import (
// Refer: Commodity Channel Index
// Refer URL: http://www.andrewshamlet.net/2017/07/08/python-tutorial-cci
// with modification of ddof=0 to let standard deviation to be divided by N instead of N-1
//
// The Commodity Channel Index (CCI) is a technical analysis indicator that is used to identify potential overbought or oversold conditions
// in a security's price. It was originally developed for use in commodity markets, but can be applied to any security that has a sufficient
// amount of price data. The CCI is calculated by taking the difference between the security's typical price (the average of its high, low, and
// closing prices) and its moving average, and then dividing the result by the mean absolute deviation of the typical price. This resulting value
// is then plotted as a line on the price chart, with values above +100 indicating overbought conditions and values below -100 indicating
// oversold conditions. The CCI can be used by traders to identify potential entry and exit points for trades, or to confirm other technical
// analysis signals.

//go:generate callbackgen -type CCI
type CCI struct {
types.SeriesBase
Expand Down
7 changes: 7 additions & 0 deletions pkg/indicator/dema.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ import (

// Refer: Double Exponential Moving Average
// Refer URL: https://investopedia.com/terms/d/double-exponential-moving-average.asp
//
// The Double Exponential Moving Average (DEMA) is a technical analysis indicator that is used to smooth price data and reduce the lag
// associated with traditional moving averages. It is calculated by taking the exponentially weighted moving average of the input data,
// and then taking the exponentially weighted moving average of that result. This double-smoothing process helps to eliminate much of the noise
// in the original data and provides a more accurate representation of the underlying trend. The DEMA line is then plotted on the price chart,
// which can be used to make predictions about future price movements. The DEMA is typically more responsive to changes in the underlying data
// than a simple moving average, but may be less reliable in trending markets.

//go:generate callbackgen -type DEMA
type DEMA struct {
Expand Down
11 changes: 9 additions & 2 deletions pkg/indicator/dmi.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,15 @@ import (
// Refer: https://github.com/twopirllc/pandas-ta/blob/main/pandas_ta/trend/adx.py
//
// Directional Movement Index
// an indicator developed by J. Welles Wilder in 1978 that identifies in which
// direction the price of an asset is moving.
//
// The Directional Movement Index (DMI) is a technical analysis indicator that is used to identify the direction and strength of a trend
// in a security's price. It was developed by J. Welles Wilder and is based on the concept of the +DI and -DI lines, which measure the strength
// of upward and downward price movements, respectively. The DMI is calculated by taking the difference between the +DI and -DI lines, and then
// smoothing the result using a moving average. This resulting line is called the Average Directional Index (ADX), and is used to identify whether
// a security is trending or not. If the ADX is above a certain threshold, typically 20, it indicates that the security is in a strong trend,
// and if it is below that threshold it indicates that the security is in a sideways or choppy market. The DMI can be used by traders to confirm
// the direction and strength of a trend, or to identify potential entry and exit points for trades.

//go:generate callbackgen -type DMI
type DMI struct {
types.IntervalWindow
Expand Down
8 changes: 8 additions & 0 deletions pkg/indicator/drift.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ import (
// Refer: https://tradingview.com/script/aDymGrFx-Drift-Study-Inspired-by-Monte-Carlo-Simulations-with-BM-KL/
// Brownian Motion's drift factor
// could be used in Monte Carlo Simulations
//
// In the context of Brownian motion, drift can be measured by calculating the simple moving average (SMA) of the logarithm
// of the price changes of a security over a specified period of time. This SMA can be used to identify the long-term trend
// or bias in the random movement of the security's price. A security with a positive drift is said to be trending upwards,
// while a security with a negative drift is said to be trending downwards. Drift can be used by traders to identify potential
// entry and exit points for trades, or to confirm other technical analysis signals.
// It is typically used in conjunction with other indicators to provide a more comprehensive view of the security's price.

//go:generate callbackgen -type Drift
type Drift struct {
types.SeriesBase
Expand Down
5 changes: 5 additions & 0 deletions pkg/indicator/emv.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ import (

// Refer: Ease of Movement
// Refer URL: https://www.investopedia.com/terms/e/easeofmovement.asp
// The Ease of Movement (EOM) is a technical analysis indicator that is used to measure the relationship between the volume of a security
// and its price movement. It is calculated by dividing the difference between the high and low prices of the security by the total
// volume of the security over a specified period of time, and then multiplying the result by a constant factor. This resulting value is
// then plotted on the price chart as a line, which can be used to make predictions about future price movements. The EOM is typically
// used to identify periods of high or low trading activity, and can be used to confirm other technical analysis signals.

//go:generate callbackgen -type EMV
type EMV struct {
Expand Down
9 changes: 9 additions & 0 deletions pkg/indicator/fisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ import (
"github.com/c9s/bbgo/pkg/types"
)

// Fisher Transform
//
// The Fisher Transform is a technical analysis indicator that is used to identify potential turning points in the price of a security.
// It is based on the idea that prices tend to be normally distributed, with most price movements being small and relatively insignificant.
// The Fisher Transform converts this normal distribution into a symmetrical, Gaussian distribution, with a peak at zero and a range of -1 to +1.
// This transformation allows for more accurate identification of price extremes, which can be used to make predictions about potential trend reversals.
// The Fisher Transform is calculated by taking the natural logarithm of the ratio of the security's current price to its moving average,
// and then double-smoothing the result. This resulting line is called the Fisher Transform line, and can be plotted on the price chart
// along with the security's price.
//go:generate callbackgen -type FisherTransform
type FisherTransform struct {
types.SeriesBase
Expand Down
7 changes: 7 additions & 0 deletions pkg/indicator/gma.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ import (
)

// Geometric Moving Average
//
// The Geometric Moving Average (GMA) is a technical analysis indicator that uses the geometric mean of a set of data points instead of
// the simple arithmetic mean used by traditional moving averages. It is calculated by taking the nth root of the product of the last n
// data points, where n is the length of the moving average. The resulting average is then plotted on the price chart as a line, which can
// be used to make predictions about future price movements. Because the GMA gives more weight to recent data points, it is typically more
// responsive to changes in the underlying data than a simple moving average.

//go:generate callbackgen -type GMA
type GMA struct {
types.SeriesBase
Expand Down
6 changes: 6 additions & 0 deletions pkg/indicator/hull.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ import (

// Refer: Hull Moving Average
// Refer URL: https://fidelity.com/learning-center/trading-investing/technical-analysis/technical-indicator-guide/hull-moving-average
//
// The Hull Moving Average (HMA) is a technical analysis indicator that uses a weighted moving average to reduce the lag in simple moving averages.
// It was developed by Alan Hull, who sought to create a moving average that was both fast and smooth. The HMA is calculated by first taking
// the weighted moving average of the input data using a weighting factor of W, where W is the square root of the length of the moving average.
// The result is then double-smoothed by taking the weighted moving average of this result using a weighting factor of W/2. This final average
// forms the HMA line, which can be used to make predictions about future price movements.
//go:generate callbackgen -type HULL
type HULL struct {
types.SeriesBase
Expand Down
16 changes: 10 additions & 6 deletions pkg/indicator/macd.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@ import (
"github.com/c9s/bbgo/pkg/types"
)

/*
macd implements moving average convergence divergence indicator
// macd implements moving average convergence divergence indicator
//
// Moving Average Convergence Divergence (MACD)
// - https://www.investopedia.com/terms/m/macd.asp
// - https://school.stockcharts.com/doku.php?id=technical_indicators:macd-histogram
// The Moving Average Convergence Divergence (MACD) is a technical analysis indicator that is used to measure the relationship between
// two moving averages of a security's price. It is calculated by subtracting the longer-term moving average from the shorter-term moving
// average, and then plotting the resulting value on the price chart as a line. This line is known as the MACD line, and is typically
// used to identify potential buy or sell signals. The MACD is typically used in conjunction with a signal line, which is a moving average
// of the MACD line, to generate more accurate buy and sell signals.

Moving Average Convergence Divergence (MACD)
- https://www.investopedia.com/terms/m/macd.asp
- https://school.stockcharts.com/doku.php?id=technical_indicators:macd-histogram
*/
type MACDConfig struct {
types.IntervalWindow // 9

Expand Down
7 changes: 7 additions & 0 deletions pkg/indicator/obv.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ obv implements on-balance volume indicator
On-Balance Volume (OBV) Definition
- https://www.investopedia.com/terms/o/onbalancevolume.asp
On-Balance Volume (OBV) is a technical analysis indicator that uses volume information to predict changes in stock price.
The idea behind OBV is that volume precedes price: when the OBV is rising, it means that buyers are becoming more aggressive and
that the stock price is likely to follow suit. When the OBV is falling, it indicates that sellers are becoming more aggressive and
that the stock price is likely to decrease. OBV is calculated by adding the volume on days when the stock price closes higher and
subtracting the volume on days when the stock price closes lower. This running total forms the OBV line, which can then be used
to make predictions about future stock price movements.
*/
//go:generate callbackgen -type OBV
type OBV struct {
Expand Down
8 changes: 8 additions & 0 deletions pkg/indicator/rma.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ const MaxNumOfRMATruncateSize = 500
// Running Moving Average
// Refer: https://github.com/twopirllc/pandas-ta/blob/main/pandas_ta/overlap/rma.py#L5
// Refer: https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.ewm.html#pandas-dataframe-ewm
//
// The Running Moving Average (RMA) is a technical analysis indicator that is used to smooth price data and reduce the lag associated
// with traditional moving averages. It is calculated by taking the weighted moving average of the input data, with the weighting factors
// determined by the length of the moving average. The resulting average is then plotted on the price chart as a line, which can be used to
// make predictions about future price movements. The RMA is typically more responsive to changes in the underlying data than a simple
// moving average, but may be less reliable in trending markets. It is often used in conjunction with other technical analysis indicators
// to confirm signals or provide additional information about the security's price.

//go:generate callbackgen -type RMA
type RMA struct {
types.SeriesBase
Expand Down
13 changes: 9 additions & 4 deletions pkg/indicator/rsi.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@ import (
"github.com/c9s/bbgo/pkg/types"
)

/*
rsi implements Relative Strength Index (RSI)
// rsi implements Relative Strength Index (RSI)
// https://www.investopedia.com/terms/r/rsi.asp
//
// The Relative Strength Index (RSI) is a technical analysis indicator that is used to measure the strength of a security's price. It is
// calculated by taking the average of the gains and losses of the security over a specified period of time, and then dividing the average gain
// by the average loss. This resulting value is then plotted as a line on the price chart, with values above 70 indicating overbought conditions
// and values below 30 indicating oversold conditions. The RSI can be used by traders to identify potential entry and exit points for trades,
// or to confirm other technical analysis signals. It is typically used in conjunction with other indicators to provide a more comprehensive
// view of the security's price.

https://www.investopedia.com/terms/r/rsi.asp
*/
//go:generate callbackgen -type RSI
type RSI struct {
types.SeriesBase
Expand Down
14 changes: 9 additions & 5 deletions pkg/indicator/stoch.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ import (

const DPeriod int = 3

/*
stoch implements stochastic oscillator indicator
// Stochastic Oscillator
// - https://www.investopedia.com/terms/s/stochasticoscillator.asp
//
// The Stochastic Oscillator is a technical analysis indicator that is used to identify potential overbought or oversold conditions
// in a security's price. It is calculated by taking the current closing price of the security and comparing it to the high and low prices
// over a specified period of time. This comparison is then plotted as a line on the price chart, with values above 80 indicating overbought
// conditions and values below 20 indicating oversold conditions. The Stochastic Oscillator can be used by traders to identify potential
// entry and exit points for trades, or to confirm other technical analysis signals. It is typically used in conjunction with other indicators
// to provide a more comprehensive view of the security's price.

Stochastic Oscillator
- https://www.investopedia.com/terms/s/stochasticoscillator.asp
*/
//go:generate callbackgen -type STOCH
type STOCH struct {
types.IntervalWindow
Expand Down
11 changes: 11 additions & 0 deletions pkg/indicator/supertrend.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ import (

var logst = logrus.WithField("indicator", "supertrend")

// The Super Trend is a technical analysis indicator that is used to identify potential buy and sell signals in a security's price. It is
// calculated by combining the exponential moving average (EMA) and the average true range (ATR) of the security's price, and then plotting
// the resulting value on the price chart as a line. The Super Trend line is typically used to identify potential entry and exit points
// for trades, and can be used to confirm other technical analysis signals. It is typically more responsive to changes in the underlying
// data than other trend-following indicators, but may be less reliable in trending markets. It is important to note that the Super Trend is a
// lagging indicator, which means that it may not always provide accurate or timely signals.
//
// To use Super Trend, identify potential entry and exit points for trades by looking for crossovers or divergences between the Super Trend line
// and the security's price. For example, a buy signal may be generated when the Super Trend line crosses above the security's price, while a sell
// signal may be generated when the Super Trend line crosses below the security's price.

//go:generate callbackgen -type Supertrend
type Supertrend struct {
types.SeriesBase
Expand Down
8 changes: 8 additions & 0 deletions pkg/indicator/tema.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ import (

// Refer: Triple Exponential Moving Average (TEMA)
// URL: https://investopedia.com/terms/t/triple-exponential-moving-average.asp
//
// The Triple Exponential Moving Average (TEMA) is a technical analysis indicator that is used to smooth price data and reduce the lag
// associated with traditional moving averages. It is calculated by taking the exponentially weighted moving average of the input data,
// and then taking the exponentially weighted moving average of that result, and then taking the exponentially weighted moving average of
// that result. This triple-smoothing process helps to eliminate much of the noise in the original data and provides a more accurate
// representation of the underlying trend. The TEMA line is then plotted on the price chart, which can be used to make predictions about
// future price movements. The TEMA is typically more responsive to changes in the underlying data than a simple moving average, but may be
// less reliable in trending markets.

//go:generate callbackgen -type TEMA
type TEMA struct {
Expand Down
9 changes: 9 additions & 0 deletions pkg/indicator/till.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ const defaultVolumeFactor = 0.7

// Refer: Tillson T3 Moving Average
// Refer URL: https://tradingpedia.com/forex-trading-indicator/t3-moving-average-indicator/
//
// The Tillson T3 Moving Average (T3) is a technical analysis indicator that is used to smooth price data and reduce the lag associated
// with traditional moving averages. It was developed by Tim Tillson and is based on the exponential moving average, with the weighting
// factors determined using a modified version of the cubic polynomial. The T3 is calculated by taking the weighted moving average of the
// input data using weighting factors that are based on the standard deviation of the data and the specified length of the moving average.
// This resulting average is then plotted on the price chart as a line, which can be used to make predictions about future price movements.
// The T3 is typically more responsive to changes in the underlying data than a simple moving average, but may be less reliable in trending
// markets.

//go:generate callbackgen -type TILL
type TILL struct {
types.SeriesBase
Expand Down
Loading

0 comments on commit 2b62616

Please sign in to comment.