backtrader_plotting usage
-
Hello
I'm using backtrader_plotting to show the graphs. It is very useful because i can zoom using the whel of the mouse.
Unfortunately, when i put two indicators in the code, the panel with the wheel disappear and the page becomes larger than the screen. Someone has any idea about this problem?
Thanks in advanceimport datetime
import backtrader as bt
from backtrader_plotting import Bokeh
class TestStrategy(bt.Strategy):
params = (
('buydate', 21),
('holdtime', 6),
)
def next(self):
if len(self.data) == self.p.buydate:
self.buy(self.datas[0], size=None)
if len(self.data) == self.p.buydate + self.p.holdtime:
self.sell(self.datas[0], size=None)
if name == 'main':
cerebro = bt.Cerebro()
cerebro.addstrategy(TestStrategy, buydate=3)
cerebro.addanalyzer(bt.analyzers.TradeAnalyzer, _name='tradeanalyzer')
cerebro.addanalyzer(bt.analyzers.PyFolio, _name='pyfolio')
data = bt.feeds.YahooFinanceCSVData(
dataname="orcl-1995-2014.txt",
# Do not pass values before this date
fromdate=datetime.datetime(2000, 1, 1),
# Do not pass values after this date
todate=datetime.datetime(2001, 2, 28),
reverse=False,
)
cerebro.adddata(data)
cerebro.run()
b = Bokeh(style='bar', plot_mode='single')
cerebro.plot(b)
-
For your next posts - please read the statement about use of backticks on top of the page. This will make your code pieces readable.
-
Thank you. Can I modify it?
-
@TullioTech i don't think so, editing is turned off.