Skip to content

Candle Sets

CandleSet

Instance of a CandleSet.

Attributes:

Name Type Description
value_class Optional[estrade.graph.candle_set.CandleType]

Type of Candle

frame_set Optional[estrade.graph.frame_set.FrameSet]

The FrameSet instance that send ticks to this instance.

market_open_only bool

apply this indicator only when market is open.

ref str

reference of this instance

epic: Optional[Epic] inherited property readonly

Return the Epic associated to this instance.

Returns:

Type Description
Optional[Epic]

Epic associated to this instance.

ref: str inherited property writable

Return ref of current instance.

Returns:

Type Description
str

reference of current instance.

__init__(self, candle_type=<CandleType.CLASSIC: 0>, **kwargs) special

Create a new instance of a CandleSet.

Parameters:

Name Type Description Default
candle_type CandleType

Type of candles to generate.

<CandleType.CLASSIC: 0>
kwargs

see BaseIndicator

{}
Source code in estrade/graph/indicators/candle_set.py
def __init__(
    self,
    candle_type: CandleType = CandleType.CLASSIC,
    **kwargs,
) -> None:
    """
    Create a new instance of a CandleSet.

    Arguments:
        candle_type: Type of candles to generate.
        kwargs: see [`BaseIndicator`][estrade.graph.base_indicator.BaseIndicator]
    """
    value_class = (
        JapaneseCandle if candle_type == CandleType.CLASSIC else HeikinAshiCandle
    )
    BaseIndicator.__init__(self, value_class=value_class, **kwargs)

build_value_from_frame(self, frame, epic_market_open) inherited

Create a new value for this indicator.

This method is triggered when its frame_set create a new Frame.

Parameters:

Name Type Description Default
frame Frame

The newly created frame.

required
epic_market_open bool

is the epic open?

required

Returns:

Type Description
Optional[BaseIndicatorValue]

An instance of this instance value_class (None Market is not open).

Source code in estrade/graph/indicators/candle_set.py
def build_value_from_frame(
    self, frame: "Frame", epic_market_open: bool
) -> Optional["BaseIndicatorValue"]:
    """
    Create a new value for this indicator.

    This method is triggered when its `frame_set` create a new
        [`Frame`][estrade.graph.frame_set.Frame].

    Arguments:
        frame: The newly created frame.
        epic_market_open: is the epic open?

    Returns:
        An instance of this instance `value_class` (`None` Market is not open).
    """
    if not self.market_open_only or epic_market_open:
        new_value = self.value_class(
            indicator=self,
            frame=frame,
        )
        return new_value
    return None

Classic Japanese Candle

Representation of a Classic candle in a Candle sticks chart.

Attributes:

Name Type Description
indicator estrade.graph.base_indicator.BaseIndicator

Parent indicator.

frame estrade.graph.frame_set.Frame

Parent frame.

body: Optional[float] inherited property readonly

Absolute difference between open and close of the candle.

        |
        |
        ┴  ┐
       | | |
       | | |<-- body
       | | |
        ┬  ┘
        |
        |

close: Optional[float] property readonly

Return candle close value.

Note

The return value is None when the candle is not closed.

Returns:

Type Description
Optional[float]

Candle close value

closed: bool inherited property readonly

Check if the parent frame is closed.

Returns:

Type Description
bool

Is the parent frame closed?

color: Optional[estrade.enums.CandleColor] inherited property readonly

Color of the current instance.

Returns:

Type Description
Optional[estrade.enums.CandleColor]

Color as CandleColor enum.

head: Optional[float] inherited property readonly

Distance between the highest value and the highest from (open/last).

        |  ┐
        |  | <-- head
        ┴  ┘
       | |
       | |
       | |
        ┬
        |
        |

height: float inherited property readonly

Height of candle (high - low).

        |  ┐
        |  |
        ┴  |
       | | |
       | | |<-- height
       | | |
        ┬  |
        |  |
        |  ┘

