Skip to content

Trend


Average Directional Movement

This indicator attempts to quantify trend strength by measuring the amount of movement in a single direction.

Sources

Parameters:

Name Type Description Default
high Series

high Series

required
low Series

low Series

required
close Series

close Series

required
length int

The period. Default: 14

None
signal_length int

Signal period. Default: length

None
adxr_length int

ADXR period. Default: 2

None
scalar float

Scalar. Default: 100

None
talib bool

If installed, use TA Lib. Default: True

None
tvmode bool

Trading View. Default: False

None
mamode str

See help(ta.ma). Default: "rma"

None
drift int

Difference amount. Default: 1

None
offset int

Post shift. Default: 0

None

Other Parameters:

Name Type Description
fillna value

pd.DataFrame.fillna(value)

Returns:

Type Description
DataFrame

4 columns

Note

signal_length is like TradingView's default ADX.




Alpha Trend

This indicator attempts to filter sideways movement for accurate signals.

Sources

Parameters:

Name Type Description Default
open_ Series

open Series

required
high Series

high Series

required
low Series

low Series

required
close Series

close Series

required
volume Series

volume Series. Default: None

None
src str

One of: "open", "high", "low" or "close". Default: "close"

None
length int

ATR, MFI, or RSI period. Default: 14

None
multiplier float

Trailing ATR multiple. Default: 1

None
threshold float

Momentum threshold. Default: 50

None
lag int

Lag period of main trend. Default: 2

None
mamode str

See help(ta.ma). Default: "sma"

None
talib bool

If installed, use TA Lib. Default: True

None
offset int

Post shift. Default: 0

None

Other Parameters:

Name Type Description
fillna value

pd.DataFrame.fillna(value)

Returns:

Type Description
DataFrame

2 columns




Archer Moving Averages Trends

This indicator, by Kevin Johnson, attempts to identify both long run and short run trends.

Sources

Parameters:

Name Type Description Default
close Series

close Series

required
fast int

Fast MA period. Default: 8

None
slow int

Slow MA period. Default: 21

None
lookback int

Lookback period for long_run and short_run. Default: 2

None
mamode str

See help(ta.ma). Default: "ema"

None
offset int

Post shift. Default: 0

None

Other Parameters:

Name Type Description
run_length int

OBV trend period. Default: 2

fillna value

pd.DataFrame.fillna(value)

Returns:

Type Description
DataFrame

2 columns

Note

Both the long run and short run values are integers, where 1 is a trend and 0 is not a trend.




Aroon & Aroon Oscillator

This indicator attempts to identify trends and their magnitude.

Sources

Parameters:

Name Type Description Default
high Series

high Series

required
low Series

low Series

required
length int

The period. Default: 14

None
scalar float

Scalar. Default: 100

None
talib bool

If installed, use TA Lib. Default: True

None
offset int

Post shift. Default: 0

None

Other Parameters:

Name Type Description
fillna value

pd.DataFrame.fillna(value)

Returns:

Type Description
DataFrame

3 columns


NOTICE

Thanks to all those that have sponsored and dontated to the library in the past! Your support has been greatly appreciated! 🙏

However, future releases are on definite hold until 100+ donations of $150+ have been received via Buy Me a Coffee.

Help keep this library and application the best in it's class!




Choppiness Index

This indicator, by E.W. Dreiss, attempts to determine choppiness.

Sources

Parameters:

Name Type Description Default
high Series

high Series

required
low Series

low Series

required
close Series

close Series

required
length int

The period. Default: 14

None
atr_length int

ATR period. Default: 1

None
ln bool

Use ln instead of log10. Default: False

None
scalar float

Scalar. Default: 100

None
drift int

Difference amount. Default: 1

None
offset int

Post shift. Default: 0

None

Other Parameters:

Name Type Description
fillna value

pd.DataFrame.fillna(value)

Returns:

Type Description
Series

1 column

Note
  • Choppy: ~ 100
  • Trending: ~ 0




Chande Kroll Stop

This indicator, by Tushar Chande and Stanley Kroll, attempts to identify trends with long and short stops.

Sources
  • "The New Technical Trader", Wiley 1st ed. ISBN 9780471597803, page 95
  • multicharts

Parameters:

Name Type Description Default
close Series

close Series

required
p int

ATR and first stop period; see Note. Default: 10 for both modes

None
x float

ATR scalar; see Note. Default: 1 or 3

None
q int

Second stop period; see Note. Default: 9 or 20

None
tvmode bool

Trading View mode. Default: True

None
mamode str

See help(ta.ma). Default: None

None
offset int

Post shift. Default: 0

None

Other Parameters:

Name Type Description
fillna value

pd.DataFrame.fillna(value)

Returns:

Type Description
DataFrame

2 columns

