Navigation

    Backtrader Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

    How to use EMA without a strategy

    General Code/Help
    ema indicators
    3
    4
    29
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      aqa20 last edited by

      Hi

      I want to use backtrader EMA without a strategy to calculate EMA for an array of close values, but I don't know how the data should look like in order for backtrader to accept it

      from backtrader.indicators import EMA
      
      random_array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
      
      value = EMA(random_array, period=10)[0]
      
      print(value)
      
      
      #output: IndexError: array index out of range
      
      1 Reply Last reply Reply Quote 0
      • D
        dmitry.prokopiev last edited by

        it's impossible, use ta-lib ...

        run-out A 2 Replies Last reply Reply Quote 2
        • run-out
          run-out @dmitry.prokopiev last edited by

          @dmitry-prokopiev said in How to use EMA without a strategy:

          it's impossible, use ta-lib ...

          In addition to this, you can try the dataframe friendly bta-lib

          Just note there's been some issue with the latest releases of pandas/numpy.

          1 Reply Last reply Reply Quote 1
          • A
            aqa20 @dmitry.prokopiev last edited by

            @dmitry-prokopiev said in How to use EMA without a strategy:

            it's impossible, use ta-lib ...

            Thank you

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            Copyright © 2016, 2017, 2018 NodeBB Forums | Contributors
            $(document).ready(function () { app.coldLoad(); }); }