Backtrader Community

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

    Best posts made by BorutF

    • RE: How to get the index of the current iteration in next?

      @run-out said in How to get the index of the current iteration in next?:

      @borutf You can get the current bar but using len(self)

      Thanks.

      posted in General Code/Help
      B
      BorutF
    • RE: 5min data from yahoo

      @anders_lind

      2022-05-17 23:59:59.999989

      This happens to every datetime??

      I always use bt.feeds.PandasData , it can work on yfinance downloads as well.

      posted in General Code/Help
      B
      BorutF
    • RE: Passing params to my strategy

      @rapha It is possible that it is about the Python version change.

      params = dict(
            target_n_positions=20
      )
      

      You could try by defining the params inside in a dict, as shown above.

      When I run both the tuple and dict approaches work, but who knows. I run backtrader in a environment in 3.8, as I have found some troubles with the newer versions.

      posted in General Code/Help
      B
      BorutF
    • RE: Define which specific method you want to inherit from strategy.

      @goloap the thing that helped me was

      notify_cashvalue = BaseStrategy.notify_cashvalue
      

      you can do this for all the methods you want to inherit from the BaseStartegy class.

      posted in General Code/Help
      B
      BorutF
    • How to get the index of the current iteration in next?

      Hello,

      I am very new to Backtrader, hence I have a pretty simple question.

      I understand you use self.data.low[0] to get let's say the low value of the current iteration, as 0 is the index by which you access the current data.

      But how do you the index of the current iteration? Let's say you are at the 100th example in the time-series. Where do you access this value?

      Best Regards,

      Borut

      posted in General Code/Help
      B
      BorutF
    • 1 / 1