Backtrader Community

    • 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/

    Intraday strategy with reference to daily Moving Average

    Indicators/Strategies/Analyzers
    2
    3
    610
    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.
    • sobeasy
      sobeasy last edited by

      It is very common to reference the 200-days moving average during trade,
      I am trying to implement an intraday strategy, which will taking account the 200-days moving average.

      However, I can't figure out how to load 200-days bar while I loaded 1-min data into backtrader

      Also, I just wonder how can we start live trade in day-by-day manner, that the strategy can reference 200-days MA immediately in the start of trade?

      Any ideas ? so much thanks.

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

        You have to add 2 (or more depending on your use case) data feeds

        • Intraday
        • Daily

        And run a moving average on the daily one which is the 2nd data feed in the array self.datas. See: Docs - Data Feeds - Multiple TimeFrames

        @sobeasy said in Intraday strategy with reference to daily Moving Average:

        Also, I just wonder how can we start live trade in day-by-day manner, that the strategy can reference 200-days MA immediately in the start of trade?

        Your daily data feed has to simply feature enough data before the live feed to be able to provide a 200-period moving average.

        sobeasy 1 Reply Last reply Reply Quote 0
        • sobeasy
          sobeasy @backtrader last edited by

          @backtrader thanks for the prompt reply!
          I will work on it later.

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