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 Pick From Several Stocks?

    General Discussion
    3
    5
    3583
    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.
    • NewestTrader
      NewestTrader last edited by

      Hi,

      I am new at Backtrader and would like to use it in the following way:

      I have several stocks I can pick from.
      I would like to pick (buy and later sell) some of these stocks whenever my strategy forsees this.

      How can I supply several stocks within Backtrader and how can I tell Backtrader only to buy / sell these stocks I would like to?

      In the examples I can only see something like: self.buy()

      Is there any example that does something similar?

      Thanks in advance!

      The NewestTrader

      A 1 Reply Last reply Reply Quote 0
      • A
        ab_trader @NewestTrader last edited by

        @NewestTrader

        Have you tried to search documentation and/or blog before posting a question here?
        As I know it was a good blog post describing how to trade multiple stocks with backtarder.

        • If my answer helped, hit reputation up arrow at lower right corner of the post.
        • Python Debugging With Pdb
        • New to python and bt - check this out
        NewestTrader 1 Reply Last reply Reply Quote 0
        • NewestTrader
          NewestTrader @ab_trader last edited by

          @ab_trader said in How to Pick From Several Stocks?:

          @NewestTrader

          Have you tried to search documentation and/or blog before posting a question here?
          As I know it was a good blog post describing how to trade multiple stocks with backtarder.

          Hi, thanks for your reply. Yes, I looked for a place in the documentation where exactly this is described, but in vain.

          Which blog post do you mean?

          1 Reply Last reply Reply Quote 0
          • P
            Paska Houso last edited by Paska Houso

            @ab_trader may be referring to this: https://www.backtrader.com/blog/posts/2017-04-09-multi-example/multi-example.html

            Operating on the stock you want is as simple as self.buy(data=my_target_data)

            NewestTrader 1 Reply Last reply Reply Quote 1
            • NewestTrader
              NewestTrader @Paska Houso last edited by backtrader

              @Paska-Houso said in How to Pick From Several Stocks?:

              @ab_trader may be referring to this: https://www.backtrader.com/blog/posts/2017-04-09-multi-example/multi-example.html

              Operating on the stock you want is as simple as self.buy(data=my_target_data)

              thanks a lot, that was very helpful (I saw the blog post, but was not able to refer it to my question)

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post
              Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors