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: Have "SPY" based indicator for every symbol execution

    Indicators/Strategies/Analyzers
    2
    3
    168
    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.
    • Yanir Taflev
      Yanir Taflev last edited by

      Hello all,
      I"m new to backtrader, I"m writing my first serious strategy and I want to correlate
      the current data to SMA("SPY"),
      for example, divide current close with current SMA("SPY") read in my strategy.
      Semathically something like this:
      buy1 = self.data.close[0] / indicators.SMA("SPY")[0]

      The "SPY" part should be static no matter which symbol I"m currently working.
      Ultimately I want to compare my symbol to the leading trend.

      Thank you.

      1 Reply Last reply Reply Quote 0
      • Yanir Taflev
        Yanir Taflev last edited by

        Since no one answered I would guess Backtrader has no support for such a scenario?

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

          No answer simply means no answer. Your scenario is possible with bt.

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