Skip to content

Ichimoku Cloud

Ichimoku Cloud implemented in PyTorch with "Just In Time" (JIT) compilation

IchimokuCloud

Bases: torch.nn.Module

A PyTorch implementation of the Ichimoku Cloud indicator. It computes five different lines: conversion line, baseline, span A, span B, and chikou span.

Parameters:

Name Type Description Default
conversion_period int

The conversion line period. Default as 9.

9
base_period int

The baseline period. Default as 26.

26
span_b_period int

The span B period. Default as 52.

52

Attributes:

Name Type Description
conversion_period int

The conversion line period.

base_period int

The baseline period.

span_b_period int

The span B period.

forward(high, low, close)

Computes the Ichimoku Cloud indicator based on the high, low, and close price data.

Parameters:

Name Type Description Default
high torch.Tensor

A tensor containing the high-price data.

required
low torch.Tensor

A tensor containing the low-price data.

required
close torch.Tensor

A tensor containing the close price data.

required

Returns:

Name Type Description
tuple tuple

A tuple containing five tensors: conversion line, baseline, span A, span B, and chikou span.

kernel(x, period) staticmethod

Applies the kernel calculation to a given tensor.

Parameters:

Name Type Description Default
x torch.Tensor

A tensor to transform.

required
period int

The kernel period.

required

Returns:

Type Description
torch.Tensor

torch.Tensor: The transformed tensor.