For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

Logout when plotting



  • Hi,

    I am quite new to python an absolute new to Backtrader, so if I asked something stupid please forgive me.

    When I run this code from my terminal my user got logout, would someone please help? I am using Mac OS

    from future import (absolute_import, division, print_function,
    unicode_literals)

    import backtrader as bt
    from IPython import get_ipython
    class St(bt.Strategy):
    def init(self):
    self.sma = bt.indicators.SimpleMovingAverage(self.data)

    data = bt.feeds.BacktraderCSVData(dataname='/Users/py/Documents/python/testdata/forex.csv')

    cerebro = bt.Cerebro()
    cerebro.adddata(data)
    cerebro.addstrategy(St)
    cerebro.run()

    cerebro.plot(iplot=False)


  • administrators

    1. Top of the page
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
    
    1. The backtrader code itself does not run in the shell and has no contact with it. It seems awkward to import get_ipython and to run cerebro.plot(ipython=False), because those seems to be related to be running inside a Jupyter Notebook or Spyder environment.

Log in to reply
 

});