Book vs TradingView Defaults
  • Book: p=10, x=3, q=20, ma="sma"
  • Trading View: p=10, x=1, q=9, ma="rma"




Decay

This function creates a decay moving forward from prior signals.

Sources

Parameters:

Name Type Description Default
close Series

close Series

required
length int

The period. Default: 1

None
mode str

Either "linear" or "exp" (exponetional) Default: "linear"

None
offset int

Post shift. Default: 0

None

Other Parameters:

Name Type Description
fillna value

pd.DataFrame.fillna(value)

Returns:

Type Description
Series

1 column




Decreasing

This indicator, by Kevin Johnson, attempts to identify decreasing periods.

Sources
  • Kevin Johnson

Parameters:

Name Type Description Default
close Series

close Series

required
length int

The period. Default: 1

None
strict bool

Check if continuously increasing. Default: False

None
percent float

Percent, i.e. 5.0. Default: None

None
asint bool

Returns as Int. Default: True

None
drift int

Difference amount. Default: 1

None
offset int

Post shift. Default: 0

None

Other Parameters:

Name Type Description
fillna value

pd.DataFrame.fillna(value)

Returns:

Type Description
Series

1 column




Detrend Price Oscillator

This indicator attempts to detrend (remove the trend) and identify cycles.

Sources

Parameters:

Name Type Description Default
close Series

close Series

required
length int

The period. Default: 20

None
centered bool

Shift the dpo back by int(0.5 * length) + 1. Set to False to remove data leakage. Default: True

True
offset int

Post shift. Default: 0

None

Other Parameters:

Name Type Description
fillna value

pd.DataFrame.fillna(value)

Returns:

Type Description
Series

1 column

Possible Data Leak

Set centered=False to remove data leakage. See Issue #60.




Hilbert Transform TrendLine

This indicator uses the Hilbert Transform to smooth values.

Sources

Parameters:

Name Type Description Default
close Series

close Series.

required
talib bool

If installed, use TA Lib. Default: True

None
prenan int

Prenans to apply. Ehlers's 6 or 12, TALib 63 Default: 63

None
offset int

Post shift. Default: 0

None

Other Parameters:

Name Type Description
fillna value

pd.DataFrame.fillna(value)

Returns:

Type Description
Series

1 column

Warning

TA-Lib Correlation: np.float64(0.9979308363057683)

Tip

Corrective contributions welcome!


NOTICE

Thanks to all those that have sponsored and dontated to the library in the past! Your support has been greatly appreciated! 🙏

However, future releases are on definite hold until 100+ donations of $150+ have been received via Buy Me a Coffee.

Help keep this library and application the best in it's class!




Increasing

This indicator, by Kevin Johnson, attempts to identify increasing periods.

Sources
  • Kevin Johnson

Parameters:

Name Type Description Default
close Series

close Series

required
length int

The period. Default: 1

None
strict bool

Check if continuously increasing. Default: False

None
percent float

Percent, i.e. 5.0. Default: None

None
asint bool

Returns as Int. Default: True

None
drift int

Difference amount. Default: 1

None
offset int

Post shift. Default: 0

None

Other Parameters:

Name Type Description
fillna value

pd.DataFrame.fillna(value)

Returns:

Type Description
Series

1 column




Long Run

This indicator, by Kevin Johnson, attempts to identify long runs.

Sources

Parameters:

Name Type Description Default
fast Series

fast Series.

required
slow Series

slow Series.

required
length int

The decreasing and increasing period. Default: 2

None
offset int

Post shift. Default: 0

None

Other Parameters:

Name Type Description
fillna value

pd.DataFrame.fillna(value)

Returns:

Type Description
Series

1 column




Parabolic Stop and Reverse

This indicator, by J. Wells Wilder, attempts to identify trend direction and potential reversals.

Sources

Parameters:

Name Type Description Default
high Series

high Series

required
low Series

low Series

required
close Series

Optional close Series

None
af0 float

Initial Acceleration Factor. Default: 0.02

None
af float

Acceleration Factor. Default: 0.02

None
max_af float

Maximum Acceleration Factor. Default: 0.2

None
offset int

Post shift. Default: 0

None

Other Parameters:

Name Type Description
fillna value

pd.DataFrame.fillna(value)

Returns:

Type Description
DataFrame

4 columns

Warning

TA-Lib Correlation: np.float64(0.9837617513753181)

Tip

Corrective contributions welcome!




Q Stick

This indicator, by Tushar Chande, attempts to quantify and identify trends.

Sources

Parameters:

Name Type Description Default
open_ Series

open Series

required
close Series

close Series

required
length int

The period. Default: 10

None
mamode str

See help(ta.ma). Default: "sma"

None
offset int

Post shift. Default: 0

None

Other Parameters:

Name Type Description
fillna value

pd.DataFrame.fillna(value)

Returns:

Type Description
Series

