Candlestick Patterns

Abandoned Baby - Bear

qufilab.abandoned_baby_bear(high, low, open_, close, periods=10)

Abandoned Baby Bear

Parameters
highndarray

An array containing high prices.

lowndarray

An array containing low prices.

open_ndarray

An array containing open prices.

closendarray

An array containing close prices.

periodsint, optional

Specifying number of periods for trend identification.

Returns
patternndarray

A numpy ndarray of type bool specifying true whether a pattern has been found or false otherwise.

Abandoned Baby - Bull

qufilab.abandoned_baby_bull(high, low, open_, close, periods=10)

Abandoned Baby Bull

Parameters
highndarray

An array containing high prices.

lowndarray

An array containing low prices.

open_ndarray

An array containing open prices.

closendarray

An array containing close prices.

periodsint, optional

Specifying number of periods for trend identification.

Returns
patternndarray

A numpy ndarray of type bool specifying true whether a pattern has been found or false otherwise.

Belt Hold - Bear

qufilab.belthold_bear(high, low, open_, close, periods=10, shadow_margin=5.0)

Belt Hold Bear

Parameters
highndarray

An array containing high prices.

lowndarray

An array containing low prices.

open_ndarray

An array containing open prices.

closendarray

An array containing close prices.

periodsint, optional

Specifying number of periods for trend identification.

shadow_marginfloat, optional

Specify what margin should be allowed for the shadows. By using for example 5%, both the lower and upper shadow can be as high as 5% of the candlestick body size. This exist to allow some margin (not restrict to no shadow).

Returns
patternndarray

A numpy ndarray of type bool specifying true whether a pattern has been found or false otherwise.

Belt Hold - Bull

qufilab.belthold_bull(high, low, open_, close, periods=10, shadow_margin=5.0)

Belt Hold Bull

Parameters
highndarray

An array containing high prices.

lowndarray

An array containing low prices.

open_ndarray

An array containing open prices.

closendarray

An array containing close prices.

periodsint, optional

Specifying number of periods for trend identification.

shadow_marginfloat, optional

Specify what margin should be allowed for the shadows. By using for example 5%, both the lower and upper shadow can be as high as 5% of the candlestick body size. This exist to allow some margin (not restrict to no shadow).

Returns
patternndarray

A numpy ndarray of type bool specifying true whether a pattern has been found or false otherwise.

Doji

qufilab.doji(high, low, open_, close, periods=10)
Parameters
highndarray

An array containing high prices.

lowndarray

An array containing low prices.

open_ndarray

An array containing open prices.

closendarray

An array containing close prices.

periodsint, optional

Specifying number of periods for trend identification.

Returns
dojindarray

A numpy ndarray of type bool specifying true whether a pattern has been found or false otherwise.

Examples

>>> import qufilab as ql
>>> import numpy as np
... 
>>> df = ql.load_sample('MSFT')
>>> doji = ql.doji(df['high'], df['low'], df['open'], df['close'])
>>> print(doji)
[False False False ... False False False]

Dragonfly Doji

qufilab.dragonfly_doji(high, low, open_, close, periods=10)
Parameters
highndarray

An array containing high prices.

lowndarray

An array containing low prices.

open_ndarray

An array containing open prices.

closendarray

An array containing close prices.

periodsint, optional

Specifying number of periods for trend identification.

Returns
dragonfly_dojindarray

A numpy ndarray of type bool specifying true whether a pattern has been found or false otherwise.

Examples

>>> import qufilab as ql
>>> import numpy as np
... 
>>> df = ql.load_sample('MSFT')
>>> dragonfly_doji = ql.dragonfly_doji(df['high'], df['low'], df['open'], df['close'])
>>> print(dragonfly_doji)
[False False False ... False False False]

Engulfing - Bear

qufilab.engulfing_bear(high, low, open_, close, periods=10)
Parameters
highndarray

An array containing high prices.

