Navigation

    Backtrader Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. Simone
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
    S
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 3
    • Best 0
    • Groups 0

    Simone

    @Simone

    0
    Reputation
    76
    Profile views
    3
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    Simone Unfollow Follow

    Latest posts made by Simone

    • RE: Can somebody explain me how to use the heikin ashi indicator into a strategy

      I want to use the heikin ashi data into the indicators, for example, i want to use the weighted moving avarage and the RSI also based to the Hekin Ashi data.
      I've tried to wrote this:

      self.sma=bt.indicators.SimpleMovingAverage(self.hk.close[0], period=self.params.speriod)
      

      but is not working. Is giving me:

      AttributeError: 'Lines_LineSeries_LineIterator_DataAccessor_Strateg' object has no attribute 'ha_close'
      

      I've tried also in that way:

      def __init__(self):
              self.ha_close=bt.indicators.HeikinAshi()
              self.startcash=self.broker.getvalue()
      	self.ema=bt.indicators.WeightedMovingAverage(
      		self.ha_close[0],period=self.params.period)
      
      IndexError: array index out of range
      

      And another question because on internet (https://backtest-rookies.com/2018/01/26/backtrader-working-heikin-ashi/) i found a tutorial that explain one strategy code but is using hk.close instead of ha_close that you told me.

      P.S. I'm sorry if my question are so obviously for a lot of people. I'm pretty new and here is look like one of the only place that somebody can help me

      posted in General Code/Help
      S
      Simone
    • Can somebody explain me how to use the heikin ashi indicator into a strategy

      Hi at all as you can see from the short description field can somebody explain me how to use heikin ashi indicator into a strategy. I was reading the documentation about the heikin ashi but i didn't understand how implement the indicator inside my strategy. Can somebody please help me?

      posted in General Code/Help
      S
      Simone
    • Where find and put the data ?

      Hi, at all, i'm new with backtrader and following the quickstart of the official page i've copied and paste some line of codes to try to understand how backtrader works. I'm not a programmer but i want to improve myself and learn. my problem i think for that i've understand is that it doesn't find the data. But i don't understand where i've to put the data. I've searched on internet and i've found another guy that has been the same problem (https://community.backtrader.com/topic/951/cannot-find-file-orcl-1995-2014-txt-from-the-quickstart-tutorial/4) but i didn't understand. I'll put below the output. Can somebody help me?

      Starting Portfolio Value: 100000.00


      FileNotFoundError Traceback (most recent call last)
      <ipython-input-3-b8cdb1f6eed7> in <module>
      37
      38 # Run over everything
      ---> 39 cerebro.run()
      40
      41 # Print out the final result

      ~/anaconda3/lib/python3.7/site-packages/backtrader/cerebro.py in run(self, **kwargs)
      1125 # let's skip process "spawning"
      1126 for iterstrat in iterstrats:
      -> 1127 runstrat = self.runstrategies(iterstrat)
      1128 self.runstrats.append(runstrat)
      1129 if self._dooptimize:

      ~/anaconda3/lib/python3.7/site-packages/backtrader/cerebro.py in runstrategies(self, iterstrat, predata)
      1208 if self._exactbars < 1: # datas can be full length
      1209 data.extend(size=self.params.lookahead)
      -> 1210 data._start()
      1211 if self._dopreload:
      1212 data.preload()

      ~/anaconda3/lib/python3.7/site-packages/backtrader/feed.py in _start(self)
      201
      202 def _start(self):
      --> 203 self.start()
      204
      205 if not self._started:

      ~/anaconda3/lib/python3.7/site-packages/backtrader/feeds/yahoo.py in start(self)
      92
      93 def start(self):
      ---> 94 super(YahooFinanceCSVData, self).start()
      95
      96 if not self.params.reverse:

      ~/anaconda3/lib/python3.7/site-packages/backtrader/feed.py in start(self)
      672 else:
      673 # Let an exception propagate to let the caller know
      --> 674 self.f = io.open(self.p.dataname, 'r')
      675
      676 if self.p.headers:

      FileNotFoundError: [Errno 2] No such file or directory: '/home/simone/anaconda3/lib/python3.7/site-packages/../../datas/orcl-1995-2014.txt'

      posted in General Code/Help
      S
      Simone