1 column




Random Walk Index

This indicator attempts to identify the difference between a trend and a random walk.

Sources

Parameters:

Name Type Description Default
high Series

high Series

required
low Series

low Series

required
close Series

close Series

required
length int

The period. Default: 14

None
mamode str

See help(ta.ma). Default: "rma"

None
talib bool

If installed, use TA Lib. Default: True

None
drift int

Difference amount. Default: 1

None
offset int

Post shift. Default: 0

None

Other Parameters:

Name Type Description
fillna value

pd.DataFrame.fillna(value)

Returns:

Type Description
DataFrame

2 columns




Short Run

This indicator, by Kevin Johnson, attempts to identify short runs.

Sources

Parameters:

Name Type Description Default
fast Series

fast Series.

required
slow Series

slow Series.

required
length int

The decreasing and increasing period. Default: 2

None
offset int

Post shift. Default: 0

None

Other Parameters:

Name Type Description
fillna value

pd.DataFrame.fillna(value)

Returns:

Type Description
Series

1 column




Trendflex

This trend indicator, by John F. Ehlers, complements the "reflex" indicator.

Sources

Parameters:

Name Type Description Default
close Series

close Series

required
length int

The period. Default: 20

None
smooth int

Super Smoother period. Default: ```20````

None
alpha float

Alpha weight. Default: 0.04

None
pi float

Ehlers's truncated value: 3.14159. Default: 3.14159

None
sqrt2 float

Ehlers's truncated value: 1.414. Default: 1.414

None
offset int

Post shift. Default: 0

None

Other Parameters:

Name Type Description
fillna value

pd.DataFrame.fillna(value)

Returns:

Type Description
Series

1 column

Note

John F. Ehlers introduced two indicators within the article "Reflex: A New Zero-Lag Indicator” in February 2020, TASC magazine. One of which is Reflex, a lag reduced cycle indicator. Both indicators (Reflex/Trendflex) are oscillators that complement each other with the focus for cycle and trend.




TTM Trend

This indicator, by John Carter, labels bars green, 1, or red -1, when above or below the average value.

Sources
  • John Carter, book “Mastering the Trade”
  • prorealcode

Parameters:

Name Type Description Default
high Series

high Series

required
low Series

low Series

required
close Series

close Series

required
length int

The period. Default: 6

None
offset int

Post shift. Default: 0

None

Other Parameters:

Name Type Description
fillna value

pd.DataFrame.fillna(value)

Returns:

Type Description
DataFrame

1 column

Tip
  • Two bars of the opposite color is the signal to get in or out.
  • Recommended to stay in trade if colors do not change.


NOTICE

Thanks to all those that have sponsored and dontated to the library in the past! Your support has been greatly appreciated! 🙏

However, future releases are on definite hold until 100+ donations of $150+ have been received via Buy Me a Coffee.

Help keep this library and application the best in it's class!




Vertical Horizontal Filter

This indicator, by Adam White, attempts to identify trending and ranging markets.

Sources

Parameters:

Name Type Description Default
close Series

close Series

required
length int

The period. Default: 28

None
offset int

Post shift. Default: 0

None

Other Parameters:

Name Type Description
fillna value

pd.DataFrame.fillna(value)

Returns:

Type Description
Series

1 column




Vortex

This indicator attempts to capture positive and negative trend movement using two oscillators.

Sources

Parameters:

Name Type Description Default
high Series

high Series

required
low Series

low Series

required
close Series

close Series

required
length int

The period. Default: 14

None
drift int

Difference amount. Default: 1

None
offset int

Post shift. Default: 0

None

Other Parameters:

Name Type Description
fillna value

pd.DataFrame.fillna(value)

Returns:

Type Description
DataFrame

2 columns




Zigzag

This indicator attempts to filter out smaller movements while identifying trend direction. It does not predict future trends, but it does identify swing highs and lows.

Sources

Parameters:

Name Type Description Default
high Series

high Series

required
low Series

low Series

required
close Series

close Series. Default: None

None
legs int

Number of legs (> 2). Default: 10

None
deviation float

Reversal deviation percentage. Default: 5

None
backtest bool
None
offset int

Post shift. Default: 0

None

Other Parameters:

Name Type Description
fillna value

pd.DataFrame.fillna(value)

Returns:

Type Description
DataFrame

2 columns

Deviation

When deviation=10, it shows movements greater than 10%.

Backtest Mode

Ensures the DataFrame is safe for backtesting. By default, swing points are returned on the pivot index. Intermediate swings are not returned at all. This mode swing detection is placed on the bar that would have been detected. Furthermore, changes in swing levels are also included instead of only the final value.

  • Use the following formula to get the true index of a pivot: p_i = i - int(floor(legs / 2))
Warning

A Series reversal will create a new line.


"Buy Me A Coffee"

ko-fi