lowndarray

An array containing low prices.

open_ndarray

An array containing open prices.

closendarray

An array containing close prices.

periodsint, optional

Specifying number of periods for trend identification.

Returns
engulfingndarray

A numpy ndarray of type bool specifying true whether a pattern has been found or false otherwise.

Engulfing - Bull

qufilab.engulfing_bull(high, low, open_, close, periods=10)
Parameters
highndarray

An array containing high prices.

lowndarray

An array containing low prices.

open_ndarray

An array containing open prices.

closendarray

An array containing close prices.

periodsint, optional

Specifying number of periods for trend identification.

Returns
engulfingndarray

A numpy ndarray of type bool specifying true whether a pattern has been found or false otherwise.

Hammer

qufilab.hammer(high, low, open_, close, periods=10, shadow_margin=5.0)
Parameters
highndarray

An array containing high prices.

lowndarray

An array containing low prices.

open_ndarray

An array containing open prices.

closendarray

An array containing close prices.

periodsint, optional

Specifying number of periods for trend identification.

shadow_marginfloat, optional

Specify what margin should be allowed for the shadows. By using i.e. 5%, upper shadow can be as long as 5% of the candlestick body size. This exist to allow some margin and not exclude the shadows entirely.

Returns
hammerndarray

A numpy array of type bool specifying true whether a pattern has been found or false otherwise.

Notes

Observe that the lower shadow shall be bigger than 2x the body, but lower than 3x the body.

_images/hammer.png

Examples

>>> import qufilab as ql
>>> import numpy as np
... 
>>> df = ql.load_sample('MSFT')
>>> hammer = ql.hammer(df['high'], df['low'], df['open'], df['close'])
>>> print(hammer)
[False False False ... False False False]

Harami - Bear

qufilab.harami_bear(high, low, open_, close, periods=10)
Parameters
highndarray

An array containing high prices.

lowndarray

An array containing low prices.

open_ndarray

An array containing open prices.

closendarray

An array containing close prices.

periodsint, optional

Specifying number of periods for trend identification.

Returns
harami_bearndarray

A numpy ndarray of type bool specifying true whether a pattern has been found or false otherwise.

Harami - Bull

qufilab.harami_bull(high, low, open_, close, periods=10)
Parameters
highndarray

An array containing high prices.

lowndarray

An array containing low prices.

open_ndarray

An array containing open prices.

closendarray

An array containing close prices.

periodsint, optional

Specifying number of periods for trend identification.

Returns
harami_bullndarray

A numpy ndarray of type bool specifying true whether a pattern has been found or false otherwise.

Inverted Hammer

qufilab.inverted_hammer(high, low, open_, close, periods=10, shadow_margin=5.0)
Parameters
highndarray

An array containing high prices.

lowndarray

An array containing low prices.

open_ndarray

An array containing open prices.

closendarray

An array containing close prices.

periodsint, optional

Specifying number of periods for trend identification.

shadow_marginfloat, optional

Specify what margin should be allowed for the shadows. By using i.e. 5%, lower shadow can be as long as 5% of the candlestick body size. This exist to allow some margin and not exclude the shadows entirely.

Returns
inverted_hammerndarray

A numpy ndarray of type bool specifying true whether a pattern has been found or false otherwise.

Examples

>>> import qufilab as ql
>>> import numpy as np
... 
>>> df = ql.load_sample('MSFT')
>>> inverted_hammer = ql.inverted_hammer(df['high'], df['low'], df['open'], df['close'])
>>> print(inverted_hammer)
[False False False ... False False False]

Kicking - Bear

qufilab.kicking_bear(high, low, open_, close, periods=10, shadow_margin=5.0)
Parameters
highndarray

An array containing high prices.

lowndarray

An array containing low prices.

open_ndarray

An array containing open prices.

closendarray

An array containing close prices.

periodsint, optional

Specifying number of periods for trend identification.

