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/

    Datafeed as indicator

    Indicators/Strategies/Analyzers
    2
    2
    833
    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.
    • R
      rm last edited by

      Apologies if this has already been asked, I couldn't find anything similar.

      I am pre-processing the data for my second datafeed, and also using the original unprocessed data as a primary datafeed.

      I am trying to create a strat similar to a SMA crossover strat, using my preprocessed data instead of a rolling mean. In terms of pseudocode it is similar to this -

      when preprocessed data > original data data then self.order = self.buy() ...

      Is it possible to use my secondary datafeed as an indicator, or should I create a dummy indicator to pass values through?

      B 1 Reply Last reply Reply Quote 0
      • B
        backtrader administrators @rm last edited by

        @rm said in Datafeed as indicator:

        preprocessed data > original data

        That's a standard comparison and will generate a lines object. Same as if you did:

        • data.close - data.high

        It doesn't matter if the operation is boolean or arithmentic.

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