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/

    Period params in indicators

    Indicators/Strategies/Analyzers
    2
    2
    455
    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
      Rstrong last edited by

      If i use an indicator like :

      btind.AverageTrueRange(self.datas[i], period = 14)
      

      or

       btind.SMA(Close, period = 50)
      

      Assuming each period is 1 day, is the current day ever included in the period? It would make sense to me that its not including the day the indicator is being called on since then the data cant be used for predictions but i wanted to be sure. If not, how do I know which indicators include the current day and which dont?

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

        Indicators are designed to know nothing about datetime. The period they operate is measured in price bars (groups of OHLC price components)

        This in turn allows to create indicators on indicators.

        You may of course design a custom indicators which require the source data to carry a datetime payload.

        The period starts counting at the current bar and goes backwards (it cannot obviously go forward)

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