high: float property readonly

Return candle low value.

Returns:

Type Description
float

Candle highest received tick value.

last: float property readonly

Return candle last value.

Returns:

Type Description
float

Candle last received tick value.

low: float property readonly

Return candle low value.

Returns:

Type Description
float

Candle lowest received tick value.

nb_ticks: int inherited property readonly

Count of Ticks received by the parent frame.

Returns:

Type Description
int

Number of Ticks received by the parent frame.

next: Optional[BaseIndicatorValue] inherited property readonly

Return the value of this indicator on the next frame.

Returns:

Type Description
Optional[BaseIndicatorValue]

This indicator value on the next frame (None if the parent have no next frame)

open: float property readonly

Return candle open value.

Returns:

Type Description
float

Candle first received tick value.

previous: Optional[BaseIndicatorValue] inherited property readonly

Return the value of this indicator on the previous frame.

Returns:

Type Description
Optional[BaseIndicatorValue]

This indicator value on the previous frame (None if the parent have no previous frame)

tail: Optional[float] inherited property readonly

Distance between the lowest value and the lowest from (open/last).

        |
        |
        ┴
       | |
       | |
       | |
        ┬  ┐
        |  | <-- tail
        |  ┘

Heikin Ashi Candle

Representation of a Heikin Ashi candle in a Candle sticks chart.

Attributes:

Name Type Description
indicator estrade.graph.base_indicator.BaseIndicator

Parent indicator.

frame estrade.graph.frame_set.Frame

Parent frame.

body: Optional[float] inherited property readonly

Absolute difference between open and close of the candle.

        |
        |
        ┴  ┐
       | | |
       | | |<-- body
       | | |
        ┬  ┘
        |
        |

close: Optional[float] property readonly

Return candle close value.

Note

The return value is None when the candle is not closed.

Returns:

Type Description
Optional[float]

Candle close value

closed: bool inherited property readonly

Check if the parent frame is closed.

Returns:

Type Description
bool

Is the parent frame closed?

color: Optional[estrade.enums.CandleColor] inherited property readonly

Color of the current instance.

Returns:

Type Description
Optional[estrade.enums.CandleColor]

Color as CandleColor enum.

head: Optional[float] inherited property readonly

Distance between the highest value and the highest from (open/last).

        |  ┐
        |  | <-- head
        ┴  ┘
       | |
       | |
       | |
        ┬
        |
        |

height: float inherited property readonly

Height of candle (high - low).

        |  ┐
        |  |
        ┴  |
       | | |
       | | |<-- height
       | | |
        ┬  |
        |  |
        |  ┘

high: float property readonly

Return candle high value.

Returns:

Type Description
float

Maximum from open, last and low tick value.

last: float property readonly

Return candle last value.

Returns:

Type Description
float

Mean of open tick, high tick, low tick and last tick values.

low: float property readonly

Return candle low value.

Returns:

Type Description
float

Minimum from open, last and low tick value.

nb_ticks: int inherited property readonly

Count of Ticks received by the parent frame.

Returns:

Type Description
int

Number of Ticks received by the parent frame.

next: Optional[BaseIndicatorValue] inherited property readonly

Return the value of this indicator on the next frame.

Returns:

Type Description
Optional[BaseIndicatorValue]

This indicator value on the next frame (None if the parent have no next frame)

open: float property readonly

Return candle open value.

Returns:

Type Description
float

Open tick value when the candle is the first of its CandleSet, otherwise this function returns the mean between the previous candle open and last value.

previous: Optional[BaseIndicatorValue] inherited property readonly

Return the value of this indicator on the previous frame.

Returns:

Type Description
Optional[BaseIndicatorValue]

This indicator value on the previous frame (None if the parent have no previous frame)

tail: Optional[float] inherited property readonly

Distance between the lowest value and the lowest from (open/last).

        |
        |
        ┴
       | |
       | |
       | |
        ┬  ┐
        |  | <-- tail
        |  ┘