shadow_marginfloat, optional

Specify what margin should be allowed for the shadows. By using for example 5%, both the lower and upper shadow can be as high as 5% of the candlestick body size. This exist to allow some margin (not restrict to no shadow).

Returns
kicking_bearndarray

A numpy ndarray of type bool specifying true whether a pattern has been found or false otherwise.

Kicking - Bull

qufilab.kicking_bull(high, low, open_, close, periods=10, shadow_margin=5.0)
Parameters
highndarray

An array containing high prices.

lowndarray

An array containing low prices.

open_ndarray

An array containing open prices.

closendarray

An array containing close prices.

periodsint, optional

Specifying number of periods for trend identification.

shadow_marginfloat, optional

Specify what margin should be allowed for the shadows. By using for example 5%, both the lower and upper shadow can be as high as 5% of the candlestick body size. This exist to allow some margin (not restrict to no shadow).

Returns
kicking_bullndarray

A numpy ndarray of type bool specifying true whether a pattern has been found or false otherwise.

Marubozu White

qufilab.marubozu_white(high, low, open_, close, shadow_margin=5.0, periods=10)
Parameters
highndarray

An array containing high prices.

lowndarray

An array containing low prices.

open_ndarray

An array containing open prices.

closendarray

An array containing close prices.

shadow_marginfloat, optional

Specify what margin should be allowed for the shadows. By using for example 5%, both the lower and upper shadow can be as high as 5% of the candlestick body size. This exist to allow some margin (not restrict to no shadow).

periodsint, optional

Specifying number of periods for trend identification.

Returns
marubozu_whitendarray

A numpy ndarray of type bool specifying true whether a pattern has been found or false otherwise.

Examples

>>> import qufilab as ql
>>> import numpy as np
... 
>>> df = ql.load_sample('MSFT')
>>> marubozu_white = ql.marubozu_white(df['high'], df['low'], df['open'], df['close'])
>>> print(marubozu_white)
[False False False ... False False False]

Marubozu Black

qufilab.marubozu_black(high, low, open_, close, shadow_margin=5.0, periods=10)
Parameters
highndarray

An array containing high prices.

lowndarray

An array containing low prices.

open_ndarray

An array containing open prices.

closendarray

An array containing close prices.

shadow_marginfloat, optional

Specify what margin should be allowed for the shadows. By using for example 5%, both the lower and upper shadow can be as high as 5% of the candlestick body size. This exist to allow some margin (not restrict to no shadow).

periodsint, optional

Specifying number of periods for trend identification.

Returns
marubozu_blackndarray

A numpy ndarray of type bool specifying true whether a pattern has been found or false otherwise.

Piercing

qufilab.piercing(high, low, open_, close, periods=10)
Parameters
highndarray

An array containing high prices.

lowndarray

An array containing low prices.

open_ndarray

An array containing open prices.

closendarray

An array containing close prices.

periodsint, optional

Specifying number of periods for trend identification.

Returns
piercingndarray

A numpy ndarray of type bool specifying true whether a pattern has been found or false otherwise.

Spinning Top White

qufilab.spinning_top_white(high, low, open_, close, periods=10)
Parameters
highndarray

An array containing high prices.

lowndarray

An array containing low prices.

open_ndarray

An array containing open prices.

closendarray

An array containing close prices.

periodsint, optional

Specifying number of periods for trend identification.

Returns
spinning_top_whitendarray

A numpy ndarray of type bool specifying true whether a pattern has been found or false otherwise.

Three White Soldiers

qufilab.tws(high, low, open_, close, periods=10)

Three White Soldiers

Parameters
highndarray

An array containing high prices.

lowndarray

An array containing low prices.

open_ndarray

An array containing open prices.

closendarray

An array containing close prices.

periodsint, optional

Specifying number of periods for trend identification.

Returns
twsndarray

A numpy ndarray of type bool specifying true whether a pattern has been found or false otherwise.