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/

    self.buy() usage to short one stock while go long in another stock

    Indicators/Strategies/Analyzers
    2
    2
    49
    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.
    • Z
      zuj last edited by

      I am trying to replicate the code given on this page. According to this when have to long a spread, I have to just call self.buy(). But I have to buy x amount of 1 stock while short beta*x amount of another stock. Where do I put that logic in self.buy()? It doesn't even calculate beta which is required for this type of algorithm to work.

      Y 1 Reply Last reply Reply Quote 0
      • Y
        yunjinqi @zuj last edited by

        @zuj you should self.buy to long a stock and use self.sell to short another stock

        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(); }); }