0

I am trying to plot the Ichimoku indicator using Backtrader in Python3

It plots it well, however, I am not able to see the future Kumo cloud. That is the extra 26 bars to the right after the last price on the X-axis

I have tried using different start/end dates, but it doesn't work.

It only plots the exacts dates, instead, what I need are 26 more bars to the right.

Can someone please advise? Here is my code so far,

import backtrader as bt
from datetime import datetime

class indicators_(bt.Strategy):

    def __init__(self):
        self.rsi = bt.indicators.RSI_SMA(self.data.close, period=21)
        self.ichimoku = bt.indicators.ichimoku.Ichimoku(self.data)

    def next(self):
        pass


cerebro = bt.Cerebro()
cerebro.addstrategy(indicators_)

data = bt.feeds.YahooFinanceData(
    dataname='AAPL',
    fromdate = datetime(2005,1,1),
    todate = datetime(2006,1,1),
    buffered= True
    )

cerebro.adddata(data)

cerebro.run()

cerebro.plot(style='bars',start=datetime(2005, 6, 1), end=datetime(2006, 1, 20))

Here is the link to the resulting chart with indicators added Chart with Ichimoku indicator

0 Answers0