backtrader.indicators.ichimoku module¶
Ichimoku Indicator Module - Ichimoku Cloud.
This module provides the Ichimoku Kinko Hyo (Ichimoku Cloud) indicator developed by Goichi Hosoda in 1969 for comprehensive trend analysis.
- Classes:
Ichimoku: Ichimoku Cloud indicator with multiple lines.
Example
- class MyStrategy(bt.Strategy):
- def __init__(self):
self.ichimoku = bt.indicators.Ichimoku(self.data)
- def next(self):
# Price above cloud indicates uptrend if (self.data.close[0] > self.ichimoku.senkou_span_a[0] and
self.data.close[0] > self.ichimoku.senkou_span_b[0]): self.buy()
- class backtrader.indicators.ichimoku.Ichimoku[source]¶
Bases:
IndicatorDeveloped and published in his book in 1969 by journalist Goichi Hosoda
- Formula:
tenkan_sen = (Highest (High, tenkan) + Lowest (Low, tenkan)) / 2.0
kijun_sen = (Highest (High, kijun) + Lowest (Low, kijun)) / 2.0
The next 2 are pushed 26 bars into the future
senkou_span_a = (tenkan_sen + kijun_sen) / 2.0
senkou_span_b = ((Highest (High, senkou) + Lowest (Low, senkou)) / 2.0
This is pushed 26 bars into the past
chikou = close
The cloud (Kumo) is formed by the area between the senkou_spans
- plotinfo = <backtrader.metabase.plotinfo_obj object>¶
- plotlines = <backtrader.metabase.plotlines_obj object>¶
- __init__(*args, **kwargs)¶
- frompackages = ()¶
- packages = ()¶