Skip to content

generators module

Basic look-ahead indicators and label generators.

You can access all the indicators either by vbt.* or vbt.labels.*.


BOLB class

BOLB(
    wrapper,
    input_list,
    input_mapper,
    in_output_list,
    output_list,
    param_list,
    mapper_list,
    short_name,
    level_names
)

Label generator based on breakout_labels_nb().

Superclasses

Inherited members

Subclasses

  • vectorbt.labels.generators._BOLB

apply_func method

BOLB.apply_func(
    close,
    window,
    pos_th,
    neg_th,
    wait=1,
    flex_2d=True
)

For each value, return 1 if any value in the next period is greater than the positive threshold (in %), -1 if less than the negative threshold, and 0 otherwise.

First hit wins.


close method

Input array.


close_above method

BOLB.close_above(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is above other.

See combine_objs().


close_below method

BOLB.close_below(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is below other.

See combine_objs().


close_crossed_above method

BOLB.close_crossed_above(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is crossed_above other.

See combine_objs().


close_crossed_below method

BOLB.close_crossed_below(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is crossed_below other.

See combine_objs().


close_equal method

BOLB.close_equal(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is equal other.

See combine_objs().


close_stats method

BOLB.close_stats(
    *args,
    **kwargs
)

Stats of close as generic.


custom_func method

IndicatorFactory.from_apply_func.<locals>.custom_func(
    input_list,
    in_output_list,
    param_list,
    *args,
    input_shape=None,
    col=None,
    flex_2d=None,
    return_cache=False,
    use_cache=None,
    use_ray=False,
    **_kwargs
)

Custom function that forwards inputs and parameters to apply_func.


labels property

Output array.


labels_above method

BOLB.labels_above(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where labels is above other.

See combine_objs().


labels_below method

BOLB.labels_below(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where labels is below other.

See combine_objs().


labels_crossed_above method

BOLB.labels_crossed_above(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where labels is crossed_above other.

See combine_objs().


labels_crossed_below method

BOLB.labels_crossed_below(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where labels is crossed_below other.

See combine_objs().


labels_equal method

BOLB.labels_equal(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where labels is equal other.

See combine_objs().


labels_stats method

BOLB.labels_stats(
    *args,
    **kwargs
)

Stats of labels as generic.


neg_th_list property

List of neg_th values.


plot method

BOLB.plot(
    column=None,
    **kwargs
)

Plot close and overlay it with the heatmap of labels.

**kwargs are passed to GenericSRAccessor.overlay_with_heatmap().


pos_th_list property

List of pos_th values.


run class method

BOLB.run(
    close,
    window,
    pos_th=Default(0.0),
    neg_th=Default(0.0),
    short_name='bolb',
    hide_params=None,
    hide_default=True,
    **kwargs
)

Run BOLB indicator.

  • Inputs: close
  • Parameters: window, pos_th, neg_th
  • Outputs: labels

Pass a list of parameter names as hide_params to hide their column levels. Set hide_default to False to show the column levels of the parameters with a default value.

Other keyword arguments are passed to run_pipeline().


run_combs class method

BOLB.run_combs(
    close,
    window,
    pos_th=Default(0.0),
    neg_th=Default(0.0),
    r=2,
    param_product=False,
    comb_func=itertools.combinations,
    run_unique=True,
    short_names=None,
    hide_params=None,
    hide_default=True,
    **kwargs
)

Create a combination of multiple BOLB indicators using function comb_func.

  • Inputs: close
  • Parameters: window, pos_th, neg_th
  • Outputs: labels

comb_func must accept an iterable of parameter tuples and r. Also accepts all combinatoric iterators from itertools such as itertools.combinations. Pass r to specify how many indicators to run. Pass short_names to specify the short name for each indicator. Set run_unique to True to first compute raw outputs for all parameters, and then use them to build each indicator (faster).

Other keyword arguments are passed to BOLB.run().


window_list property

List of window values.


FIXLB class

FIXLB(
    wrapper,
    input_list,
    input_mapper,
    in_output_list,
    output_list,
    param_list,
    mapper_list,
    short_name,
    level_names
)

Label generator based on fixed_labels_apply_nb().

Superclasses

Inherited members

Subclasses

  • vectorbt.labels.generators._FIXLB

apply_func method

FIXLB.apply_func(
    close,
    n
)

Get percentage change from the current value to a future value.


close method

Input array.


close_above method

FIXLB.close_above(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is above other.

See combine_objs().


close_below method

FIXLB.close_below(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is below other.

See combine_objs().


close_crossed_above method

FIXLB.close_crossed_above(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is crossed_above other.

See combine_objs().


close_crossed_below method

FIXLB.close_crossed_below(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is crossed_below other.

See combine_objs().


close_equal method

FIXLB.close_equal(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is equal other.

See combine_objs().


close_stats method

FIXLB.close_stats(
    *args,
    **kwargs
)

Stats of close as generic.


custom_func method

IndicatorFactory.from_apply_func.<locals>.custom_func(
    input_list,
    in_output_list,
    param_list,
    *args,
    input_shape=None,
    col=None,
    flex_2d=None,
    return_cache=False,
    use_cache=None,
    use_ray=False,
    **_kwargs
)

Custom function that forwards inputs and parameters to apply_func.


labels property

Output array.


labels_above method

FIXLB.labels_above(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where labels is above other.

See combine_objs().


labels_below method

FIXLB.labels_below(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where labels is below other.

See combine_objs().


labels_crossed_above method

FIXLB.labels_crossed_above(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where labels is crossed_above other.

See combine_objs().


labels_crossed_below method

FIXLB.labels_crossed_below(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where labels is crossed_below other.

See combine_objs().


labels_equal method

FIXLB.labels_equal(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where labels is equal other.

See combine_objs().


labels_stats method

FIXLB.labels_stats(
    *args,
    **kwargs
)

Stats of labels as generic.


n_list property

List of n values.


plot method

FIXLB.plot(
    column=None,
    **kwargs
)

Plot close and overlay it with the heatmap of labels.

**kwargs are passed to GenericSRAccessor.overlay_with_heatmap().


run class method

FIXLB.run(
    close,
    n,
    short_name='fixlb',
    hide_params=None,
    hide_default=True,
    **kwargs
)

Run FIXLB indicator.

  • Inputs: close
  • Parameters: n
  • Outputs: labels

Pass a list of parameter names as hide_params to hide their column levels. Set hide_default to False to show the column levels of the parameters with a default value.

Other keyword arguments are passed to run_pipeline().


run_combs class method

FIXLB.run_combs(
    close,
    n,
    r=2,
    param_product=False,
    comb_func=itertools.combinations,
    run_unique=True,
    short_names=None,
    hide_params=None,
    hide_default=True,
    **kwargs
)

Create a combination of multiple FIXLB indicators using function comb_func.

  • Inputs: close
  • Parameters: n
  • Outputs: labels

comb_func must accept an iterable of parameter tuples and r. Also accepts all combinatoric iterators from itertools such as itertools.combinations. Pass r to specify how many indicators to run. Pass short_names to specify the short name for each indicator. Set run_unique to True to first compute raw outputs for all parameters, and then use them to build each indicator (faster).

Other keyword arguments are passed to FIXLB.run().


FMAX class

FMAX(
    wrapper,
    input_list,
    input_mapper,
    in_output_list,
    output_list,
    param_list,
    mapper_list,
    short_name,
    level_names
)

Look-ahead indicator based on future_max_apply_nb().

Superclasses

Inherited members


apply_func method

FMAX.apply_func(
    close,
    window,
    wait=1
)

Get the maximum of the next period.


close method

Input array.


close_above method

FMAX.close_above(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is above other.

See combine_objs().


close_below method

FMAX.close_below(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is below other.

See combine_objs().


close_crossed_above method

FMAX.close_crossed_above(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is crossed_above other.

See combine_objs().


close_crossed_below method

FMAX.close_crossed_below(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is crossed_below other.

See combine_objs().


close_equal method

FMAX.close_equal(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is equal other.

See combine_objs().


close_stats method

FMAX.close_stats(
    *args,
    **kwargs
)

Stats of close as generic.


custom_func method

IndicatorFactory.from_apply_func.<locals>.custom_func(
    input_list,
    in_output_list,
    param_list,
    *args,
    input_shape=None,
    col=None,
    flex_2d=None,
    return_cache=False,
    use_cache=None,
    use_ray=False,
    **_kwargs
)

Custom function that forwards inputs and parameters to apply_func.


fmax property

Output array.


fmax_above method

FMAX.fmax_above(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where fmax is above other.

See combine_objs().


fmax_below method

FMAX.fmax_below(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where fmax is below other.

See combine_objs().


fmax_crossed_above method

FMAX.fmax_crossed_above(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where fmax is crossed_above other.

See combine_objs().


fmax_crossed_below method

FMAX.fmax_crossed_below(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where fmax is crossed_below other.

See combine_objs().


fmax_equal method

FMAX.fmax_equal(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where fmax is equal other.

See combine_objs().


fmax_stats method

FMAX.fmax_stats(
    *args,
    **kwargs
)

Stats of fmax as generic.


run class method

FMAX.run(
    close,
    window,
    short_name='fmax',
    hide_params=None,
    hide_default=True,
    **kwargs
)

Run FMAX indicator.

  • Inputs: close
  • Parameters: window
  • Outputs: fmax

Pass a list of parameter names as hide_params to hide their column levels. Set hide_default to False to show the column levels of the parameters with a default value.

Other keyword arguments are passed to run_pipeline().


run_combs class method

FMAX.run_combs(
    close,
    window,
    r=2,
    param_product=False,
    comb_func=itertools.combinations,
    run_unique=True,
    short_names=None,
    hide_params=None,
    hide_default=True,
    **kwargs
)

Create a combination of multiple FMAX indicators using function comb_func.

  • Inputs: close
  • Parameters: window
  • Outputs: fmax

comb_func must accept an iterable of parameter tuples and r. Also accepts all combinatoric iterators from itertools such as itertools.combinations. Pass r to specify how many indicators to run. Pass short_names to specify the short name for each indicator. Set run_unique to True to first compute raw outputs for all parameters, and then use them to build each indicator (faster).

Other keyword arguments are passed to FMAX.run().


window_list property

List of window values.


FMEAN class

FMEAN(
    wrapper,
    input_list,
    input_mapper,
    in_output_list,
    output_list,
    param_list,
    mapper_list,
    short_name,
    level_names
)

Look-ahead indicator based on future_mean_apply_nb().

Superclasses

Inherited members


apply_func method

FMEAN.apply_func(
    close,
    window,
    ewm,
    wait=1,
    adjust=False
)

Get the mean of the next period.


close method

Input array.


close_above method

FMEAN.close_above(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is above other.

See combine_objs().


close_below method

FMEAN.close_below(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is below other.

See combine_objs().


close_crossed_above method

FMEAN.close_crossed_above(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is crossed_above other.

See combine_objs().


close_crossed_below method

FMEAN.close_crossed_below(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is crossed_below other.

See combine_objs().


close_equal method

FMEAN.close_equal(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is equal other.

See combine_objs().


close_stats method

FMEAN.close_stats(
    *args,
    **kwargs
)

Stats of close as generic.


custom_func method

IndicatorFactory.from_apply_func.<locals>.custom_func(
    input_list,
    in_output_list,
    param_list,
    *args,
    input_shape=None,
    col=None,
    flex_2d=None,
    return_cache=False,
    use_cache=None,
    use_ray=False,
    **_kwargs
)

Custom function that forwards inputs and parameters to apply_func.


ewm_list property

List of ewm values.


fmean property

Output array.


fmean_above method

FMEAN.fmean_above(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where fmean is above other.

See combine_objs().


fmean_below method

FMEAN.fmean_below(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where fmean is below other.

See combine_objs().


fmean_crossed_above method

FMEAN.fmean_crossed_above(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where fmean is crossed_above other.

See combine_objs().


fmean_crossed_below method

FMEAN.fmean_crossed_below(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where fmean is crossed_below other.

See combine_objs().


fmean_equal method

FMEAN.fmean_equal(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where fmean is equal other.

See combine_objs().


fmean_stats method

FMEAN.fmean_stats(
    *args,
    **kwargs
)

Stats of fmean as generic.


run class method

FMEAN.run(
    close,
    window,
    ewm=Default(False),
    short_name='fmean',
    hide_params=None,
    hide_default=True,
    **kwargs
)

Run FMEAN indicator.

  • Inputs: close
  • Parameters: window, ewm
  • Outputs: fmean

Pass a list of parameter names as hide_params to hide their column levels. Set hide_default to False to show the column levels of the parameters with a default value.

Other keyword arguments are passed to run_pipeline().


run_combs class method

FMEAN.run_combs(
    close,
    window,
    ewm=Default(False),
    r=2,
    param_product=False,
    comb_func=itertools.combinations,
    run_unique=True,
    short_names=None,
    hide_params=None,
    hide_default=True,
    **kwargs
)

Create a combination of multiple FMEAN indicators using function comb_func.

  • Inputs: close
  • Parameters: window, ewm
  • Outputs: fmean

comb_func must accept an iterable of parameter tuples and r. Also accepts all combinatoric iterators from itertools such as itertools.combinations. Pass r to specify how many indicators to run. Pass short_names to specify the short name for each indicator. Set run_unique to True to first compute raw outputs for all parameters, and then use them to build each indicator (faster).

Other keyword arguments are passed to FMEAN.run().


window_list property

List of window values.


FMIN class

FMIN(
    wrapper,
    input_list,
    input_mapper,
    in_output_list,
    output_list,
    param_list,
    mapper_list,
    short_name,
    level_names
)

Look-ahead indicator based on future_min_apply_nb().

Superclasses

Inherited members


apply_func method

FMIN.apply_func(
    close,
    window,
    wait=1
)

Get the minimum of the next period.


close method

Input array.


close_above method

FMIN.close_above(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is above other.

See combine_objs().


close_below method

FMIN.close_below(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is below other.

See combine_objs().


close_crossed_above method

FMIN.close_crossed_above(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is crossed_above other.

See combine_objs().


close_crossed_below method

FMIN.close_crossed_below(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is crossed_below other.

See combine_objs().


close_equal method

FMIN.close_equal(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is equal other.

See combine_objs().


close_stats method

FMIN.close_stats(
    *args,
    **kwargs
)

Stats of close as generic.


custom_func method

IndicatorFactory.from_apply_func.<locals>.custom_func(
    input_list,
    in_output_list,
    param_list,
    *args,
    input_shape=None,
    col=None,
    flex_2d=None,
    return_cache=False,
    use_cache=None,
    use_ray=False,
    **_kwargs
)

Custom function that forwards inputs and parameters to apply_func.


fmin property

Output array.


fmin_above method

FMIN.fmin_above(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where fmin is above other.

See combine_objs().


fmin_below method

FMIN.fmin_below(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where fmin is below other.

See combine_objs().


fmin_crossed_above method

FMIN.fmin_crossed_above(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where fmin is crossed_above other.

See combine_objs().


fmin_crossed_below method

FMIN.fmin_crossed_below(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where fmin is crossed_below other.

See combine_objs().


fmin_equal method

FMIN.fmin_equal(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where fmin is equal other.

See combine_objs().


fmin_stats method

FMIN.fmin_stats(
    *args,
    **kwargs
)

Stats of fmin as generic.


run class method

FMIN.run(
    close,
    window,
    short_name='fmin',
    hide_params=None,
    hide_default=True,
    **kwargs
)

Run FMIN indicator.

  • Inputs: close
  • Parameters: window
  • Outputs: fmin

Pass a list of parameter names as hide_params to hide their column levels. Set hide_default to False to show the column levels of the parameters with a default value.

Other keyword arguments are passed to run_pipeline().


run_combs class method

FMIN.run_combs(
    close,
    window,
    r=2,
    param_product=False,
    comb_func=itertools.combinations,
    run_unique=True,
    short_names=None,
    hide_params=None,
    hide_default=True,
    **kwargs
)

Create a combination of multiple FMIN indicators using function comb_func.

  • Inputs: close
  • Parameters: window
  • Outputs: fmin

comb_func must accept an iterable of parameter tuples and r. Also accepts all combinatoric iterators from itertools such as itertools.combinations. Pass r to specify how many indicators to run. Pass short_names to specify the short name for each indicator. Set run_unique to True to first compute raw outputs for all parameters, and then use them to build each indicator (faster).

Other keyword arguments are passed to FMIN.run().


window_list property

List of window values.


FSTD class

FSTD(
    wrapper,
    input_list,
    input_mapper,
    in_output_list,
    output_list,
    param_list,
    mapper_list,
    short_name,
    level_names
)

Look-ahead indicator based on future_std_apply_nb().

Superclasses

Inherited members


apply_func method

FSTD.apply_func(
    close,
    window,
    ewm,
    wait=1,
    adjust=False,
    ddof=0
)

Get the standard deviation of the next period.


close method

Input array.


close_above method

FSTD.close_above(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is above other.

See combine_objs().


close_below method

FSTD.close_below(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is below other.

See combine_objs().


close_crossed_above method

FSTD.close_crossed_above(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is crossed_above other.

See combine_objs().


close_crossed_below method

FSTD.close_crossed_below(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is crossed_below other.

See combine_objs().


close_equal method

FSTD.close_equal(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is equal other.

See combine_objs().


close_stats method

FSTD.close_stats(
    *args,
    **kwargs
)

Stats of close as generic.


custom_func method

IndicatorFactory.from_apply_func.<locals>.custom_func(
    input_list,
    in_output_list,
    param_list,
    *args,
    input_shape=None,
    col=None,
    flex_2d=None,
    return_cache=False,
    use_cache=None,
    use_ray=False,
    **_kwargs
)

Custom function that forwards inputs and parameters to apply_func.


ewm_list property

List of ewm values.


fstd property

Output array.


fstd_above method

FSTD.fstd_above(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where fstd is above other.

See combine_objs().


fstd_below method

FSTD.fstd_below(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where fstd is below other.

See combine_objs().


fstd_crossed_above method

FSTD.fstd_crossed_above(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where fstd is crossed_above other.

See combine_objs().


fstd_crossed_below method

FSTD.fstd_crossed_below(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where fstd is crossed_below other.

See combine_objs().


fstd_equal method

FSTD.fstd_equal(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where fstd is equal other.

See combine_objs().


fstd_stats method

FSTD.fstd_stats(
    *args,
    **kwargs
)

Stats of fstd as generic.


run class method

FSTD.run(
    close,
    window,
    ewm=Default(False),
    short_name='fstd',
    hide_params=None,
    hide_default=True,
    **kwargs
)

Run FSTD indicator.

  • Inputs: close
  • Parameters: window, ewm
  • Outputs: fstd

Pass a list of parameter names as hide_params to hide their column levels. Set hide_default to False to show the column levels of the parameters with a default value.

Other keyword arguments are passed to run_pipeline().


run_combs class method

FSTD.run_combs(
    close,
    window,
    ewm=Default(False),
    r=2,
    param_product=False,
    comb_func=itertools.combinations,
    run_unique=True,
    short_names=None,
    hide_params=None,
    hide_default=True,
    **kwargs
)

Create a combination of multiple FSTD indicators using function comb_func.

  • Inputs: close
  • Parameters: window, ewm
  • Outputs: fstd

comb_func must accept an iterable of parameter tuples and r. Also accepts all combinatoric iterators from itertools such as itertools.combinations. Pass r to specify how many indicators to run. Pass short_names to specify the short name for each indicator. Set run_unique to True to first compute raw outputs for all parameters, and then use them to build each indicator (faster).

Other keyword arguments are passed to FSTD.run().


window_list property

List of window values.


LEXLB class

LEXLB(
    wrapper,
    input_list,
    input_mapper,
    in_output_list,
    output_list,
    param_list,
    mapper_list,
    short_name,
    level_names
)

Label generator based on local_extrema_apply_nb().

Superclasses

Inherited members

Subclasses

  • vectorbt.labels.generators._LEXLB

apply_func method

LEXLB.apply_func(
    close,
    pos_th,
    neg_th,
    flex_2d=True
)

Get array of local extrema denoted by 1 (peak) or -1 (trough), otherwise 0.

Two adjacent peak and trough points should exceed the given threshold parameters.

If any threshold is given element-wise, it will be applied per new/updated extremum.

Inspired by https://www.mdpi.com/1099-4300/22/10/1162/pdf


close method

Input array.


close_above method

LEXLB.close_above(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is above other.

See combine_objs().


close_below method

LEXLB.close_below(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is below other.

See combine_objs().


close_crossed_above method

LEXLB.close_crossed_above(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is crossed_above other.

See combine_objs().


close_crossed_below method

LEXLB.close_crossed_below(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is crossed_below other.

See combine_objs().


close_equal method

LEXLB.close_equal(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is equal other.

See combine_objs().


close_stats method

LEXLB.close_stats(
    *args,
    **kwargs
)

Stats of close as generic.


custom_func method

IndicatorFactory.from_apply_func.<locals>.custom_func(
    input_list,
    in_output_list,
    param_list,
    *args,
    input_shape=None,
    col=None,
    flex_2d=None,
    return_cache=False,
    use_cache=None,
    use_ray=False,
    **_kwargs
)

Custom function that forwards inputs and parameters to apply_func.


labels property

Output array.


labels_above method

LEXLB.labels_above(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where labels is above other.

See combine_objs().


labels_below method

LEXLB.labels_below(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where labels is below other.

See combine_objs().


labels_crossed_above method

LEXLB.labels_crossed_above(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where labels is crossed_above other.

See combine_objs().


labels_crossed_below method

LEXLB.labels_crossed_below(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where labels is crossed_below other.

See combine_objs().


labels_equal method

LEXLB.labels_equal(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where labels is equal other.

See combine_objs().


labels_stats method

LEXLB.labels_stats(
    *args,
    **kwargs
)

Stats of labels as generic.


neg_th_list property

List of neg_th values.


plot method

LEXLB.plot(
    column=None,
    **kwargs
)

Plot close and overlay it with the heatmap of labels.

**kwargs are passed to GenericSRAccessor.overlay_with_heatmap().


pos_th_list property

List of pos_th values.


run class method

LEXLB.run(
    close,
    pos_th,
    neg_th,
    short_name='lexlb',
    hide_params=None,
    hide_default=True,
    **kwargs
)

Run LEXLB indicator.

  • Inputs: close
  • Parameters: pos_th, neg_th
  • Outputs: labels

Pass a list of parameter names as hide_params to hide their column levels. Set hide_default to False to show the column levels of the parameters with a default value.

Other keyword arguments are passed to run_pipeline().


run_combs class method

LEXLB.run_combs(
    close,
    pos_th,
    neg_th,
    r=2,
    param_product=False,
    comb_func=itertools.combinations,
    run_unique=True,
    short_names=None,
    hide_params=None,
    hide_default=True,
    **kwargs
)

Create a combination of multiple LEXLB indicators using function comb_func.

  • Inputs: close
  • Parameters: pos_th, neg_th
  • Outputs: labels

comb_func must accept an iterable of parameter tuples and r. Also accepts all combinatoric iterators from itertools such as itertools.combinations. Pass r to specify how many indicators to run. Pass short_names to specify the short name for each indicator. Set run_unique to True to first compute raw outputs for all parameters, and then use them to build each indicator (faster).

Other keyword arguments are passed to LEXLB.run().


MEANLB class

MEANLB(
    wrapper,
    input_list,
    input_mapper,
    in_output_list,
    output_list,
    param_list,
    mapper_list,
    short_name,
    level_names
)

Label generator based on mean_labels_apply_nb().

Superclasses

Inherited members

Subclasses

  • vectorbt.labels.generators._MEANLB

apply_func method

MEANLB.apply_func(
    close,
    window,
    ewm,
    wait=1,
    adjust=False
)

Get the percentage change from the current value to the average of the next period.


close method

Input array.


close_above method

MEANLB.close_above(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is above other.

See combine_objs().


close_below method

MEANLB.close_below(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is below other.

See combine_objs().


close_crossed_above method

MEANLB.close_crossed_above(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is crossed_above other.

See combine_objs().


close_crossed_below method

MEANLB.close_crossed_below(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is crossed_below other.

See combine_objs().


close_equal method

MEANLB.close_equal(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is equal other.

See combine_objs().


close_stats method

MEANLB.close_stats(
    *args,
    **kwargs
)

Stats of close as generic.


custom_func method

IndicatorFactory.from_apply_func.<locals>.custom_func(
    input_list,
    in_output_list,
    param_list,
    *args,
    input_shape=None,
    col=None,
    flex_2d=None,
    return_cache=False,
    use_cache=None,
    use_ray=False,
    **_kwargs
)

Custom function that forwards inputs and parameters to apply_func.


ewm_list property

List of ewm values.


labels property

Output array.


labels_above method

MEANLB.labels_above(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where labels is above other.

See combine_objs().


labels_below method

MEANLB.labels_below(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where labels is below other.

See combine_objs().


labels_crossed_above method

MEANLB.labels_crossed_above(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where labels is crossed_above other.

See combine_objs().


labels_crossed_below method

MEANLB.labels_crossed_below(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where labels is crossed_below other.

See combine_objs().


labels_equal method

MEANLB.labels_equal(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where labels is equal other.

See combine_objs().


labels_stats method

MEANLB.labels_stats(
    *args,
    **kwargs
)

Stats of labels as generic.


plot method

MEANLB.plot(
    column=None,
    **kwargs
)

Plot close and overlay it with the heatmap of labels.

**kwargs are passed to GenericSRAccessor.overlay_with_heatmap().


run class method

MEANLB.run(
    close,
    window,
    ewm=Default(False),
    short_name='meanlb',
    hide_params=None,
    hide_default=True,
    **kwargs
)

Run MEANLB indicator.

  • Inputs: close
  • Parameters: window, ewm
  • Outputs: labels

Pass a list of parameter names as hide_params to hide their column levels. Set hide_default to False to show the column levels of the parameters with a default value.

Other keyword arguments are passed to run_pipeline().


run_combs class method

MEANLB.run_combs(
    close,
    window,
    ewm=Default(False),
    r=2,
    param_product=False,
    comb_func=itertools.combinations,
    run_unique=True,
    short_names=None,
    hide_params=None,
    hide_default=True,
    **kwargs
)

Create a combination of multiple MEANLB indicators using function comb_func.

  • Inputs: close
  • Parameters: window, ewm
  • Outputs: labels

comb_func must accept an iterable of parameter tuples and r. Also accepts all combinatoric iterators from itertools such as itertools.combinations. Pass r to specify how many indicators to run. Pass short_names to specify the short name for each indicator. Set run_unique to True to first compute raw outputs for all parameters, and then use them to build each indicator (faster).

Other keyword arguments are passed to MEANLB.run().


window_list property

List of window values.


TRENDLB class

TRENDLB(
    wrapper,
    input_list,
    input_mapper,
    in_output_list,
    output_list,
    param_list,
    mapper_list,
    short_name,
    level_names
)

Label generator based on trend_labels_apply_nb().

Superclasses

Inherited members

Subclasses

  • vectorbt.labels.generators._TRENDLB

apply_func method

TRENDLB.apply_func(
    close,
    pos_th,
    neg_th,
    mode,
    flex_2d=True
)

Apply a trend labeling function based on TrendMode.


close method

Input array.


close_above method

TRENDLB.close_above(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is above other.

See combine_objs().


close_below method

TRENDLB.close_below(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is below other.

See combine_objs().


close_crossed_above method

TRENDLB.close_crossed_above(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is crossed_above other.

See combine_objs().


close_crossed_below method

TRENDLB.close_crossed_below(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is crossed_below other.

See combine_objs().


close_equal method

TRENDLB.close_equal(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where close is equal other.

See combine_objs().


close_stats method

TRENDLB.close_stats(
    *args,
    **kwargs
)

Stats of close as generic.


custom_func method

IndicatorFactory.from_apply_func.<locals>.custom_func(
    input_list,
    in_output_list,
    param_list,
    *args,
    input_shape=None,
    col=None,
    flex_2d=None,
    return_cache=False,
    use_cache=None,
    use_ray=False,
    **_kwargs
)

Custom function that forwards inputs and parameters to apply_func.


labels property

Output array.


labels_above method

TRENDLB.labels_above(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where labels is above other.

See combine_objs().


labels_below method

TRENDLB.labels_below(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where labels is below other.

See combine_objs().


labels_crossed_above method

TRENDLB.labels_crossed_above(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where labels is crossed_above other.

See combine_objs().


labels_crossed_below method

TRENDLB.labels_crossed_below(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where labels is crossed_below other.

See combine_objs().


labels_equal method

TRENDLB.labels_equal(
    other,
    level_name=None,
    allow_multiple=True,
    **kwargs
)

Return True for each element where labels is equal other.

See combine_objs().


labels_stats method

TRENDLB.labels_stats(
    *args,
    **kwargs
)

Stats of labels as generic.


mode_list property

List of mode values.


neg_th_list property

List of neg_th values.


plot method

TRENDLB.plot(
    column=None,
    **kwargs
)

Plot close and overlay it with the heatmap of labels.

**kwargs are passed to GenericSRAccessor.overlay_with_heatmap().


pos_th_list property

List of pos_th values.


run class method

TRENDLB.run(
    close,
    pos_th,
    neg_th,
    mode=Default(0),
    short_name='trendlb',
    hide_params=None,
    hide_default=True,
    **kwargs
)

Run TRENDLB indicator.

  • Inputs: close
  • Parameters: pos_th, neg_th, mode
  • Outputs: labels

Pass a list of parameter names as hide_params to hide their column levels. Set hide_default to False to show the column levels of the parameters with a default value.

Other keyword arguments are passed to run_pipeline().


run_combs class method

TRENDLB.run_combs(
    close,
    pos_th,
    neg_th,
    mode=Default(0),
    r=2,
    param_product=False,
    comb_func=itertools.combinations,
    run_unique=True,
    short_names=None,
    hide_params=None,
    hide_default=True,
    **kwargs
)

Create a combination of multiple TRENDLB indicators using function comb_func.

  • Inputs: close
  • Parameters: pos_th, neg_th, mode
  • Outputs: labels

comb_func must accept an iterable of parameter tuples and r. Also accepts all combinatoric iterators from itertools such as itertools.combinations. Pass r to specify how many indicators to run. Pass short_names to specify the short name for each indicator. Set run_unique to True to first compute raw outputs for all parameters, and then use them to build each indicator (faster).

Other keyword arguments are passed to TRENDLB.run().